This is a talk about ways Ansible could be extended through dynamic inventory, plugins, modules or API. There was a discussion during meetup and ideas generated are added to the presentation.
1. Extending Ansible
When you want some more of your favorite tool
Ansible Benelux meetup, 11-02-2016
Amsterdam, Sentia
Pavel Chunyayev
2. @PavelChunyayev
Amsterdam
Levi9 HQ
Amsterdam – 2005
25 people
Novi Sad
Serbia
Novi Sad – 2005
320+ people
Zrenjanin
Serbia
Zrenjanin– 2014
30+ people
Iasi
Romania
Iasi – 2007
80+ people
Kiev
Ukraine
Kiev – 2008
130+ people
5. @PavelChunyayev
About me
• 12 years of IT experience
• Lived and worked in Ukraine and Estonia
• Moved a year and half ago to the Netherlands
• Learning Dutch
• Love cycling
• De Hollandse 100 - https://www.dehollandse100.nl/actie/pavel-chunyayev
• Alpe d’HuZes - http://deelnemers.opgevenisgeenoptie.nl/levi9
6. Continuous Delivery
* I had to talk about Continuous Delivery shortly.
I’m Continuous Delivery Architect after all.
10. @PavelChunyayev
It’s not only about speed
• Right process to support continuous feature delivery,
improvements and learning.
• Proper testing to be able to deliver at high speed.
15. @PavelChunyayev
Plenty of information on the internet
• Most covers Ansible pre 2.0, but perfect to start with
• http://slides.com/alejandroguiraorodriguez/ee-ansible-with-python
• http://tylerturk.com/extending-ansible/
• http://www.slideshare.net/YanKurniawan1/extending-ansible
• http://www.llabs.io/ansible-action-plugins
• http://docs.ansible.com/ansible/developing.html
18. @PavelChunyayev
Dynamic inventory
• http://docs.ansible.com/ansible/developing_inventory.html
• http://docs.ansible.com/ansible/intro_dynamic_inventory.html
• Just a script that returns JSON dictionary of all the groups
• Numerous dynamic inventory scripts:
https://github.com/ansible/ansible/tree/devel/contrib/inventory
• AWS, Azure, GCE, Digital Ocean, Docker, Openstack, Jails, Zabbix
• VMware, Virtualbox, Nagios, oVirt, Consul, etc.
23. @PavelChunyayev
Callback plugins
• React on certain events during
Ansible execution
• Some existing:
• OS X say
• HipChat
• Mail
• Syslog JSON
• Timer
• More?
• Send logs to ELK
• Send metrics to Grafana
• Leave audit trails
• Slack
• IRC
24. @PavelChunyayev
Ideas for callback plugins generated during
meetup
• Tags (assign tags based on execution)
• Backup (additional step before changing something)
• Change output
• Nagios (or general notification to monitoring systems)
25. @PavelChunyayev
Connection plugins
• More ways to connect to remote
systems
• Some existing:
• Docker
• chroot
• WinRM
• Jail
• LXC
• More?
• Someone using anything besides
SSH? :)
• SNMP
• SSH gateway
• Multifactor authentication
26. @PavelChunyayev
Filter plugins
• Jinja2 filters to use
• Some existing:
• Various sets manipulations (math)
• IP addresses manipulations
• String manipulations
• to / from JSON
• More?
• Test is the string is a valid
running AWS EC2 instance
• Convert AWS instance id into
instance name (IP, DNS name,
etc)
31. @PavelChunyayev
Ideas for strategy plugins generated during
meetup
• One host, one task at a time
• Scoring (calculate the sequence based on the score)
34. @PavelChunyayev
Modules?
• Deploying your applications
• Configuring running applications
• Maven (manage artifacts)
• Usage of less popular applications
• LDAP manipulation / credentials checking
• All those AWS services that are not yet covered by modules
• Custom backup
• Pipelines as code
36. @PavelChunyayev
Execute Ansible programmatically
• Trigger Ansible run or Ansible-playbook from your application!
• React to some events with running Ansible playbook
• Get facts about infrastructure directly from an application
• Your own Infrastructure as a Service
38. @PavelChunyayev
Takeaways
• Ansible is a perfect tool
• Easily extendable when needed
• Don’t be afraid to extend Ansible
• Don’t forget to return code to community
• Participate in Ansible Coder’s Dojo
pavel@levi9.com
Any questions?