DevOps Automation with Ansible

Dorian Puła

Software Development Engineer @ Points

@dorianpula

Who Am I?

What is Ansible?

"Ansible automates app deployment, configuration management, workflow orchestration and even cloud provisioning..."

Why Use Ansible?

Getting Started

Installing Ansible

Control Machine requirements:

pip install ansible

Recommend going with >= 1.6

Managed Node requirements:

Running Ansible

server_inventory

[build_agents]
build-[1:20].firm.ca  ansible_connection=ssh  ansible_ssh_user=admin
admin@sys$ ansible all \
            -i build_agents \
            -m pip \
            -a 'name=couchdb extra_args="--no-install --no-download"'

Ansible Modules

Database

File

Ansible Modules

Cloud

Web

Playbooks

Playbook Structure

servers.yaml

- hosts: all
  vars:
    user: "{{ ansible_env.SUDO_USER }}"
  tasks:
  - name: Install nginx
    apt: pkg=nginx-full state=present
  - name: Configure nginx
    copy: src=files/webservers/{{ item }}
          dest=/etc/nginx/sites-available
    with_items:
        - rookeries-uwsgi.conf
        - dorianpula_wordpress.conf
  - name: Add user to www-data
    user: name={{ user }} append=yes groups=www-data

Running Playbooks

ansible-playbook -i all \
                --user=admin --sudo --ask-pass \
                --ask-sudo-pass servers.yaml

More About Ansible

Thank You!