SlideShare a Scribd company logo
AutomationwithAnsibleandContainers
PyCon SK
11 March 2017
Rodolfo Carvalho
Software Engineer, Red Hat
What is Ansible
Automation language
Automation engine
&
Simple: install, con gure, understand
Agentless, uses SSH*
Extensible
Open Source
Written in Python!
Great community -- 2,588 contributors
What can we do with Ansible
Con guration Management
Application Deployments
Provisioning
Orchestration
Continuous Delivery
My story with Ansible
openshift-ansible
Ansible from a programmer's perspective
Learning curve
Beyond the basics
The basics
Inventory
Task
Play
Playbook
The basics
An inventory typically lists remote hosts, either bare metal or VMs.
Testing is hard, make it less painful.
Ansible ♥ Containers!
Inventory
[masters]
master-container
[nodes]
node-container-1
node-container-2
[etcd]
[lb]
[nfs]
[OSEv3:children]
masters
nodes
etcd
lb
nfs
[OSEv3:vars]
deployment_type=origin
ansible_connection=docker
Playbooks
YAML les describing desired state
---
- name: Launch containers
hosts: localhost
connection: local
become: no
gather_facts: no
tasks:
- name: Ensure containers are running
docker_container:
name: "{{item}}"
image: centos:7
command: sleep infinity
state: started
with_items:
- master-container
- node-container-1
- node-container-2
Running the playbook
$ ansible-playbook -i hosts playbooks/start-containers.yml
PLAY [Launch containers] *******************************************************
TASK [Ensure containers are running] *******************************************
changed: [localhost] => (item=master-container)
changed: [localhost] => (item=node-container-1)
changed: [localhost] => (item=node-container-2)
PLAY RECAP *********************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0
Removing containers
---
- name: Cleanup containers
hosts: localhost
connection: local
become: no
gather_facts: no
tasks:
- name: Ensure containers are removed
docker_container:
name: "{{item}}"
state: absent
with_items:
- master-container
- node-container-1
- node-container-2
Removing containers
$ ansible-playbook -i hosts playbooks/remove-containers.yml
PLAY [Cleanup containers] ******************************************************
TASK [Ensure containers are removed] *******************************************
changed: [localhost] => (item=master-container)
changed: [localhost] => (item=node-container-1)
changed: [localhost] => (item=node-container-2)
PLAY RECAP *********************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0
More concepts
Modules
Roles
Ansible Galaxy
Ansible ships with more than 700 modules.
Roles is a standard way to organize playbooks.
Galaxy is a free site for nding, downloading, and sharing community developed roles.
Ansible Modules ♥ Python!
# ansible/modules/core/system/ping.py
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec=dict(
data=dict(required=False, default=None),
),
supports_check_mode=True
)
result = dict(ping='pong')
if module.params['data']:
if module.params['data'] == 'crash':
raise Exception("boom")
result['ping'] = module.params['data']
module.exit_json(**result)
if __name__ == '__main__':
main()
Modules
Modules are copied to the target hosts, then executed in the targets.
$ ansible -i hosts all -m ping -a data=pyconsk
master-container | SUCCESS => {
"changed": false,
"ping": "pyconsk"
}
node-container-1 | SUCCESS => {
"changed": false,
"ping": "pyconsk"
}
node-container-2 | SUCCESS => {
"changed": false,
"ping": "pyconsk"
}
$ ansible -i hosts masters -m command -a 'rm -rf /'
master-container | FAILED | rc=1 >>
rm: it is dangerous to operate recursively on '/'
rm: use --no-preserve-root to override this failsafe
To in nity… and beyond!
Plugins
www.ansible.com/blog/how-to-extend-ansible-through-plugins
Action
Callback
Connection
Others...
Action Plugins
# ansible/plugins/action/fail.py
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
''' Fail with custom message '''
TRANSFERS_FILES = False
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
msg = 'Failed as requested from task'
if self._task.args and 'msg' in self._task.args:
msg = self._task.args.get('msg')
result['failed'] = True
result['msg'] = msg
return result
Action Plugins
Run on the control machine, giving great control over how to run modules.
$ ansible -i hosts nodes -m fail
node-container-1 | FAILED! => {
"changed": false,
"failed": true,
"msg": "Failed as requested from task"
}
node-container-2 | FAILED! => {
"changed": false,
"failed": true,
"msg": "Failed as requested from task"
}
Callback Plugins
# ansible/plugins/callback/timer.py
from datetime import datetime
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
"""This callback module tells you how long your plays ran for."""
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'aggregate'
CALLBACK_NAME = 'timer'
CALLBACK_NEEDS_WHITELIST = True
def __init__(self):
super(CallbackModule, self).__init__()
self.start_time = datetime.now()
def v2_playbook_on_stats(self, stats):
end_time = datetime.now()
runtime = end_time - self.start_time
self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % 
(self.days_hours_minutes_seconds(runtime)))
Callback Plugins
React to events which occur during the execution of playbooks.
Use it to customize output.
$ ANSIBLE_CALLBACK_WHITELIST=timer ansible-playbook -i hosts playbooks/start-containers.yml
PLAY [Launch containers] *******************************************************
TASK [Ensure containers are running] *******************************************
ok: [localhost] => (item=master-container)
ok: [localhost] => (item=node-container-1)
ok: [localhost] => (item=node-container-2)
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Conclusion
It's 2017, go learn Ansible!
Automate
Programming the infrastructure
Testing is hard, but don't give up
Python is a fundamental tool in your toolbox
Red Hat Czech
Brno - the biggest engineering hub globally
1100 employees (including 85 interns) in 3 buildings
Software Development, QE, Technical Writing, Technical Support, BI
Small engineering o ce in Prague
We're hiring!
Python is one of the most used programming language
Open positions in RHEL Platform Team, QE, Release Engineering, Containers, DevOps
(both Development and SysAdmin), OpenStack
Thank you
Rodolfo Carvalho
Software Engineer, Red Hat
rhcarvalho@redhat.com
http://rodolfocarvalho.net

More Related Content

What's hot

Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
Lorin Hochstein
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Keith Resar
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
John Lynch
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
Paolo Tonin
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
Kumar Y
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginners
Kuo-Le Mei
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
Suresh Kumar
 
Docker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihanDocker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihanjbminn
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
Rayed Alrashed
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
Ahmed AbouZaid
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
Tim Fairweather
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
Richard Donkin
 
Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)
Ivan Rossi
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
Dan Vaida
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
Henry Stamerjohann
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
Łukasz Proszek
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
David Lapsley
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
Bas Meijer
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
CoreStack
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
Bas Meijer
 

What's hot (20)

Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginners
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Docker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihanDocker ansible-make-chef-puppet-unnecessary-minnihan
Docker ansible-make-chef-puppet-unnecessary-minnihan
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
 

Viewers also liked

Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
Richard Donkin
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
Greg DeKoenigsberg
 
How OpenShift SDN helps to automate
How OpenShift SDN helps to automateHow OpenShift SDN helps to automate
How OpenShift SDN helps to automate
Ilkka Tengvall
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
Омские ИТ-субботники
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
bcoca
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
Robert Reiz
 
OpenShift on OpenStack with Kuryr
OpenShift on OpenStack with KuryrOpenShift on OpenStack with Kuryr
OpenShift on OpenStack with Kuryr
Antoni Segura Puimedon
 
Simplifying and Securing your OpenShift Network with Project Calico
Simplifying and Securing your OpenShift Network with Project CalicoSimplifying and Securing your OpenShift Network with Project Calico
Simplifying and Securing your OpenShift Network with Project Calico
Andrew Randall
 
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Red Hat Developers
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
laonap166
 
OpenShift v3 Internal networking details
OpenShift v3 Internal networking detailsOpenShift v3 Internal networking details
OpenShift v3 Internal networking details
Etsuji Nakai
 
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesExtending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
Nicola Ferraro
 
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
nine
 
Deploying Microservices as Containers
Deploying Microservices as ContainersDeploying Microservices as Containers
Deploying Microservices as Containers
Veer Muchandi
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
bcoca
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
Chu-Siang Lai
 
Cfgmgmtcamp 2017 docker is the new tarball
Cfgmgmtcamp 2017  docker is the new tarballCfgmgmtcamp 2017  docker is the new tarball
Cfgmgmtcamp 2017 docker is the new tarball
OlinData
 

Viewers also liked (20)

Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 
How OpenShift SDN helps to automate
How OpenShift SDN helps to automateHow OpenShift SDN helps to automate
How OpenShift SDN helps to automate
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
OpenShift on OpenStack with Kuryr
OpenShift on OpenStack with KuryrOpenShift on OpenStack with Kuryr
OpenShift on OpenStack with Kuryr
 
Simplifying and Securing your OpenShift Network with Project Calico
Simplifying and Securing your OpenShift Network with Project CalicoSimplifying and Securing your OpenShift Network with Project Calico
Simplifying and Securing your OpenShift Network with Project Calico
 
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
Developing In Python On Red Hat Platforms (Nick Coghlan & Graham Dumpleton)
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
OpenShift v3 Internal networking details
OpenShift v3 Internal networking detailsOpenShift v3 Internal networking details
OpenShift v3 Internal networking details
 
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesExtending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
 
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
TechTalkThursday 02.03.2017: Container-Orchestrierung mit OpenShift - Unser W...
 
Deploying Microservices as Containers
Deploying Microservices as ContainersDeploying Microservices as Containers
Deploying Microservices as Containers
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
 
Cfgmgmtcamp 2017 docker is the new tarball
Cfgmgmtcamp 2017  docker is the new tarballCfgmgmtcamp 2017  docker is the new tarball
Cfgmgmtcamp 2017 docker is the new tarball
 

Similar to Automation with Ansible and Containers

Celery with python
Celery with pythonCelery with python
Celery with python
Alexandre González Rodríguez
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
Achieve Internet
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
Ideato
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
Rainer Schuettengruber
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
Ansible Automation Inside Cloudforms ( Embedded Ansible)
Ansible Automation Inside Cloudforms ( Embedded Ansible)Ansible Automation Inside Cloudforms ( Embedded Ansible)
Ansible Automation Inside Cloudforms ( Embedded Ansible)
Prasad Mukhedkar
 
Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)
Martin Schütte
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
Chris Cowan
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
Mehmet Ali Aydın
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
NigussMehari4
 
Unsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at ScaleUnsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at Scale
Aaron (Ari) Bornstein
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
DonghuKIM2
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
Haci Murat Yaman
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
MyNOG
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
Sam Marley-Jarrett
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
Celery
CeleryCelery

Similar to Automation with Ansible and Containers (20)

Celery with python
Celery with pythonCelery with python
Celery with python
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Ansible inside
Ansible insideAnsible inside
Ansible inside
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Ansible Automation Inside Cloudforms ( Embedded Ansible)
Ansible Automation Inside Cloudforms ( Embedded Ansible)Ansible Automation Inside Cloudforms ( Embedded Ansible)
Ansible Automation Inside Cloudforms ( Embedded Ansible)
 
Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Unsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at ScaleUnsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at Scale
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Celery
CeleryCelery
Celery
 

More from Rodolfo Carvalho

Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
Rodolfo Carvalho
 
OpenShift Overview - Red Hat Open School 2017
OpenShift Overview - Red Hat Open School 2017OpenShift Overview - Red Hat Open School 2017
OpenShift Overview - Red Hat Open School 2017
Rodolfo Carvalho
 
OpenShift Overview - Red Hat Open House 2017
OpenShift Overview - Red Hat Open House 2017OpenShift Overview - Red Hat Open House 2017
OpenShift Overview - Red Hat Open House 2017
Rodolfo Carvalho
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
Rodolfo Carvalho
 
A Tour of Go - Workshop
A Tour of Go - WorkshopA Tour of Go - Workshop
A Tour of Go - Workshop
Rodolfo Carvalho
 
The Go features I can't live without, 2nd round
The Go features I can't live without, 2nd roundThe Go features I can't live without, 2nd round
The Go features I can't live without, 2nd round
Rodolfo Carvalho
 
The Go features I can't live without
The Go features I can't live withoutThe Go features I can't live without
The Go features I can't live without
Rodolfo Carvalho
 
Building and Deploying containerized Python Apps in the Cloud
Building and Deploying containerized Python Apps in the CloudBuilding and Deploying containerized Python Apps in the Cloud
Building and Deploying containerized Python Apps in the Cloud
Rodolfo Carvalho
 
Python deployments on OpenShift 3
Python deployments on OpenShift 3Python deployments on OpenShift 3
Python deployments on OpenShift 3
Rodolfo Carvalho
 
Composing WSGI apps and spellchecking it all
Composing WSGI apps and spellchecking it allComposing WSGI apps and spellchecking it all
Composing WSGI apps and spellchecking it all
Rodolfo Carvalho
 
Pykonik Coding Dojo
Pykonik Coding DojoPykonik Coding Dojo
Pykonik Coding Dojo
Rodolfo Carvalho
 
Concurrency in Python4k
Concurrency in Python4kConcurrency in Python4k
Concurrency in Python4k
Rodolfo Carvalho
 
Coding Kwoon
Coding KwoonCoding Kwoon
Coding Kwoon
Rodolfo Carvalho
 
Python in 15 minutes
Python in 15 minutesPython in 15 minutes
Python in 15 minutes
Rodolfo Carvalho
 
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
Rodolfo Carvalho
 
Redes livres de escala
Redes livres de escalaRedes livres de escala
Redes livres de escala
Rodolfo Carvalho
 
Redes livres de escala
Redes livres de escalaRedes livres de escala
Redes livres de escala
Rodolfo Carvalho
 
XMPP
XMPPXMPP
Content Delivery Networks
Content Delivery NetworksContent Delivery Networks
Content Delivery Networks
Rodolfo Carvalho
 
TDD do seu jeito
TDD do seu jeitoTDD do seu jeito
TDD do seu jeito
Rodolfo Carvalho
 

More from Rodolfo Carvalho (20)

Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
OpenShift Overview - Red Hat Open School 2017
OpenShift Overview - Red Hat Open School 2017OpenShift Overview - Red Hat Open School 2017
OpenShift Overview - Red Hat Open School 2017
 
OpenShift Overview - Red Hat Open House 2017
OpenShift Overview - Red Hat Open House 2017OpenShift Overview - Red Hat Open House 2017
OpenShift Overview - Red Hat Open House 2017
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
A Tour of Go - Workshop
A Tour of Go - WorkshopA Tour of Go - Workshop
A Tour of Go - Workshop
 
The Go features I can't live without, 2nd round
The Go features I can't live without, 2nd roundThe Go features I can't live without, 2nd round
The Go features I can't live without, 2nd round
 
The Go features I can't live without
The Go features I can't live withoutThe Go features I can't live without
The Go features I can't live without
 
Building and Deploying containerized Python Apps in the Cloud
Building and Deploying containerized Python Apps in the CloudBuilding and Deploying containerized Python Apps in the Cloud
Building and Deploying containerized Python Apps in the Cloud
 
Python deployments on OpenShift 3
Python deployments on OpenShift 3Python deployments on OpenShift 3
Python deployments on OpenShift 3
 
Composing WSGI apps and spellchecking it all
Composing WSGI apps and spellchecking it allComposing WSGI apps and spellchecking it all
Composing WSGI apps and spellchecking it all
 
Pykonik Coding Dojo
Pykonik Coding DojoPykonik Coding Dojo
Pykonik Coding Dojo
 
Concurrency in Python4k
Concurrency in Python4kConcurrency in Python4k
Concurrency in Python4k
 
Coding Kwoon
Coding KwoonCoding Kwoon
Coding Kwoon
 
Python in 15 minutes
Python in 15 minutesPython in 15 minutes
Python in 15 minutes
 
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...
 
Redes livres de escala
Redes livres de escalaRedes livres de escala
Redes livres de escala
 
Redes livres de escala
Redes livres de escalaRedes livres de escala
Redes livres de escala
 
XMPP
XMPPXMPP
XMPP
 
Content Delivery Networks
Content Delivery NetworksContent Delivery Networks
Content Delivery Networks
 
TDD do seu jeito
TDD do seu jeitoTDD do seu jeito
TDD do seu jeito
 

Recently uploaded

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 

Recently uploaded (20)

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 

Automation with Ansible and Containers

  • 1. AutomationwithAnsibleandContainers PyCon SK 11 March 2017 Rodolfo Carvalho Software Engineer, Red Hat
  • 2. What is Ansible Automation language Automation engine & Simple: install, con gure, understand Agentless, uses SSH* Extensible Open Source Written in Python! Great community -- 2,588 contributors
  • 3. What can we do with Ansible Con guration Management Application Deployments Provisioning Orchestration Continuous Delivery
  • 4. My story with Ansible openshift-ansible Ansible from a programmer's perspective Learning curve Beyond the basics
  • 6. The basics An inventory typically lists remote hosts, either bare metal or VMs. Testing is hard, make it less painful. Ansible ♥ Containers!
  • 8. Playbooks YAML les describing desired state --- - name: Launch containers hosts: localhost connection: local become: no gather_facts: no tasks: - name: Ensure containers are running docker_container: name: "{{item}}" image: centos:7 command: sleep infinity state: started with_items: - master-container - node-container-1 - node-container-2
  • 9. Running the playbook $ ansible-playbook -i hosts playbooks/start-containers.yml PLAY [Launch containers] ******************************************************* TASK [Ensure containers are running] ******************************************* changed: [localhost] => (item=master-container) changed: [localhost] => (item=node-container-1) changed: [localhost] => (item=node-container-2) PLAY RECAP ********************************************************************* localhost : ok=1 changed=1 unreachable=0 failed=0
  • 10. Removing containers --- - name: Cleanup containers hosts: localhost connection: local become: no gather_facts: no tasks: - name: Ensure containers are removed docker_container: name: "{{item}}" state: absent with_items: - master-container - node-container-1 - node-container-2
  • 11. Removing containers $ ansible-playbook -i hosts playbooks/remove-containers.yml PLAY [Cleanup containers] ****************************************************** TASK [Ensure containers are removed] ******************************************* changed: [localhost] => (item=master-container) changed: [localhost] => (item=node-container-1) changed: [localhost] => (item=node-container-2) PLAY RECAP ********************************************************************* localhost : ok=1 changed=1 unreachable=0 failed=0
  • 12. More concepts Modules Roles Ansible Galaxy Ansible ships with more than 700 modules. Roles is a standard way to organize playbooks. Galaxy is a free site for nding, downloading, and sharing community developed roles.
  • 13. Ansible Modules ♥ Python! # ansible/modules/core/system/ping.py from ansible.module_utils.basic import AnsibleModule def main(): module = AnsibleModule( argument_spec=dict( data=dict(required=False, default=None), ), supports_check_mode=True ) result = dict(ping='pong') if module.params['data']: if module.params['data'] == 'crash': raise Exception("boom") result['ping'] = module.params['data'] module.exit_json(**result) if __name__ == '__main__': main()
  • 14. Modules Modules are copied to the target hosts, then executed in the targets. $ ansible -i hosts all -m ping -a data=pyconsk master-container | SUCCESS => { "changed": false, "ping": "pyconsk" } node-container-1 | SUCCESS => { "changed": false, "ping": "pyconsk" } node-container-2 | SUCCESS => { "changed": false, "ping": "pyconsk" } $ ansible -i hosts masters -m command -a 'rm -rf /' master-container | FAILED | rc=1 >> rm: it is dangerous to operate recursively on '/' rm: use --no-preserve-root to override this failsafe
  • 15. To in nity… and beyond!
  • 17. Action Plugins # ansible/plugins/action/fail.py from ansible.plugins.action import ActionBase class ActionModule(ActionBase): ''' Fail with custom message ''' TRANSFERS_FILES = False def run(self, tmp=None, task_vars=None): if task_vars is None: task_vars = dict() result = super(ActionModule, self).run(tmp, task_vars) msg = 'Failed as requested from task' if self._task.args and 'msg' in self._task.args: msg = self._task.args.get('msg') result['failed'] = True result['msg'] = msg return result
  • 18. Action Plugins Run on the control machine, giving great control over how to run modules. $ ansible -i hosts nodes -m fail node-container-1 | FAILED! => { "changed": false, "failed": true, "msg": "Failed as requested from task" } node-container-2 | FAILED! => { "changed": false, "failed": true, "msg": "Failed as requested from task" }
  • 19. Callback Plugins # ansible/plugins/callback/timer.py from datetime import datetime from ansible.plugins.callback import CallbackBase class CallbackModule(CallbackBase): """This callback module tells you how long your plays ran for.""" CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'aggregate' CALLBACK_NAME = 'timer' CALLBACK_NEEDS_WHITELIST = True def __init__(self): super(CallbackModule, self).__init__() self.start_time = datetime.now() def v2_playbook_on_stats(self, stats): end_time = datetime.now() runtime = end_time - self.start_time self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % (self.days_hours_minutes_seconds(runtime)))
  • 20. Callback Plugins React to events which occur during the execution of playbooks. Use it to customize output. $ ANSIBLE_CALLBACK_WHITELIST=timer ansible-playbook -i hosts playbooks/start-containers.yml PLAY [Launch containers] ******************************************************* TASK [Ensure containers are running] ******************************************* ok: [localhost] => (item=master-container) ok: [localhost] => (item=node-container-1) ok: [localhost] => (item=node-container-2) PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=0 Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
  • 21. Conclusion It's 2017, go learn Ansible! Automate Programming the infrastructure Testing is hard, but don't give up Python is a fundamental tool in your toolbox
  • 22. Red Hat Czech Brno - the biggest engineering hub globally 1100 employees (including 85 interns) in 3 buildings Software Development, QE, Technical Writing, Technical Support, BI Small engineering o ce in Prague We're hiring! Python is one of the most used programming language Open positions in RHEL Platform Team, QE, Release Engineering, Containers, DevOps (both Development and SysAdmin), OpenStack
  • 23. Thank you Rodolfo Carvalho Software Engineer, Red Hat rhcarvalho@redhat.com http://rodolfocarvalho.net