RocPy, November 17th, 2015
Slides available at http://threebean.org/presentations/ansible/

From wikipedia:
> An ansible is a fictional machine capable of instantaneous or superluminal > communication. It can send and receive messages to and from a corresponding > device over any distance whatsoever with no delay. Ansibles occur as plot > devices in science fiction literature.
But, as @moondoggy pointed out in #rit-foss:
> There is no way to build an ansible based on current technology. The theory > of special relativity (and equally well the theory of general relativity) > predicts that some proposed methods of creating such devices would cause > communication from the future to the past -- a form of time travel which in > general raises problems of causality (but not that it couldn't be overcome > based on other methods).
So what gives, threebean?
From a different wikipedia page:
> Ansible is a free software platform for configuring and managing computers. It > combines multi-node software deployment, ad hoc task execution, and > configuration management. It manages nodes over SSH or PowerShell and requires > Python (2.4 or later) to be installed on them. Modules work over JSON and > standard output and can be written in any programming language. The system uses > YAML to express reusable descriptions of systems.

puppet | ansible | |
|---|---|---|
category | config management | orchestration |
infra | puppetmaster | none required |
direction | pull | push |
crypto | own PKI | ssh keys |
written in | ruby | python |
language | ruby dsl | yaml |
templates | ERB | jinja2 |
config | declarative | imperative |
resources | dependency graph model | deps only at the role level |
extension | ruby | any language |
$ ansible all -m ping $ ansible all -m ping -u bruce -b --become-user batman
$ ansible db-servers -a "systemctl stop postgres" --limit staging $ ansible websites -a "poweroff" --limit staging $ ansible bastion -a "wall staging is offline"
$ ansible-playbook ./master.yml $ ansible-playbook ./playbooks/reboot.yml --limit db-servers $ ansible-playbook ./playbooks/update_dns.yml $ ansible-playbook ./playbooks/dangerzone/death_to_postfix.yml -e "target=all"
import ansible.runner # Use the 'virt' module on all hosts in the 'virt-hosts' group. kwargs = dict( pattern='virt-hosts', module_name='virt', module_args='command=nodeinfo', ) runner = ansible.runner.Runner(**kwargs) result = runner.run() for name, host in result['contacted'].items(): print name, "has", host['cpus'], 'cpus.' print name, "has", host['physmemory'], 'physical memory.'
- hosts: all gather_facts: yes serial: "50%" tasks: - name: Update Shellshock (Debian) apt: name=bash state=latest update_cache=yes when: ansible_os_family == "Debian" - name: Update Shellshock (RedHat) yum: name=bash state=latest update_cache=yes when: ansible_os_family == "RedHat"
- hosts: all gather_facts: yes serial: "25%" tasks: - name: Update OpenSSL and OpenSSH (Debian) apt: name={{ item }} state=latest update_cache=yes with_items: - openssl - openssh-client - openssh-server when: ansible_os_family == "Debian" notify: reboot the host - name: Update OpenSSL and OpenSSH (RedHat) yum: name={{ item }} state=latest update_cache=yes with_items: - openssl - openssh-client - openssh-server when: ansible_os_family == "RedHat" notify: reboot the host
Take a look at my lightsaber repo.
Take a look at our ansible repo:
Some links:
Slides available at http://threebean.org/presentations/ansible/

| Space | Forward |
|---|---|
| Left, Down, Page Down | Next slide |
| Right, Up, Page Up | Previous slide |
| P | Open presenter console |
| H | Toggle this help |