SlideShare a Scribd company logo
1 of 20
Download to read offline
1
introducing
Haid-und-Neu-Str. 18, 76131 Karlsruhe
Germany
2
DevOps Engineer @msales
lots of aws, lots of ansible
I go fishing
I have two children (less time to go fishing, but still fun)
I play The Legend of Zelda
I'm not a layout professional
david.heidt@msales.com
Twitter: @witsches, @msalestech
David Heidt
about me
yes, I caught this myself
3
but why?
David uses ansible. It's super effective!
agentless
ssh + python is basic
straight forward
start from scratch
even with existing servers
incredibly good documentation
human-readable yml
4
playbooks
you know what this does whithout knowing ansible. It is OK to feel good now
- hosts: redis_server
vars:
redis_password: "foobar"
tasks:
- apt: update_cache=yes upgrade=dist
- apt: name=redis-server state=installed
- lineinfile: dest=/etc/redis/redis.conf line="requirepass {{ redis_password }}"
notify:
- restart redis
handlers:
- name: restart redis
service: name=redis-server state=restarted enabled=yes
5
inventory
INI-like format. same-same but different
[webworker]
web0.example.com
web1.example.com
[loadbalancer]
lb.example.com
[redis_server]
10.0.0.99
6
more inventory
with hostvars, host groups and unicorns
[webworker]
web0.example.com
web1.example.com
web2.example.com unicorns=3
[loadbalancer]
lb.example.com wizardry=True
[webstack:children]
loadbalancer
webworker
7
modules
how to conquer the world
control the system (filesystems, lvm, service-control, user accounts…)
work with packaging (apt, yum, brew, but also bundler, composer, pip, bower, …)
working with files (Permissions, copy, templating, regex, patch)
manage databases
configure monitoring
control the cloud
8
modules
how to conquer the world the way you like it
- name: restart nginx
service: name=nginx state=restarted
- name: restart nginx
service:
name: nginx
state: restarted
ansible all -m service -a "name=nginx state=restarted"
9
write playbooks
make it do what you want it to do
nested yaml dictionaries
control structures, loops
jinja2 template engine
registering module output as runtime dict
limits, tags
10
vaults
better not share credentials while conquering the world
can encrypt any data structure yml used by ansible
not only variables, but also tasks or handlers
'ansible-vault' ships as executable with ansible
easy migration: encrypt existing files
vaults in public, passwords in trusted places
vaults are AES (shared-secret) encrypted
11
new in ansible 2: blocks
conquering the world in small units
group similar tasks
with error handling and rescue
use conditionals and tags only once
blocks can be nested!
block variables are existent in the block only
any_errors_fatal triggers rescue for all hosts
12
… for con… OK, I stop it
execution strategy plugins
many, many new modules
improved error messages
playbook execution engine rewrite
includes can use dynamic elements
more new stuff in ansible 2
13
see it in action? live demo.
14
best practices
yeah, this is also in the docs. I know.
use a provisioning server and agent-forwarding when working in a team
store your playbook in a repository
When you can do something simply, do something simply.
use production and staging
use ansible galaxy (re-use or just for inspiration)
browse the documentation now and then
15
h4cks
best practices we find pretty useful @msales
[all:vars]
environment=production
aws_access_key=AKIAIOSFO7PRODEXAMPLE
production inventory
[all:vars]
environment=staging
aws_access_key=AKIAIOSFOSTAGEEXAMPLE
staging inventory
16
h4cks
best practices we find pretty useful @msales
[…]
roles:
- { role: facts, tags: [ 'always','facts' ] }
- { role: commonsetup, tags: [ 'commonsetup' ] }
- { role: php5, tags: [ 'php5','webstack'] }
- { role: nginx, tags: [ 'nginx','webstack']}
- { role: monitoring, tags: [ 'monitoring'] }
- { role: telegraf, tags: [ 'monitoring'] }
[…]
use (special) tags in playbooks and tasks
17
h4cks
best practices we find pretty useful @msales
me@server:~# tree shared_roles/aws_dict/
shared_roles/aws_dict/
└── vars
└── main.yml
use an (almost) empty shared role for frequently used vars
18
wait, you were working with servers?
deployment
cloud
monitoring
docker
vagrant
what do you use ansible for? help me, audience!
ansible is not for servers only
19
- name: '"let's try tower"
uri: url=https://www.ansible.com/tower
when: geek is not defined
ansible only for geeks like us?
-> www.ansible.com/tower
actually, there are some pretty cool features for geeks, too.
20
Thanks.
msales GmbH
Haid-und-Neu-Str. 18, 76131 Karlsruhe
Germany
info@msales.com www.msales.com +49 721 91138 0
follow us @msalestech
repository url: https://github.com/msales/ansible-talk

More Related Content

What's hot

How We Learned To Love The Data Center Operating System
How We Learned To Love The Data Center Operating SystemHow We Learned To Love The Data Center Operating System
How We Learned To Love The Data Center Operating Systemsaulius_vl
 
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...Ontico
 
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018DevOpsDays Tel Aviv
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replicationorczhou
 
Speeding up R with Parallel Programming in the Cloud
Speeding up R with Parallel Programming in the CloudSpeeding up R with Parallel Programming in the Cloud
Speeding up R with Parallel Programming in the CloudRevolution Analytics
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoopEnrique Davila
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16Enrique Davila
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Enrique Davila
 
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...DataStax Academy
 
Beginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingBeginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingRob Knight
 
Cake Php 101 Brownbag
Cake Php 101 BrownbagCake Php 101 Brownbag
Cake Php 101 BrownbagFinster
 
Migrating Existing Open Source Machine Learning to Azure
Migrating Existing Open Source Machine Learning to AzureMigrating Existing Open Source Machine Learning to Azure
Migrating Existing Open Source Machine Learning to AzureRevolution Analytics
 
Pynvme introduction
Pynvme introductionPynvme introduction
Pynvme introductionCrane Chu
 
uWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsuWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsTomislav Raseta
 

What's hot (20)

How We Learned To Love The Data Center Operating System
How We Learned To Love The Data Center Operating SystemHow We Learned To Love The Data Center Operating System
How We Learned To Love The Data Center Operating System
 
Docker
DockerDocker
Docker
 
Memory Management in WordPress
Memory Management in WordPressMemory Management in WordPress
Memory Management in WordPress
 
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
 
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018
Data Science in DevOps/SysOps - Boaz Shuster - DevOpsDays Tel Aviv 2018
 
Node.js in a heterogeneous system
Node.js in a heterogeneous systemNode.js in a heterogeneous system
Node.js in a heterogeneous system
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replication
 
Speeding up R with Parallel Programming in the Cloud
Speeding up R with Parallel Programming in the CloudSpeeding up R with Parallel Programming in the Cloud
Speeding up R with Parallel Programming in the Cloud
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoop
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16
 
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
 
Beginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingBeginning Jquery In Drupal Theming
Beginning Jquery In Drupal Theming
 
Cake Php 101 Brownbag
Cake Php 101 BrownbagCake Php 101 Brownbag
Cake Php 101 Brownbag
 
R in Minecraft
R in Minecraft R in Minecraft
R in Minecraft
 
Migrating Existing Open Source Machine Learning to Azure
Migrating Existing Open Source Machine Learning to AzureMigrating Existing Open Source Machine Learning to Azure
Migrating Existing Open Source Machine Learning to Azure
 
Elastic search
Elastic searchElastic search
Elastic search
 
Pynvme introduction
Pynvme introductionPynvme introduction
Pynvme introduction
 
Jk rubyslava 25
Jk rubyslava 25Jk rubyslava 25
Jk rubyslava 25
 
uWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web appsuWSGI - Swiss army knife for your Python web apps
uWSGI - Swiss army knife for your Python web apps
 

Viewers also liked

Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016David Karban
 
PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)Pavel Emelyanov
 
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...Elisabeth Kurek
 
Amazon bonding customers_with_integrated_service case study
Amazon bonding customers_with_integrated_service  case studyAmazon bonding customers_with_integrated_service  case study
Amazon bonding customers_with_integrated_service case studyAenuganti Babu Naidu
 
Asbestos And Criminal Liability Nov
Asbestos And Criminal Liability NovAsbestos And Criminal Liability Nov
Asbestos And Criminal Liability NovBNWhitmore
 
Defining The Riverbanks Cygnal Synygy April 2008
Defining The Riverbanks Cygnal Synygy April 2008Defining The Riverbanks Cygnal Synygy April 2008
Defining The Riverbanks Cygnal Synygy April 2008BethCarroll
 
Employer Branding Strategie
Employer Branding StrategieEmployer Branding Strategie
Employer Branding StrategieSteffen Herzog
 
Использование maven для сборки больших модульных c++ проектов на примере Odin...
Использование maven для сборки больших модульных c++ проектов на примере Odin...Использование maven для сборки больших модульных c++ проектов на примере Odin...
Использование maven для сборки больших модульных c++ проектов на примере Odin...Platonov Sergey
 
Automated Security Hardening with OpenStack-Ansible
Automated Security Hardening with OpenStack-AnsibleAutomated Security Hardening with OpenStack-Ansible
Automated Security Hardening with OpenStack-AnsibleMajor Hayden
 
Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015Dustin Nay
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3Platonov Sergey
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaPrajal Kulkarni
 
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會Jason Cheng
 

Viewers also liked (19)

Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016
 
PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)
 
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...
Summit_Presentation_Building_Websites_Building_Businesses_How_to_Provide_the_...
 
Amazon bonding customers_with_integrated_service case study
Amazon bonding customers_with_integrated_service  case studyAmazon bonding customers_with_integrated_service  case study
Amazon bonding customers_with_integrated_service case study
 
Asbestos And Criminal Liability Nov
Asbestos And Criminal Liability NovAsbestos And Criminal Liability Nov
Asbestos And Criminal Liability Nov
 
Assess your marketing skills
Assess your marketing skillsAssess your marketing skills
Assess your marketing skills
 
WWW.USGBC- USCaribbean.org
WWW.USGBC- USCaribbean.orgWWW.USGBC- USCaribbean.org
WWW.USGBC- USCaribbean.org
 
Defining The Riverbanks Cygnal Synygy April 2008
Defining The Riverbanks Cygnal Synygy April 2008Defining The Riverbanks Cygnal Synygy April 2008
Defining The Riverbanks Cygnal Synygy April 2008
 
Employer Branding Strategie
Employer Branding StrategieEmployer Branding Strategie
Employer Branding Strategie
 
Start-Up Curaçao
Start-Up CuraçaoStart-Up Curaçao
Start-Up Curaçao
 
Automating AWS with Ansible
Automating AWS with AnsibleAutomating AWS with Ansible
Automating AWS with Ansible
 
Использование maven для сборки больших модульных c++ проектов на примере Odin...
Использование maven для сборки больших модульных c++ проектов на примере Odin...Использование maven для сборки больших модульных c++ проектов на примере Odin...
Использование maven для сборки больших модульных c++ проектов на примере Odin...
 
Automated Security Hardening with OpenStack-Ansible
Automated Security Hardening with OpenStack-AnsibleAutomated Security Hardening with OpenStack-Ansible
Automated Security Hardening with OpenStack-Ansible
 
Innovación en ciencia y tecnología
Innovación en ciencia y tecnologíaInnovación en ciencia y tecnología
Innovación en ciencia y tecnología
 
Innovación en ciencia y tecnología
Innovación en ciencia y tecnologíaInnovación en ciencia y tecnología
Innovación en ciencia y tecnología
 
Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會
開源 x 節流:企業導入實例分享 (二) [2016/03/31] 文件自由日研討會
 

Similar to Deploying infrastructure with Ansible

Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Drupal Camp Brighton 2015: Ansible Drupal Medicine show
Drupal Camp Brighton 2015: Ansible Drupal Medicine showDrupal Camp Brighton 2015: Ansible Drupal Medicine show
Drupal Camp Brighton 2015: Ansible Drupal Medicine showGeorge Boobyer
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
 
Ansible to provision your machines
Ansible to provision your machinesAnsible to provision your machines
Ansible to provision your machinesFellipe Callegas
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Jude A. Goonawardena
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)M Malai
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our WishboneMydbops
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOpsAgile Spain
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011Carlos Sanchez
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesPuppet
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakNETWAYS
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys AdminsPuppet
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchJeff Geerling
 

Similar to Deploying infrastructure with Ansible (20)

Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Drupal Camp Brighton 2015: Ansible Drupal Medicine show
Drupal Camp Brighton 2015: Ansible Drupal Medicine showDrupal Camp Brighton 2015: Ansible Drupal Medicine show
Drupal Camp Brighton 2015: Ansible Drupal Medicine show
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
Ansible to provision your machines
Ansible to provision your machinesAnsible to provision your machines
Ansible to provision your machines
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our Wishbone
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large Enterprises
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps Match
 

Deploying infrastructure with Ansible

  • 2. 2 DevOps Engineer @msales lots of aws, lots of ansible I go fishing I have two children (less time to go fishing, but still fun) I play The Legend of Zelda I'm not a layout professional david.heidt@msales.com Twitter: @witsches, @msalestech David Heidt about me yes, I caught this myself
  • 3. 3 but why? David uses ansible. It's super effective! agentless ssh + python is basic straight forward start from scratch even with existing servers incredibly good documentation human-readable yml
  • 4. 4 playbooks you know what this does whithout knowing ansible. It is OK to feel good now - hosts: redis_server vars: redis_password: "foobar" tasks: - apt: update_cache=yes upgrade=dist - apt: name=redis-server state=installed - lineinfile: dest=/etc/redis/redis.conf line="requirepass {{ redis_password }}" notify: - restart redis handlers: - name: restart redis service: name=redis-server state=restarted enabled=yes
  • 5. 5 inventory INI-like format. same-same but different [webworker] web0.example.com web1.example.com [loadbalancer] lb.example.com [redis_server] 10.0.0.99
  • 6. 6 more inventory with hostvars, host groups and unicorns [webworker] web0.example.com web1.example.com web2.example.com unicorns=3 [loadbalancer] lb.example.com wizardry=True [webstack:children] loadbalancer webworker
  • 7. 7 modules how to conquer the world control the system (filesystems, lvm, service-control, user accounts…) work with packaging (apt, yum, brew, but also bundler, composer, pip, bower, …) working with files (Permissions, copy, templating, regex, patch) manage databases configure monitoring control the cloud
  • 8. 8 modules how to conquer the world the way you like it - name: restart nginx service: name=nginx state=restarted - name: restart nginx service: name: nginx state: restarted ansible all -m service -a "name=nginx state=restarted"
  • 9. 9 write playbooks make it do what you want it to do nested yaml dictionaries control structures, loops jinja2 template engine registering module output as runtime dict limits, tags
  • 10. 10 vaults better not share credentials while conquering the world can encrypt any data structure yml used by ansible not only variables, but also tasks or handlers 'ansible-vault' ships as executable with ansible easy migration: encrypt existing files vaults in public, passwords in trusted places vaults are AES (shared-secret) encrypted
  • 11. 11 new in ansible 2: blocks conquering the world in small units group similar tasks with error handling and rescue use conditionals and tags only once blocks can be nested! block variables are existent in the block only any_errors_fatal triggers rescue for all hosts
  • 12. 12 … for con… OK, I stop it execution strategy plugins many, many new modules improved error messages playbook execution engine rewrite includes can use dynamic elements more new stuff in ansible 2
  • 13. 13 see it in action? live demo.
  • 14. 14 best practices yeah, this is also in the docs. I know. use a provisioning server and agent-forwarding when working in a team store your playbook in a repository When you can do something simply, do something simply. use production and staging use ansible galaxy (re-use or just for inspiration) browse the documentation now and then
  • 15. 15 h4cks best practices we find pretty useful @msales [all:vars] environment=production aws_access_key=AKIAIOSFO7PRODEXAMPLE production inventory [all:vars] environment=staging aws_access_key=AKIAIOSFOSTAGEEXAMPLE staging inventory
  • 16. 16 h4cks best practices we find pretty useful @msales […] roles: - { role: facts, tags: [ 'always','facts' ] } - { role: commonsetup, tags: [ 'commonsetup' ] } - { role: php5, tags: [ 'php5','webstack'] } - { role: nginx, tags: [ 'nginx','webstack']} - { role: monitoring, tags: [ 'monitoring'] } - { role: telegraf, tags: [ 'monitoring'] } […] use (special) tags in playbooks and tasks
  • 17. 17 h4cks best practices we find pretty useful @msales me@server:~# tree shared_roles/aws_dict/ shared_roles/aws_dict/ └── vars └── main.yml use an (almost) empty shared role for frequently used vars
  • 18. 18 wait, you were working with servers? deployment cloud monitoring docker vagrant what do you use ansible for? help me, audience! ansible is not for servers only
  • 19. 19 - name: '"let's try tower" uri: url=https://www.ansible.com/tower when: geek is not defined ansible only for geeks like us? -> www.ansible.com/tower actually, there are some pretty cool features for geeks, too.
  • 20. 20 Thanks. msales GmbH Haid-und-Neu-Str. 18, 76131 Karlsruhe Germany info@msales.com www.msales.com +49 721 91138 0 follow us @msalestech repository url: https://github.com/msales/ansible-talk