<commit_before><!doctype html>
<html lang="en">

  <head>
    <meta charset="utf-8">

    <title>Zero Downtime Deployment with Ansible</title>

    <meta name="description" content="Learn how to provision Linux servers with a web-proxy, a database and automate zero downtime deployment of a Java application to a load balanced environment.">
    <meta name="author" content="<NAME>">

    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="../css/reveal.min.css">
    <!-- BEKK Theme -->
    <link rel="stylesheet" href="../css/theme/bekk.css" id="theme">
    <!-- <link rel="stylesheet" href="../css/theme/default.css" id="theme"> -->

    <!-- For syntax highlighting -->
    <link rel="stylesheet" href="../lib/css/zenburn.css">

    <!-- BEKK Theme -->
    <link rel="stylesheet" href="../css/theme/bekk.css" id="theme">

    <!-- If the query includes 'print-pdf', use the PDF print sheet -->
    <script>
      document.write( '<link rel="stylesheet" href="../css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
    </script>

    <!--[if lt IE 9]>
    <script src="lib/js/html5shiv.js"></script>
    <![endif]-->
  </head>

  <body>


    <div class="reveal">

      <div class="slides">

        <section>
        <h2>Zero Downtime Deployment with Ansible</h2>
        </section>

        <section>
        <h2>Slides & Repo</h2>
        <ul>
          <li><a href="http://steinim.github.io/slides/zero-downtime-ansible">http://steinim.github.io/slides/zero-downtime-ansible</a></li>
          <li><a href="https://github.com/steinim/zero-downtime-ansible">https://github.com/steinim/zero-downtime-ansible</a></li>
        </ul>
        <aside class="notes"> </aside>
        </section>

        <section>
        <h2>What's a provisioning framework?</h2>
        <ul>
          <li>Automated setup of servers</li>
          <li>Configuration as code</li>
        </ul>
        <aside class="notes"> </aside>
        </section>

        <section>
        <h2>Examples</h2>
        <ul>
          <li>Create users</li>
          <li>Generate config files</li>
          <li>Install software</li>
          <li>Start/stop/restart processes</li>
          <li>Set up dependencies between operations</li>
        </ul>
        <aside class="notes"> </aside>
        </section>
<!--        <section>
        <h2>Pros</h2>
        <ul>
          <li class="fragment">In source control.</li>
          <li class="fragment">Less differences between environments.</li>
          <li class="fragment">Self documenting (it's code!).</li>
          <li class="fragment">Refactoring.</li>
          <li class="fragment">Deterministic.</li>
          <li class="fragment">Prevents manual steps.</li>
          <li class="fragment">Fast and easy to configure up a new environment.</li>
          <li class="fragment">Easier to test server setup.</li>
        </ul>
        <aside class="notes"> </aside>
        </section>
        <section>
        <h2>Cons</h2>
        <ul>
          <li class="fragment">Unfamiliar to "old school operators".</li>
          <li class="fragment">Operations is unfamiliar to developers.</li>
          <li class="fragment">Startup cost.
          <ul>
            <li >Training</li>
            <li>Migrating</li>
          </ul>
          </li>
        </ul>
        <aside class="notes"> </aside>
        </section> -->

        <section>
          <h2>Describe what to do</h2>
          <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
#!/bin/bash

if $( command -v vim &gt;/dev/null 2&gt;&amp;1 ); then
  echo "vim is already installed."
else
  apt-get install vim
fi

if $( grep -Fxq "filetype indent off" /etc/vim/vimrc ); then
  echo "set filetype indent off is already in /etc/vim/vimrc."
else
  echo "filetype indent off" &gt;&gt; /etc/vim/vimrc
  # TODO: Do not continue if this fails.
fi

# TODO: Rollback if something fails.
          </code></pre>
        </section>
        <section>
            <h2>Describe state</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
- name: ensure installed vim
  apt: pkg={{ item }} state=installed

- name: add a string to the new file
  lineinfile:
    dest=/etc/vim/vimrc
    line='filetype indent off'
    state=present

          </code></pre>
            <aside class="notes"> </aside>
            </section>
        </section>

            <section>
            <h2>Ansible</h2>
            <ul>
              <li>SSH-based</li>
              <li>Client only (no server)</li>
              <li>YAML configuration</li>
              <li>Push (and pull)</li>
              <li>Supports more than setup and provisioning:</li>
              <ul>
                <li>Application deployment</li>
                <li>Remote command execution</li>
              </ul>
            </ul>
            <aside class="notes"> </aside>
            </section>
            <section>
            <h2>Installation and setup (1 of 2)</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
git clone https://github.com/steinim/responsible-with-ansible.git
git checkout start
            </code></pre> 
            <aside class="notes">
            </aside>
            </section>
            <section>
            <h2>Installation and setup (2 of 2)</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
# Map the ip addresses of the VMs in your /etc/hosts
ansible-playbook -i localhost --ask-sudo-pass localhost.yml
            </code></pre>
            Install: Vagrant, Virtualbox and Ansible
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
vagrant up
            </code></pre>
            <aside class="notes">
            </aside>
            </section>
            <section>
            <h2>Layout</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
├── ansible.cfg<commit_msg>Added pros and cons slides and fixed url to repo<commit_after><!doctype html>
<html lang="en">

  <head>
    <meta charset="utf-8">

    <title>Zero Downtime Deployment with Ansible</title>

    <meta name="description" content="Learn how to provision Linux servers with a web-proxy, a database and automate zero downtime deployment of a Java application to a load balanced environment.">
    <meta name="author" content="<NAME>">

    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="../css/reveal.min.css">
    <!-- BEKK Theme -->
    <link rel="stylesheet" href="../css/theme/bekk.css" id="theme">
    <!-- <link rel="stylesheet" href="../css/theme/default.css" id="theme"> -->

    <!-- For syntax highlighting -->
    <link rel="stylesheet" href="../lib/css/zenburn.css">

    <!-- BEKK Theme -->
    <link rel="stylesheet" href="../css/theme/bekk.css" id="theme">

    <!-- If the query includes 'print-pdf', use the PDF print sheet -->
    <script>
      document.write( '<link rel="stylesheet" href="../css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
    </script>

    <!--[if lt IE 9]>
    <script src="lib/js/html5shiv.js"></script>
    <![endif]-->
  </head>

  <body>


    <div class="reveal">

      <div class="slides">

        <section>
        <h2>Zero Downtime Deployment with Ansible</h2>
        </section>

        <section>
        <h2>Slides & Repo</h2>
        <ul>
          <li><a href="http://steinim.github.io/slides/zero-downtime-ansible">http://steinim.github.io/slides/zero-downtime-ansible</a></li>
          <li><a href="https://github.com/steinim/zero-downtime-ansible">https://github.com/steinim/zero-downtime-ansible</a></li>
        </ul>
        <aside class="notes"> </aside>
        </section>

        <section>
        <h2>What's a provisioning framework?</h2>
        <ul>
          <li>Automated setup of servers</li>
          <li>Configuration as code</li>
        </ul>
        <aside class="notes"> </aside>
        </section>

        <section>
        <h2>Examples</h2>
        <ul>
          <li>Create users</li>
          <li>Generate config files</li>
          <li>Install software</li>
          <li>Start/stop/restart processes</li>
          <li>Set up dependencies between operations</li>
        </ul>
        <aside class="notes"> </aside>
        </section>
        <section>
        <h2>Pros</h2>
        <ul>
          <li class="fragment">In source control.</li>
          <li class="fragment">Less differences between environments.</li>
          <li class="fragment">Self documenting (it's code!).</li>
          <li class="fragment">Refactoring.</li>
          <li class="fragment">Deterministic.</li>
          <li class="fragment">Prevents manual steps.</li>
          <li class="fragment">Fast and easy to configure up a new environment.</li>
          <li class="fragment">Easier to test server setup.</li>
        </ul>
        <aside class="notes"> </aside>
        </section>
        <section>
        <h2>Cons</h2>
        <ul>
          <li class="fragment">Unfamiliar to "old school operators".</li>
          <li class="fragment">Operations is unfamiliar to developers.</li>
          <li class="fragment">Startup cost.
          <ul>
            <li >Training</li>
            <li>Migrating</li>
          </ul>
          </li>
        </ul>
        <aside class="notes"> </aside>
        </section>

        <section>
          <h2>Describe what to do</h2>
          <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
#!/bin/bash

if $( command -v vim &gt;/dev/null 2&gt;&amp;1 ); then
  echo "vim is already installed."
else
  apt-get install vim
fi

if $( grep -Fxq "filetype indent off" /etc/vim/vimrc ); then
  echo "set filetype indent off is already in /etc/vim/vimrc."
else
  echo "filetype indent off" &gt;&gt; /etc/vim/vimrc
  # TODO: Do not continue if this fails.
fi

# TODO: Rollback if something fails.
          </code></pre>
        </section>
        <section>
            <h2>Describe state</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
- name: ensure installed vim
  apt: pkg={{ item }} state=installed

- name: add a string to the new file
  lineinfile:
    dest=/etc/vim/vimrc
    line='filetype indent off'
    state=present

          </code></pre>
            <aside class="notes"> </aside>
            </section>
        </section>

            <section>
            <h2>Ansible</h2>
            <ul>
              <li>SSH-based</li>
              <li>Client only (no server)</li>
              <li>YAML configuration</li>
              <li>Push (and pull)</li>
              <li>Supports more than setup and provisioning:</li>
              <ul>
                <li>Application deployment</li>
                <li>Remote command execution</li>
              </ul>
            </ul>
            <aside class="notes"> </aside>
            </section>
            <section>
            <h2>Installation and setup (1 of 2)</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
git clone https://github.com/steinim/zero-downtime-ansible.git
git checkout start
            </code></pre> 
            <aside class="notes">
            </aside>
            </section>
            <section>
            <h2>Installation and setup (2 of 2)</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
# Map the ip addresses of the VMs in your /etc/hosts
ansible-playbook -i localhost --ask-sudo-pass localhost.yml
            </code></pre>
            Install: Vagrant, Virtualbox and Ansible
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
vagrant up
            </code></pre>
            <aside class="notes">
            </aside>
            </section>
            <section>
            <h2>Layout</h2>
            <pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
├── ansible.cfg
{'fraction_non_alphanumeric': 0.15984513274336284, 'fraction_numerical': 0.009639696586599241, 'mean_word_length': 2.1121219572166217, 'pattern_counts': {'":': 0, '<': 402, '<?xml version=': 0, '>': 402, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '225270', 'n_tokens_mistral': 4088, 'n_tokens_neox': 3834, 'n_words': 954}