SlideShare uma empresa Scribd logo
1 de 57
Baixar para ler offline
ANSIBLE TOWER BEST PRACTICES
How to write, how to execute, and how to use in real life
NICHOLAS CHIA
Senior Principal Product Manager
‹#›
HOW TO USE
‹#›
ALWAYS treat your Ansible content like code
● Version control your Ansible content
● Iterate
○ Start with a basic playbook and static inventory
○ Refactor and modularize later
AUTOMATION IS CODE
‹#›
Do It with Style
● Create a style guide for consistency:
○ Tagging
○ Whitespace
○ Naming of Tasks, Plays, Variables, and Roles
○ Directory Layouts
● Enforce the style
● Nice example: https://docs.ansible.com/ansible/latest/dev_guide/style_guide/index.html
CODE NEEDS TO HAVE STYLE GUIDELINES
CODE MUST BE
ORGANIZED
USE GIT!
‹#›
DIRECTORY LAYOUT
site.yml # master playbook, calling others
webservers.yml # playbook for webserver tier
deployonce.yml # separate playbook for single-shot tasks
inventories/
production/ # different stages via inventory
hosts # inventory file for production servers
group_vars/
host_vars/
staging/
london/ # additional, alternative grouping if useful
roles/
common/ # base line, company wide configuration
webtier/
‹#›
USE READABLE INVENTORY NAMES
Give inventory nodes human-meaningful names rather than IPs or DNS
hostnames.
10.1.2.75
10.1.5.45
10.1.4.5
10.1.0.40
w14301.acme.com
w17802.acme.com
w19203.acme.com
w19304.acme.com
db1 ansible_host=10.1.2.75
db2 ansible_host=10.1.5.45
db3 ansible_host=10.1.4.5
db4 ansible_host=10.1.0.40
web1 ansible_host=w14301.acme.com
web2 ansible_host=w17802.acme.com
web3 ansible_host=w19203.acme.com
web4 ansible_host=w19203.acme.com
‹#›
TAKE ADVANTAGE OF GROUPING
Group hosts for easier inventory selection and less conditional
tasks -- the more the better.
[db]
db[1:4]
[web]
web[1:4]
[dev]
db1
web1
[testing]
db3
web3
[prod]
db2
web2
db4
web4
[east]
db1
web1
db3
web3
[west]
db2
web2
db4
web4
‹#›
COMBINE ALL INVENTORY SOURCES
Use dynamic sources where possible. Either as a single
source of truth - or let Ansible unify multiple sources.
● Stay in sync automatically
● Reduce human error
● No lag when changes occur
● Let others manage the inventory
VARIABLES
JUST WORDS,
RIGHT?
‹#›
DESCRIBE VARIABLES WITH THEIR NAMES
Proper variable names can make plays more readable and avoid
variable name conflicts
a: 25
data: ab
data2: abc
id: 123
apache_max_keepalive: 25
apache_port: 80
tomcat_port: 8080
‹#›
UNIQUE ROLE VARIABLES
Tip: Avoid collisions and confusion by adding the role name to
a variable as a prefix.
apache_max_keepalive: 25
apache_port: 80
tomcat_port: 8080
‹#›
PLACE VARIABLES APPROPRIATELY
Know where your variables are
● Find the appropriate place for your variables based on what,
where and when they are set or modified
● Separate logic (tasks) from variables and reduce repetitive
patterns
● Do not use every possibility to store variables - settle to a
defined scheme and as few places as possible
MAKE YOUR PLAYBOOK
READABLE
‹#›
USE NATIVE YAML SYNTAX
- name: install telegraf
yum: name=telegraf-{{ telegraf_version }} state=present update_
notify: restart telegraf
- name: start telegraf
service: name=telegraf state=started
NO!
‹#›
USE FOLDING ONLY IF REALLY REQUIRED
- name: install telegraf
yum: >
name=telegraf-{{ telegraf_version }}
state=present
update_cache=yes
enablerepo=telegraf
notify: restart telegraf
- name: start telegraf
service: name=telegraf state=started
Better, but no
‹#›
USE KEY:VALUE PAIRS
Yes!
- name: install telegraf
yum:
name: telegraf-{{ telegraf_version }}
state: present
update_cache: yes
enablerepo: telegraf
notify: restart telegraf
- name: start telegraf
service:
name: telegraf
state: started
‹#›
DO NOT OMIT THE TASK NAME
- hosts: web
tasks:
- yum:
name: httpd
state: latest
- service:
name: httpd
state: started
enabled: yes
PLAY [web]
********************************
TASK [setup]
********************************
ok: [web1]
TASK [yum]
********************************
ok: [web1]
TASK [service]
********************************
ok: [web1]
Exhibit A
‹#›
USE TASK NAMES
- hosts: web
name: installs and starts apache
tasks:
- name: install apache
packages
yum:
name: httpd
state: latest
- name: starts apache service
service:
name: httpd
state: started
enabled: yes
PLAY [install and starts apache]
********************************
TASK [setup]
********************************
ok: [web1]
TASK [install apache packages]
********************************
ok: [web1]
TASK [starts apache service]
********************************
ok: [web1]
Exhibit B
POWERFUL
BLOCKS
‹#›
USE BLOCK SYNTAX
Blocks can help in organizing code, but also enable rollbacks or
output data for critical changes.
- block:
copy:
src: critical.conf
dest: /etc/critical/crit.conf
service:
name: critical
state: restarted
rescue:
command: shutdown -h now
‹#›
HOW TO EXECUTE
‹#›
CHECK IMMEDIATELY WHAT WAS DONE
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 NATIVE MODULES WHERE POSSIBLE
Try to avoid the command module - always seek out a
module first
- name: add user
command: useradd appuser
- name: install apache
command: yum install httpd
- name: start apache
shell: |
service httpd start &&
chkconfig httpd on
- name: add user
user:
name: appuser
state: present
- name: install apache
yum:
name: httpd
state: latest
- name: start apache
service:
name: httpd
state: started
enabled: yes
‹#›
MARK MANAGED FILES
● Label template output files as being generated by Ansible
● Use the ansible_managed** variable with the comment filter
{{ ansible_managed | comment }}
##
# This file is managed by Ansible.# This file is managed by Ansible.
##
# template: /home/ansible/# template: /home/ansible/envenv/dev//dev/ansible_managedansible_managed/roles/role1/templates/test.j2/roles/role1/templates/test.j2
# date: 2015-09-10 11:02:58# date: 2015-09-10 11:02:58
# user: ansible# user: ansible
# host:# host: myhostmyhost
##
If managed files are not marked, they might be overwritten
accidentally
ROLES AND
GALAXIES
‹#›
USE ROLES WHERE POSSIBLE
Roles enable you to encapsulate your operations.
● Like playbooks -- keep roles purpose and function focused
● Use a roles/ subdirectory for roles developed for
organizational clarity in a single project
● Follow the Ansible Galaxy pattern for roles that are to be shared
beyond a single project
● Limit role dependencies
‹#›
USE GALAXY - WITH CARE
Get roles from Galaxy, but be careful and adopt them to your needs
● Galaxy provides thousands of roles
● Quality varies drastically
● Take them with a grain of salt
● Pick trusted or well known authors
ACCESS RIGHTS
‹#›
USE BECOME, DON’T BE A ROOT
Root access is harder to track than sudo - use sudo
wherever possible
● Ansible can be run as root only
● But login and security reasons often request non-root access
● Use become method - so Ansible scripts are executed via sudo
(sudo is easy to track)
● Best: create an Ansible only user
● Don’t try to limit sudo rights to certain commands - Ansible does
not work that way!
DEBUG YOUR
PROBLEM
‹#›
TROUBLESHOOT ON EXECUTION
Ansible provides multiple switches for command line interaction
and troubleshooting.
-vvvv
--step
--check
--diff
--start-at-task
‹#›
ANALYZE WHAT YOUR ARE RUNNING
Ansible has switches to show you what will be done
● Use the power of included options:
--list-tags
--list-hosts
--syntax-check
--list-tasks
‹#›
HAVE A LOOK AT THE NODE LEVEL
Check logging on target machine
ansible-node sshd[2395]:
pam_unix(sshd:session): session opened for
user liquidat by (uid=0)
ansible-node ansible-yum[2399]: Invoked with
name=['httpd'] list=None
install_repoquery=True conf_file=None
disable_gpg_check=False state=absent
disablerepo=None update_cache=False
enablerepo=None exclude=None
‹#›
IN WORST CASE, DEBUG ACTUAL CODE
How to keep the code executed on the target machine
● Look into the logging of your target machine
$ ANSIBLE_KEEP_REMOTE_FILES=1 ansible target-
node -m yum -a "name=httpd state=absent"
● Execute with:
$ /bin/sh -c 'sudo -u $SUDO_USER /bin/sh -c
"/usr/bin/python
/home/liquidat/.ansible/tmp/..."
‹#›
USE THE DEBUG MODULE
Debugging tasks can clutter the output, apply some
housekeeping
- name: Output debug message
debug:
msg: "This always displays"
- name: Output debug message
debug:
msg: "This only displays with ansible-
playbook -vv+"
verbosity: 2
‹#›
HOW TO USE IN REAL LIFE
‹#›
TOWER HAS HELP - USE IT!
● Tower provides in-program
help via questionmark
bubbles
● Can include examples or
links to further docs
BRANCHES, ANYONE?
‹#›
TAKE ADVANTAGE OF GIT BRANCHES
Tower can import a repository multiple times with different
branches
● Use feature or staging branches in your Git
● Import them all separately, address them separately
● Useful for testing of new features but also to move changes
through stages
WHAT ARE WE
TALKING TO?
‹#›
USE DYNAMIC & SMART INVENTORIES
● Combine multiple inventory
types
● Let Tower take care of
syncing and caching
● Use smart inventories to
group nodes
DOING GOOD JOBS
‹#›
USE THE POWER OF JOB TEMPLATES
Tower job templates provide multiple options - use them wisely
● Keep jobs simple, focussed - as playbooks or roles
● Add labels to them to better filter, see
● For idempotent jobs, create “check” templates as well - and let
them run over night
● Combine with notifications - and get feedback when a “check”
failed
1+1+1 = 1
‹#›
USE WORKFLOWS FOR COMPLEX TASKS
Multiple playbooks can be combined into one workflow
● Simple jobs, complex workflows
● React to problems via workflow
● Combine playbooks of different teams,
different repositories
● Re-sync inventories during the play
DO ASK PROPER QUESTIONS
‹#›
MAKE MEANINGFUL SURVEYS
● Use good, meaningful variable
names
● Provide a default choice
● Multiple choice > free text
● If answer not required - do you
really need it at all?
A POWERFUL
TEAM
‹#›
USE TOWER TEAMS, SEPARATIONS
Tower provides tenants, teams, and users - use them for
separation
● Provide automation to others
without exposing credentials
● Let others only see what they really
need
● Use personal view instead of full
Tower interface
ONE KEY TO RULE
THEM ALL ...
‹#›
USE TOWER SPECIFIC ACCESS CREDENTIALS
Tower credentials should only be used by Tower - not by others
● Set up a separate user and password/key for
Tower
● That way, automation can easily be identified
on target machines
● The key/password can be ridiculously
complicated secure
● Store key/password in a safe for emergencies
NOTIFY YOURSELF!
‹#›
LET TOWER SEND NOTIFICATIONS TO YOU
Tower cand send notifications if a job succeeds, fails or
always - as mail, IRC, web hook, and so on
● Let Tower notify you and your team if
something breaks
● Send mails/web hooks automatically to a
ticket systems and monitoring if there is a
serious problem
ALWAYS KEEP
THE LIGHTS ON
‹#›
USE HA, DEPLOY ISOLATED NODES
Tower can be easily set up HA - and for restricted networks,
deploy isolated nodes
● Make Tower HA - it is easy! (Well, except the
DB part maybe….)
● For distant or restricted networks, use isolated
nodes
THANK YOU!
Questions? Complains? Show some love?

Mais conteúdo relacionado

Mais procurados

Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleBrian Hogan
 
Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformImmutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformMichael Peacock
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible referencelaonap166
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101yfauser
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with AnsibleAnas
 
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016ManageIQ
 
Ansible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User GroupAnsible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User GroupOrestes Carracedo
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Jeff Geerling
 
Zero Code Multi-Cloud Automation with Ansible and Terraform
Zero Code Multi-Cloud Automation with Ansible and TerraformZero Code Multi-Cloud Automation with Ansible and Terraform
Zero Code Multi-Cloud Automation with Ansible and TerraformAvi Networks
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPressAlan Lok
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation EasyPeter Sankauskas
 
Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Alan Lok
 
Introduction to Ansible - Jan 28 - Austin MeetUp
Introduction to Ansible - Jan 28 - Austin MeetUpIntroduction to Ansible - Jan 28 - Austin MeetUp
Introduction to Ansible - Jan 28 - Austin MeetUptylerturk
 
Continuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub ActionsContinuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub ActionsJeff Geerling
 
Using Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudUsing Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudJesse Keating
 

Mais procurados (20)

Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and TerraformImmutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and Terraform
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
Ansible Tower - Drew Bomhof, Brandon Dunne - ManageIQ Design Summit 2016
 
Ansible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User GroupAnsible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User Group
 
Docker Birtday #5
Docker Birtday #5Docker Birtday #5
Docker Birtday #5
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2
 
Zero Code Multi-Cloud Automation with Ansible and Terraform
Zero Code Multi-Cloud Automation with Ansible and TerraformZero Code Multi-Cloud Automation with Ansible and Terraform
Zero Code Multi-Cloud Automation with Ansible and Terraform
 
Testing Ansible
Testing AnsibleTesting Ansible
Testing Ansible
 
Extending ansible
Extending ansibleExtending ansible
Extending ansible
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPress
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016Ansible + WordPress - WordCamp Toronto 2016
Ansible + WordPress - WordCamp Toronto 2016
 
Introduction to Ansible - Jan 28 - Austin MeetUp
Introduction to Ansible - Jan 28 - Austin MeetUpIntroduction to Ansible - Jan 28 - Austin MeetUp
Introduction to Ansible - Jan 28 - Austin MeetUp
 
Continuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub ActionsContinuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub Actions
 
Awx
AwxAwx
Awx
 
Using Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudUsing Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public Cloud
 

Semelhante a 03 ansible towerbestpractices-nicholas

Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them AllTim Fairweather
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)iman darabi
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes][HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]Wong Hoi Sing Edison
 
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
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouJ On The Beach
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftYaniv cohen
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixDiana Tkachenko
 
Introduction to rails
Introduction to railsIntroduction to rails
Introduction to railsGo Asgard
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes][HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]Wong Hoi Sing Edison
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.Bob Killen
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Running Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic BeanstalkRunning Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic Beanstalkzupzup.org
 

Semelhante a 03 ansible towerbestpractices-nicholas (20)

Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes][HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]
 
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)
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch Fix
 
Introduction to rails
Introduction to railsIntroduction to rails
Introduction to rails
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes][HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Ansible testing
Ansible   testingAnsible   testing
Ansible testing
 
Running Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic BeanstalkRunning Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic Beanstalk
 

Mais de Khairul Zebua

Ansible - From Zero to Hero.pptx
Ansible - From Zero to Hero.pptxAnsible - From Zero to Hero.pptx
Ansible - From Zero to Hero.pptxKhairul Zebua
 
Extending Agile with DevOps Mindset
Extending Agile with DevOps MindsetExtending Agile with DevOps Mindset
Extending Agile with DevOps MindsetKhairul Zebua
 
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATA
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATAGet rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATA
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATAKhairul Zebua
 
Brace yourself alerts are coming (case study tokopedia)
Brace yourself alerts are coming (case study tokopedia)Brace yourself alerts are coming (case study tokopedia)
Brace yourself alerts are coming (case study tokopedia)Khairul Zebua
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and AlertingKhairul Zebua
 
Ansible with Jenkins in a CI/CD Process
Ansible with Jenkins in a CI/CD ProcessAnsible with Jenkins in a CI/CD Process
Ansible with Jenkins in a CI/CD ProcessKhairul Zebua
 
DevOps Indonesia Presentation
DevOps Indonesia PresentationDevOps Indonesia Presentation
DevOps Indonesia PresentationKhairul Zebua
 
DevOps at Tokopedia - DevOps Indonesia
DevOps at Tokopedia - DevOps IndonesiaDevOps at Tokopedia - DevOps Indonesia
DevOps at Tokopedia - DevOps IndonesiaKhairul Zebua
 
08 red hattrainingandcertification
08 red hattrainingandcertification08 red hattrainingandcertification
08 red hattrainingandcertificationKhairul Zebua
 
07 automate windowsenvironmentswithansibleanddsc
07 automate windowsenvironmentswithansibleanddsc07 automate windowsenvironmentswithansibleanddsc
07 automate windowsenvironmentswithansibleanddscKhairul Zebua
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansibleKhairul Zebua
 
05 security automationwithansible
05 security automationwithansible05 security automationwithansible
05 security automationwithansibleKhairul Zebua
 
04 accelerating businessvaluewithdevops
04 accelerating businessvaluewithdevops04 accelerating businessvaluewithdevops
04 accelerating businessvaluewithdevopsKhairul Zebua
 
02 ansible automateskeynote-jakarta
02 ansible automateskeynote-jakarta02 ansible automateskeynote-jakarta
02 ansible automateskeynote-jakartaKhairul Zebua
 

Mais de Khairul Zebua (14)

Ansible - From Zero to Hero.pptx
Ansible - From Zero to Hero.pptxAnsible - From Zero to Hero.pptx
Ansible - From Zero to Hero.pptx
 
Extending Agile with DevOps Mindset
Extending Agile with DevOps MindsetExtending Agile with DevOps Mindset
Extending Agile with DevOps Mindset
 
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATA
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATAGet rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATA
Get rid of obstacles with DevOps Mindset - IT Tech Talk #2 XL AXIATA
 
Brace yourself alerts are coming (case study tokopedia)
Brace yourself alerts are coming (case study tokopedia)Brace yourself alerts are coming (case study tokopedia)
Brace yourself alerts are coming (case study tokopedia)
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and Alerting
 
Ansible with Jenkins in a CI/CD Process
Ansible with Jenkins in a CI/CD ProcessAnsible with Jenkins in a CI/CD Process
Ansible with Jenkins in a CI/CD Process
 
DevOps Indonesia Presentation
DevOps Indonesia PresentationDevOps Indonesia Presentation
DevOps Indonesia Presentation
 
DevOps at Tokopedia - DevOps Indonesia
DevOps at Tokopedia - DevOps IndonesiaDevOps at Tokopedia - DevOps Indonesia
DevOps at Tokopedia - DevOps Indonesia
 
08 red hattrainingandcertification
08 red hattrainingandcertification08 red hattrainingandcertification
08 red hattrainingandcertification
 
07 automate windowsenvironmentswithansibleanddsc
07 automate windowsenvironmentswithansibleanddsc07 automate windowsenvironmentswithansibleanddsc
07 automate windowsenvironmentswithansibleanddsc
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansible
 
05 security automationwithansible
05 security automationwithansible05 security automationwithansible
05 security automationwithansible
 
04 accelerating businessvaluewithdevops
04 accelerating businessvaluewithdevops04 accelerating businessvaluewithdevops
04 accelerating businessvaluewithdevops
 
02 ansible automateskeynote-jakarta
02 ansible automateskeynote-jakarta02 ansible automateskeynote-jakarta
02 ansible automateskeynote-jakarta
 

Último

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

03 ansible towerbestpractices-nicholas

  • 1. ANSIBLE TOWER BEST PRACTICES How to write, how to execute, and how to use in real life NICHOLAS CHIA Senior Principal Product Manager
  • 3. ‹#› ALWAYS treat your Ansible content like code ● Version control your Ansible content ● Iterate ○ Start with a basic playbook and static inventory ○ Refactor and modularize later AUTOMATION IS CODE
  • 4. ‹#› Do It with Style ● Create a style guide for consistency: ○ Tagging ○ Whitespace ○ Naming of Tasks, Plays, Variables, and Roles ○ Directory Layouts ● Enforce the style ● Nice example: https://docs.ansible.com/ansible/latest/dev_guide/style_guide/index.html CODE NEEDS TO HAVE STYLE GUIDELINES
  • 6. ‹#› DIRECTORY LAYOUT site.yml # master playbook, calling others webservers.yml # playbook for webserver tier deployonce.yml # separate playbook for single-shot tasks inventories/ production/ # different stages via inventory hosts # inventory file for production servers group_vars/ host_vars/ staging/ london/ # additional, alternative grouping if useful roles/ common/ # base line, company wide configuration webtier/
  • 7. ‹#› USE READABLE INVENTORY NAMES Give inventory nodes human-meaningful names rather than IPs or DNS hostnames. 10.1.2.75 10.1.5.45 10.1.4.5 10.1.0.40 w14301.acme.com w17802.acme.com w19203.acme.com w19304.acme.com db1 ansible_host=10.1.2.75 db2 ansible_host=10.1.5.45 db3 ansible_host=10.1.4.5 db4 ansible_host=10.1.0.40 web1 ansible_host=w14301.acme.com web2 ansible_host=w17802.acme.com web3 ansible_host=w19203.acme.com web4 ansible_host=w19203.acme.com
  • 8. ‹#› TAKE ADVANTAGE OF GROUPING Group hosts for easier inventory selection and less conditional tasks -- the more the better. [db] db[1:4] [web] web[1:4] [dev] db1 web1 [testing] db3 web3 [prod] db2 web2 db4 web4 [east] db1 web1 db3 web3 [west] db2 web2 db4 web4
  • 9. ‹#› COMBINE ALL INVENTORY SOURCES Use dynamic sources where possible. Either as a single source of truth - or let Ansible unify multiple sources. ● Stay in sync automatically ● Reduce human error ● No lag when changes occur ● Let others manage the inventory
  • 11. ‹#› DESCRIBE VARIABLES WITH THEIR NAMES Proper variable names can make plays more readable and avoid variable name conflicts a: 25 data: ab data2: abc id: 123 apache_max_keepalive: 25 apache_port: 80 tomcat_port: 8080
  • 12. ‹#› UNIQUE ROLE VARIABLES Tip: Avoid collisions and confusion by adding the role name to a variable as a prefix. apache_max_keepalive: 25 apache_port: 80 tomcat_port: 8080
  • 13. ‹#› PLACE VARIABLES APPROPRIATELY Know where your variables are ● Find the appropriate place for your variables based on what, where and when they are set or modified ● Separate logic (tasks) from variables and reduce repetitive patterns ● Do not use every possibility to store variables - settle to a defined scheme and as few places as possible
  • 15. ‹#› USE NATIVE YAML SYNTAX - name: install telegraf yum: name=telegraf-{{ telegraf_version }} state=present update_ notify: restart telegraf - name: start telegraf service: name=telegraf state=started NO!
  • 16. ‹#› USE FOLDING ONLY IF REALLY REQUIRED - name: install telegraf yum: > name=telegraf-{{ telegraf_version }} state=present update_cache=yes enablerepo=telegraf notify: restart telegraf - name: start telegraf service: name=telegraf state=started Better, but no
  • 17. ‹#› USE KEY:VALUE PAIRS Yes! - name: install telegraf yum: name: telegraf-{{ telegraf_version }} state: present update_cache: yes enablerepo: telegraf notify: restart telegraf - name: start telegraf service: name: telegraf state: started
  • 18. ‹#› DO NOT OMIT THE TASK NAME - hosts: web tasks: - yum: name: httpd state: latest - service: name: httpd state: started enabled: yes PLAY [web] ******************************** TASK [setup] ******************************** ok: [web1] TASK [yum] ******************************** ok: [web1] TASK [service] ******************************** ok: [web1] Exhibit A
  • 19. ‹#› USE TASK NAMES - hosts: web name: installs and starts apache tasks: - name: install apache packages yum: name: httpd state: latest - name: starts apache service service: name: httpd state: started enabled: yes PLAY [install and starts apache] ******************************** TASK [setup] ******************************** ok: [web1] TASK [install apache packages] ******************************** ok: [web1] TASK [starts apache service] ******************************** ok: [web1] Exhibit B
  • 21. ‹#› USE BLOCK SYNTAX Blocks can help in organizing code, but also enable rollbacks or output data for critical changes. - block: copy: src: critical.conf dest: /etc/critical/crit.conf service: name: critical state: restarted rescue: command: shutdown -h now
  • 23. ‹#› CHECK IMMEDIATELY WHAT WAS DONE 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
  • 24. ‹#› USE NATIVE MODULES WHERE POSSIBLE Try to avoid the command module - always seek out a module first - name: add user command: useradd appuser - name: install apache command: yum install httpd - name: start apache shell: | service httpd start && chkconfig httpd on - name: add user user: name: appuser state: present - name: install apache yum: name: httpd state: latest - name: start apache service: name: httpd state: started enabled: yes
  • 25. ‹#› MARK MANAGED FILES ● Label template output files as being generated by Ansible ● Use the ansible_managed** variable with the comment filter {{ ansible_managed | comment }} ## # This file is managed by Ansible.# This file is managed by Ansible. ## # template: /home/ansible/# template: /home/ansible/envenv/dev//dev/ansible_managedansible_managed/roles/role1/templates/test.j2/roles/role1/templates/test.j2 # date: 2015-09-10 11:02:58# date: 2015-09-10 11:02:58 # user: ansible# user: ansible # host:# host: myhostmyhost ## If managed files are not marked, they might be overwritten accidentally
  • 27. ‹#› USE ROLES WHERE POSSIBLE Roles enable you to encapsulate your operations. ● Like playbooks -- keep roles purpose and function focused ● Use a roles/ subdirectory for roles developed for organizational clarity in a single project ● Follow the Ansible Galaxy pattern for roles that are to be shared beyond a single project ● Limit role dependencies
  • 28. ‹#› USE GALAXY - WITH CARE Get roles from Galaxy, but be careful and adopt them to your needs ● Galaxy provides thousands of roles ● Quality varies drastically ● Take them with a grain of salt ● Pick trusted or well known authors
  • 30. ‹#› USE BECOME, DON’T BE A ROOT Root access is harder to track than sudo - use sudo wherever possible ● Ansible can be run as root only ● But login and security reasons often request non-root access ● Use become method - so Ansible scripts are executed via sudo (sudo is easy to track) ● Best: create an Ansible only user ● Don’t try to limit sudo rights to certain commands - Ansible does not work that way!
  • 32. ‹#› TROUBLESHOOT ON EXECUTION Ansible provides multiple switches for command line interaction and troubleshooting. -vvvv --step --check --diff --start-at-task
  • 33. ‹#› ANALYZE WHAT YOUR ARE RUNNING Ansible has switches to show you what will be done ● Use the power of included options: --list-tags --list-hosts --syntax-check --list-tasks
  • 34. ‹#› HAVE A LOOK AT THE NODE LEVEL Check logging on target machine ansible-node sshd[2395]: pam_unix(sshd:session): session opened for user liquidat by (uid=0) ansible-node ansible-yum[2399]: Invoked with name=['httpd'] list=None install_repoquery=True conf_file=None disable_gpg_check=False state=absent disablerepo=None update_cache=False enablerepo=None exclude=None
  • 35. ‹#› IN WORST CASE, DEBUG ACTUAL CODE How to keep the code executed on the target machine ● Look into the logging of your target machine $ ANSIBLE_KEEP_REMOTE_FILES=1 ansible target- node -m yum -a "name=httpd state=absent" ● Execute with: $ /bin/sh -c 'sudo -u $SUDO_USER /bin/sh -c "/usr/bin/python /home/liquidat/.ansible/tmp/..."
  • 36. ‹#› USE THE DEBUG MODULE Debugging tasks can clutter the output, apply some housekeeping - name: Output debug message debug: msg: "This always displays" - name: Output debug message debug: msg: "This only displays with ansible- playbook -vv+" verbosity: 2
  • 37. ‹#› HOW TO USE IN REAL LIFE
  • 38. ‹#› TOWER HAS HELP - USE IT! ● Tower provides in-program help via questionmark bubbles ● Can include examples or links to further docs
  • 40. ‹#› TAKE ADVANTAGE OF GIT BRANCHES Tower can import a repository multiple times with different branches ● Use feature or staging branches in your Git ● Import them all separately, address them separately ● Useful for testing of new features but also to move changes through stages
  • 42. ‹#› USE DYNAMIC & SMART INVENTORIES ● Combine multiple inventory types ● Let Tower take care of syncing and caching ● Use smart inventories to group nodes
  • 44. ‹#› USE THE POWER OF JOB TEMPLATES Tower job templates provide multiple options - use them wisely ● Keep jobs simple, focussed - as playbooks or roles ● Add labels to them to better filter, see ● For idempotent jobs, create “check” templates as well - and let them run over night ● Combine with notifications - and get feedback when a “check” failed
  • 46. ‹#› USE WORKFLOWS FOR COMPLEX TASKS Multiple playbooks can be combined into one workflow ● Simple jobs, complex workflows ● React to problems via workflow ● Combine playbooks of different teams, different repositories ● Re-sync inventories during the play
  • 47. DO ASK PROPER QUESTIONS
  • 48. ‹#› MAKE MEANINGFUL SURVEYS ● Use good, meaningful variable names ● Provide a default choice ● Multiple choice > free text ● If answer not required - do you really need it at all?
  • 50. ‹#› USE TOWER TEAMS, SEPARATIONS Tower provides tenants, teams, and users - use them for separation ● Provide automation to others without exposing credentials ● Let others only see what they really need ● Use personal view instead of full Tower interface
  • 51. ONE KEY TO RULE THEM ALL ...
  • 52. ‹#› USE TOWER SPECIFIC ACCESS CREDENTIALS Tower credentials should only be used by Tower - not by others ● Set up a separate user and password/key for Tower ● That way, automation can easily be identified on target machines ● The key/password can be ridiculously complicated secure ● Store key/password in a safe for emergencies
  • 54. ‹#› LET TOWER SEND NOTIFICATIONS TO YOU Tower cand send notifications if a job succeeds, fails or always - as mail, IRC, web hook, and so on ● Let Tower notify you and your team if something breaks ● Send mails/web hooks automatically to a ticket systems and monitoring if there is a serious problem
  • 56. ‹#› USE HA, DEPLOY ISOLATED NODES Tower can be easily set up HA - and for restricted networks, deploy isolated nodes ● Make Tower HA - it is easy! (Well, except the DB part maybe….) ● For distant or restricted networks, use isolated nodes