Ansible

Presenter Notes

Whoami

  • Haïkel Guémar (@hguemar)
  • Senior Software Engineer (marque blanche)
  • Développeur Fedora depuis 2006
  • Membre de l'APRIL, Openstack FR etc.
  • Trolleur patenté

Presenter Notes

Ansible: supra-luminic IT automation

Presenter Notes

Différents Niveaux de la gestion de configurations

  • shell distant: ssh, pssh, func
  • Orchestration: Fabric, Capistrano
  • gestion de configuration: CFEngine, Puppet, Chef

Presenter Notes

Installer Ansible

# yum install ansible
# apt-get install ansible
# pip install ansible

Très peu de dépendances:

  • contrôleur: python, paramiko, PyYAML, jinja2, httplib2
  • minions: python 2.5+

Presenter Notes

concepts

Presenter Notes

Inventaire d'hôtes

# /etc/ansible/hosts
ldap.example.com
[webapps]
web[0:8].example.com
[database]
db-[a:c].example.com ansible_ssh_user=postgres
[prod]
web
database

Presenter Notes

modules

  • gestion de paquets (apt, yum, pkgin, pacman, macports)
  • cloud (AWS, openstack, GCE)
  • base de données (mysql, postgresql, mongodb)
  • serveurs (apache, nagios, rabbitmq)
  • virtualisation (kvm, xen, docker, vagrant)
  • système: utilisateurs, groupes, fichiers, quotas, cron etc.
  • les votres !

Presenter Notes

modules en action

$ ansible all -m ping
$ ansible prod -m yum -a name=\* state=latest
$ ansible !db -m yum -a name=\* state=latest

Presenter Notes

Pas d'agent !

Presenter Notes

Une exception: mode accéléré

# requiert python 2.5+, python-keyczar
- hosts: web
  accelerate: true
  # accelerate_port: 5099

Presenter Notes

Playbook

Presenter Notes

Playbook

- name: check/create webservers
  hosts: webservers
  user: root

  tasks:
  - name: install httpd
    action: yum state=installed name=$item
    with_items: 
    - httpd
    - mod_wsgi
    - postgresql-server
  - name:
    service: name=httpd enabled=yes state=started

Presenter Notes

Playbook

$ ansible-playbook check.yml

Presenter Notes

Playbook

  • variables
  • templates
  • roles
  • handlers
  • includes
  • ansible-pull

Presenter Notes

Récapitulatif

Presenter Notes

Architecture

Presenter Notes

Donc ...

  • installer Ansible
  • créer son inventaire
  • installer l'agent // IT'S A TRAP !
  • automatiser

Presenter Notes

Cloud Ready !

Presenter Notes

Plus d'infos

docs.ansible.com

galaxy.ansible.com

Presenter Notes

One More thing: Ansible RDO playbooks

https://github.com/ansible/ansible-redhat-openstack

$ ansible-playbook -i hosts site.yml
$ ansible-playbook -i hosts playbooks/image.yml -e "image_name=cirros image_url=https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"

Presenter Notes

I did it again !

CentOS dojo à Lyon le 11 avril @Epitech

centos

Plus d'informations sur le wiki CentOS: http://wiki.centos.org/Events/Dojo/Lyon2014

Presenter Notes

Q/A

Presenter Notes