Computing UNIX Nerd (started in 1986 with SunOS 3) Linux Geek (started in 1992 with 0.96α) Scripting Nerd Configuration Management addict Free and Open Source Software enthusiast HAM Operator (pa1ton) Programming Plain text aficionado Big fan of things that just work Ansible user and contributor since 2012 · · · ans-v1.9-3
Puppet 2005 ⇒ Widely used, master / slave Chef 2009 ⇒ Puppet lookalike, configured with Ruby Salt Stack 2011 ⇒ master / slave Ansible 2012 ⇒ Easy to use, configured through yaml Propellor 2014 ⇒ master / slave, configured with Haskell Capistrano 2006 ⇒ Scripting in Ruby Paver 2007 ⇒ Fabric alternative for Python 3 Fabric 2008 ⇒ Python Library for CM (Only Python 2) Invoke 2012 ⇒ Python 3 successor of Fabric Juju 2011 ⇒ Ubuntu, designed for the cloud · · · Invoke seems to be the successor of Fabric, but is still in beta. They do have the same author ans-v1.9-5
master No more agents on the nodes No databases No separate PKI Uses standard SSH functionality Very, very powerful Configuration, deployment, ad-hoc, continuous delivery Simple configuration files (yaml) Idempotent ⇒ f(x) = f(f(x)) No convergence ans-v1.9-7
+ Paramiko, PyYAML, Jinja2 on master Python 2.4 + simplejson on nodes Can run in Python virtualenv Can run from git checkout Uses SSH for transport and login No root needed, can use sudo, pbrun, pfexec, etc. ans-v1.9-8
command ansible-playbook ⇒ Command to run playbooks ansible-pull ⇒ The main Ansible pull command ansible-doc ⇒ Ansible documentation program ansible-galaxy ⇒ Command to interact with Galaxy ansible-vault ⇒ The Ansible password vault ansible-console ⇒ The Ansible interactive console ans-v1.9-9
# pip install ansible On CentOS / RHEL / Scientific Linux Enable the EPEL repository # yum install ansible On Debian / Ubuntu Available in standard repository # apt-get install ansible From github (Bleeding edge) Install and configure git $ git clone http://github.com/ansible/ansible.git $ cd ansible $ sudo make install ans-v1.9-11
server master1.example.net 192.168.56.101/24 web1.example.net 192.168.56.102/24 db1.example.net 192.168.56.103/24 win1.example.net 192.168.56.110/24 DNS server dns1.example.net 192.168.56.105/24 Web server web2.example.net 192.168.56.104/24 ans-v1.9-13
ansible_user=ford dns2 ansible_port=5505 ansible_user=arthur [webservers] web[1:9] ansible_port=7856 ansible_user=zaphod [dbservers] db1 db_port=3501 default_db=vogon_poetry [windows] win1 ansible_host=192.168.100.110 ansible_connection, ansible_user, ansible_host and ansible_port are predefined variables used as connection parameters which override the defaults as specified in ansible.cfg. ans-v1.9-14
False ansible_port: 5986 ansible_module_lang: cp1252 ansible_connection: winrm ansible_winrm_server_cert_validation: ignore As you can imagine, these settings should be placed in the Ansible Vault. # klist -l Principal name Cache name -------------- ---------- [email protected] KEYRING:persistent:0:0 ans-v1.9-15
Comments Conditionals Filters Ansible facts are available Puppet Facter facts are available (if installed) Chefs Ohai facts are available (if installed) ans-v1.9-25
of organizing things Can easily be shared with others (Through Galaxy) Ansible role directory structuur thisrole.............................................................Top of the role files..................................................................Role files handlers..........................................................Role handlers main.yml.............................................Role handlers start tasks..................................................................Role tasks main.yml.............................................Role starting point templates........................................................Role templates vars..............................................................Role variables main.yml............................................Role variables start ans-v1.9-28
become for root commands Configure authorized_keys for connections Run ansible script every hour Log playbook runs to /var/log/ansible.log Use Ansible callbacks to give feedback Use roles as much as possible Make roles generic Define variables for site configuration ans-v1.9-30
#ansibleu Meetups: http://meetup.com/Ansible-Benelux Twitter: @ansible and @AnsibleBenelux Reddit: http://www.reddit.com/r/ansible Google Group: https://groups.google.com Twice a month DevOps newsletter: https://valdhaus.co Checkout and study the source from Github ans-v1.9-31