SlideShare a Scribd company logo
1 of 29
Download to read offline
Mike Dahlgren - miked@redhat.com
Tips and Tricks
@KeithResar
Automating F5 Load Balancers
Automating your F5 Local traffic managers using Ansible.
Ready to run your first playbook?
Come and see what F5 Networks has been up to with ansible
playbooks. We will discuss and demo all the cool things you can
automate on your BIG-IP.
...presented on June 21st
@KeithResar
@KeithResar
@KeithResar
Mike Dahlgren - miked@redhat.com
Now for the Tips and Tricks
Running Commands in Parallel
PARALLELISM AND STRATEGIES COMMANDS
Number of forks can easily be defined with -f (default is 5)
$ ansible webservers -a "/sbin/reboot" -f 10
Strategies can be used to control play execution an can be changed
• Lineary strategy = in order execution (Default)
• Free strategy = finish as fast as you can
- hosts: all
strategy: free
tasks:
...
Removing Files & Directories
Removing a file from a server
Easy for one File:
$ ansible webservers -m file -a "dest=/path/to/file
state=absent"
Removing all the files and directory
- name: remove files and directories
file:
state: "{{ item }}"
path: "/srv/deleteme/"
owner: 1000 # set your owner, group, and mode
group: 1000
mode: '0777'
with_items:
- absent
- directory
Overloading the Ansible config
Set Defaults in a custom Ansible configuration file.
• No need to type -i myhosts from the CLI
• Remove the useless .retry files
• Can be used anywhere you run Ansible
Precedence model:
* ANSIBLE_CONFIG (an environment variable)
* ansible.cfg (in the current directory)
* .ansible.cfg (in the home directory)
* /etc/ansible/ansible.cfg
Forking background processes
from the command line
TIME LIMITING BACKGROUND OPERATIONS
Run script in background (30 Min timeout)
$ ansible webserver -B 3600 -P 0 -a "/bin/long_cmd --do-stuff"
Checking on the status of a previous job
$ ansible web1.example.com -m async_status -a "jid=488359678239.2844"
We can set how often to poll the status (60 seconds)
$ ansible webserver -B 1800 -P 60 -a "/bin/long_cmd --do-stuff"
Clean up your debugging tasks
Clean up your debugging tasks
- debug:
msg: "This always displays"
- debug:
msg: "This only displays with
ansible-playbook -vv+"
verbosity: 2
Use smoke tests
Don’t just start services -- use smoke tests
- name: check for proper response
uri:
url: http://localhost/myapp
return_content: yes
register: result
until: '"Hello World" in result.content'
retries: 10
delay: 1
Use Patterns
Use patterns quickly and effectively - Continued
Wildcards work
one*.com:dbservers
So can Regex
~(web|db).*.example.com
But would this work?
www[01:50].example.com, db-[a:f].example.com
Abusing Regex
Moving Drive letters in a Puppet Manifest
vars:
alphabet: "abcdefghijklmnopqrstuvwxyz"
tasks:
- block:
- name: change disk names
replace:
path: /etc/puppet/example/{{ hostname
}}.yaml
regexp: 'sd{{ alphabet[item | int + 1] }}'
replace: 'sd{{ alphabet[item | int] }}'
with_sequence: start=0 end=11
Leveraging Jinja2
Flow Control in Templates
{% for port in jmx_ports %}
<Connection>
ServiceURL "service:jmx:rmi:///jndi/rmi://{{
inventory_hostname }}.example.com:{{ port }}/jmxrmi"
Host "{{ inventory_hostname }}.example.com"
InstancePrefix "port_{{ port }}"
Collect "memory"
Collect "threads"
Collect "classes"
</Connection>
{% endfor %}
TASK [command]
*********************************
[WARNING]: Consider using yum module rather
than running yum
changed: [localhost]
@KeithResar
- hosts: all
tasks:
- command: yum -y install telnet
- yum: name=telnet state=present
- command: yum -y install telnet
args:
warn: False
@KeithResar
What is your favorite Trick?

More Related Content

What's hot

Scaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approachScaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approachJinal Jhaveri
 
Scheduling torque-maui-tutorial
Scheduling torque-maui-tutorialScheduling torque-maui-tutorial
Scheduling torque-maui-tutorialSantosh Kumar
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Justin Garrison
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Big Data Spain
 
Use of django at jolt online v3
Use of django at jolt online v3Use of django at jolt online v3
Use of django at jolt online v3Jaime Buelta
 
DJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaDJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaMalcolm Box
 
Event Loop in Javascript
Event Loop in JavascriptEvent Loop in Javascript
Event Loop in JavascriptDiptiGandhi4
 
Scaling with Python: SF Python Meetup, September 2017
Scaling with Python: SF Python Meetup, September 2017Scaling with Python: SF Python Meetup, September 2017
Scaling with Python: SF Python Meetup, September 2017Varun Varma
 
New Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingNew Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingScyllaDB
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoAlmir Mendes
 
Pynvme introduction
Pynvme introductionPynvme introduction
Pynvme introductionCrane Chu
 
Rails 勉強会#3
Rails 勉強会#3Rails 勉強会#3
Rails 勉強会#3masami ito
 

What's hot (19)

Scaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approachScaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approach
 
Scheduling torque-maui-tutorial
Scheduling torque-maui-tutorialScheduling torque-maui-tutorial
Scheduling torque-maui-tutorial
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12
 
Rapid tests development
Rapid tests developmentRapid tests development
Rapid tests development
 
Ansible 202
Ansible 202Ansible 202
Ansible 202
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
 
Ac cuda c_1
Ac cuda c_1Ac cuda c_1
Ac cuda c_1
 
Sup intro
Sup introSup intro
Sup intro
 
Use of django at jolt online v3
Use of django at jolt online v3Use of django at jolt online v3
Use of django at jolt online v3
 
DJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaDJUGL - Django and AWS Lambda
DJUGL - Django and AWS Lambda
 
Elixir at Evercam (By Milos Mosic)
Elixir at Evercam (By Milos Mosic)Elixir at Evercam (By Milos Mosic)
Elixir at Evercam (By Milos Mosic)
 
Event Loop in Javascript
Event Loop in JavascriptEvent Loop in Javascript
Event Loop in Javascript
 
Scaling with Python: SF Python Meetup, September 2017
Scaling with Python: SF Python Meetup, September 2017Scaling with Python: SF Python Meetup, September 2017
Scaling with Python: SF Python Meetup, September 2017
 
New Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingNew Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using Tracing
 
Sge
SgeSge
Sge
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
Pynvme introduction
Pynvme introductionPynvme introduction
Pynvme introduction
 
Ansible 202 - sysarmy
Ansible 202 - sysarmyAnsible 202 - sysarmy
Ansible 202 - sysarmy
 
Rails 勉強会#3
Rails 勉強会#3Rails 勉強会#3
Rails 勉強会#3
 

Similar to Simple Tips and Tricks with Ansible

Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupJeff Geerling
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltStack
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)iman darabi
 
Webinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and moreWebinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and morepanagenda
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)iman darabi
 
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Brian Schott
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupGreg DeKoenigsberg
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)anandvaidya
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...addame
 
Ansible at work
Ansible at workAnsible at work
Ansible at workBas Meijer
 

Similar to Simple Tips and Tricks with Ansible (20)

Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Webinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and moreWebinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and more
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
 
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Introducing Ansible
Introducing AnsibleIntroducing Ansible
Introducing Ansible
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
 
Ansible 2.0 spblug
Ansible 2.0 spblugAnsible 2.0 spblug
Ansible 2.0 spblug
 

More from Keith Resar

Rotating Passwords With Ansible and HashiVault
Rotating Passwords With Ansible and HashiVaultRotating Passwords With Ansible and HashiVault
Rotating Passwords With Ansible and HashiVaultKeith Resar
 
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 12Keith Resar
 
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12Keith Resar
 
Advanced Use of jinja2 for Templates
Advanced Use of jinja2 for TemplatesAdvanced Use of jinja2 for Templates
Advanced Use of jinja2 for TemplatesKeith Resar
 
DevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with OpenshiftDevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with OpenshiftKeith Resar
 
Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Keith Resar
 
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...Keith Resar
 

More from Keith Resar (7)

Rotating Passwords With Ansible and HashiVault
Rotating Passwords With Ansible and HashiVaultRotating Passwords With Ansible and HashiVault
Rotating Passwords With Ansible and HashiVault
 
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
 
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12
Hosting For Your Startup, Side Project, or Big Dollar App - Minnebar 12
 
Advanced Use of jinja2 for Templates
Advanced Use of jinja2 for TemplatesAdvanced Use of jinja2 for Templates
Advanced Use of jinja2 for Templates
 
DevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with OpenshiftDevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with Openshift
 
Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Container Storage Best Practices in 2017
Container Storage Best Practices in 2017
 
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...
Importing Code and Existing Containers to OpenShift - Minneapolis Docker Meet...
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

Simple Tips and Tricks with Ansible

  • 1. Mike Dahlgren - miked@redhat.com Tips and Tricks
  • 2.
  • 3. @KeithResar Automating F5 Load Balancers Automating your F5 Local traffic managers using Ansible. Ready to run your first playbook? Come and see what F5 Networks has been up to with ansible playbooks. We will discuss and demo all the cool things you can automate on your BIG-IP. ...presented on June 21st
  • 7. Mike Dahlgren - miked@redhat.com Now for the Tips and Tricks
  • 9. PARALLELISM AND STRATEGIES COMMANDS Number of forks can easily be defined with -f (default is 5) $ ansible webservers -a "/sbin/reboot" -f 10 Strategies can be used to control play execution an can be changed • Lineary strategy = in order execution (Default) • Free strategy = finish as fast as you can - hosts: all strategy: free tasks: ...
  • 10. Removing Files & Directories
  • 11. Removing a file from a server Easy for one File: $ ansible webservers -m file -a "dest=/path/to/file state=absent"
  • 12. Removing all the files and directory - name: remove files and directories file: state: "{{ item }}" path: "/srv/deleteme/" owner: 1000 # set your owner, group, and mode group: 1000 mode: '0777' with_items: - absent - directory
  • 14. Set Defaults in a custom Ansible configuration file. • No need to type -i myhosts from the CLI • Remove the useless .retry files • Can be used anywhere you run Ansible Precedence model: * ANSIBLE_CONFIG (an environment variable) * ansible.cfg (in the current directory) * .ansible.cfg (in the home directory) * /etc/ansible/ansible.cfg
  • 16. TIME LIMITING BACKGROUND OPERATIONS Run script in background (30 Min timeout) $ ansible webserver -B 3600 -P 0 -a "/bin/long_cmd --do-stuff" Checking on the status of a previous job $ ansible web1.example.com -m async_status -a "jid=488359678239.2844" We can set how often to poll the status (60 seconds) $ ansible webserver -B 1800 -P 60 -a "/bin/long_cmd --do-stuff"
  • 17. Clean up your debugging tasks
  • 18. Clean up your debugging tasks - debug: msg: "This always displays" - debug: msg: "This only displays with ansible-playbook -vv+" verbosity: 2
  • 20. Don’t just start services -- use smoke tests - name: check for proper response uri: url: http://localhost/myapp return_content: yes register: result until: '"Hello World" in result.content' retries: 10 delay: 1
  • 22. Use patterns quickly and effectively - Continued Wildcards work one*.com:dbservers So can Regex ~(web|db).*.example.com But would this work? www[01:50].example.com, db-[a:f].example.com
  • 24. Moving Drive letters in a Puppet Manifest vars: alphabet: "abcdefghijklmnopqrstuvwxyz" tasks: - block: - name: change disk names replace: path: /etc/puppet/example/{{ hostname }}.yaml regexp: 'sd{{ alphabet[item | int + 1] }}' replace: 'sd{{ alphabet[item | int] }}' with_sequence: start=0 end=11
  • 26. Flow Control in Templates {% for port in jmx_ports %} <Connection> ServiceURL "service:jmx:rmi:///jndi/rmi://{{ inventory_hostname }}.example.com:{{ port }}/jmxrmi" Host "{{ inventory_hostname }}.example.com" InstancePrefix "port_{{ port }}" Collect "memory" Collect "threads" Collect "classes" </Connection> {% endfor %}
  • 27. TASK [command] ********************************* [WARNING]: Consider using yum module rather than running yum changed: [localhost] @KeithResar
  • 28. - hosts: all tasks: - command: yum -y install telnet - yum: name=telnet state=present - command: yum -y install telnet args: warn: False @KeithResar
  • 29. What is your favorite Trick?