ANSIBLE
Configuration management tool
and ad-hoc solution
INTRODUCTION
• Simple automation tool
• Lightweight automation tool
• Execute one-time tasks
• Perform system administration tasks
• Configure servers and routers
• Gather information about devices
INTRODUCTION
• Written in Python
- easy to read and extend
• Open source
- source code on GitHub
• Easy to install and run
- get started in just a few minutes
INSTALL AND CONFIGURATION
• CentOS / Fedora
- enable the EPEL repository
- yum install ansible
• Ubuntu / Debian
- apt-add-repository ppa:ansible/ansible
- apt-get install ansible
• Any operating system
- create a virtualenv
- pip install ansible
RUNNING ANSIBLE
• How it works
AD-HOC COMMANDS
- Runs a command or call a module directly from
the command line, no Playbook required
ansible <inventory> <options>
ansible web –a /bin/date
ansible db -m ping
ansible web -m yum -a “name=nginx state=latest”
AD-HOC COMMANDS
PLAYBOOKS
• Written in YAML
- human-readable
• Variable definitions
• Handlers
- take action upon changes
• Reusable
- save for the future, share with colleagues, etc
PLAYBOOKS
• How it works
- Playbook contain plays
- Plays contain tasks
- Tasks call module
- Tasks run sequentially
- Handlers are triggered by tasks
and run once, at the end plays
PLAYBOOKS
• Simple playbooks
- host
- var
- task
- module
- templates
- handlers
PLAYBOOKS
• Ansible uses the Jinja template engine
- variable substitution
- conditionals and loops (if, for)
- filters to transform text
• Templates are just text file
- text {{ ... }} undergoes variable substitution
- text {% ... %} marks conditionals and loops
- everything else is passed through
PLAYBOOKS
• Best practice
- group_vars
- host_vars
- inventory
- roles
- task
- handlers
- templates
- README
VARIABLES
• Facts
- running OS
• Registered variables
- Values from earlier tasks
• Host declaration
- Inventory file
- host_vars & group_vars
VARIABLES
VARIABLES
• Registered variables
VARIABLES
ANSIBLE-GALAXY
• Library for roles
- https://galaxy.ansible.com/list#/roles
- More than 11.000 roles
- Not always easy to find the best role!
ansible-galaxy install author.role
ANSIBLE OVIRT MODULES
ovirt_auth (E) - Manage authentication
ovirt_disks (E) - Manage VM and floating disks
ovirt_host_networks (E) - Manage host networks
ovirt_host_pm (E) - Manage power management
ovirt_hosts (E) - Manage hosts in oVirt
ovirt_hosts_facts (E) - Retrieve facts about one or
more oVirt hosts
ovirt_vms (E) - Module to manage VM
JENKINS
Continuous Integration server.
WHAT IS JENKINS?
• Continuous integration and continuous delivery
• Open source
• Java
• Servlet
• More and more features with plugin
FEATURES
• Easy installation
• Easy configuration
• Rich plugin ecosystem
• Extensibility
• Distributed builds
JENKINS and ANSIBLE
JENKINS and ANSIBLE

Jenkins and ansible reference