About me
• Engineer
• Chief Software Engineer at Swivl
• Symfony Camp UA
Igor Brovchenko
[email protected]
@tigordev
Slide 3
Slide 3 text
What is Ansible?
• Ansible is an IT automation tool (Python)
• Free, open source (github)
• Simply
• Clear (anyone)
• Fast (to learn, setup)
• Complete (modules)
• Efficient (runs on OpenSSH)
• Secure (without agents)
Slide 4
Slide 4 text
Use cases
• Server provisioning
• Server orchestration
• Application deployment
• Continues Integration
• …
Slide 5
Slide 5 text
Who uses Ansible?
Over 1 Million Downloads
Over 900 contributors
and 8000 ★s on GitHub
Slide 6
Slide 6 text
Other tools
• fabric
• capistrano (capifony)
• puppet
• chef
• saltstack
Slide 7
Slide 7 text
Ansible 1.7.2
• Development - 1.8
• A new major release of Ansible
approximately every 2 months.
Slide 8
Slide 8 text
Control Machine Requirements
• Red Hat
• Debian
• CentOS
• OS X
• any of the BSDs
• Windows isn’t supported for the control
machine
• Ansible 1.8: Windows will be fully supported
Python 2.6
Slide 9
Slide 9 text
Managed Node Requirements
• Python 2.4
• Starting in version 1.7, Ansible contains support
for managing Windows machines
Slide 10
Slide 10 text
https://galaxy.ansible.com/
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
http://www.ansible.com/tower
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
Symfony Deployment
1. Update the code
2. Update vendor dependencies
3. Running database migrations
4. Update Assetic Assets
5. Clearing the cache
6. Other Things…
Cron module
# Ensure a job that runs at 2 and 5 exists.
# Creates an entry like "* 5,2 * * ls -alh > /dev/null"
- cron: name="check dirs" hour="5,2" job="ls -alh > /dev/null"
# Ensure an old job is no longer present. Removes any job that is prefixed
# by "#Ansible: an old job" from the crontab
- cron: name="an old job" state=absent
# Creates an entry like "@reboot /some/job.sh"
- cron: name="a job for reboot" special_time=reboot job="/some/job.sh"
# Creates a cron file under /etc/cron.d
- cron: name="yum autoupdate" weekday="2" minute=0 hour=12
user="root" job="YUMINTERACTIVE=0 /usr/sbin/yum-autoupdate"
cron_file=ansible_yum-autoupdate
# Removes a cron file from under /etc/cron.d
Templates
• Templates are processed by the Jinja2 templating
language (http://jinja.pocoo.org/docs/dev/templates/)
• Powerful conditionals
• Loops and iterators