SlideShare a Scribd company logo
1 of 107
Automated Deployments – Hands-On 
Orlando, October 2014 
Martin Etmajer 
martin.etmajer@dynatrace.com 
Senior Technology Strategist @ Dynatrace 
1 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
image here “ Martin Etmajer 
Insert headshot 
Senior Technology Strategist @ Dynatrace 
martin.etmajer@dynatrace.com 
@metmajer 
2 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
From Continuous Integration to 
Continuous Delivery 
3 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Integration 
4 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Integration 
5 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Integration 
6 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Integration 
7 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
8 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
9 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
10 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
11 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ 
12 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ 
13 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ ✔ 
14 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ ✔ 
15 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ ✔ ✔ 
16 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ ✔ ✔ 
17 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Continuous Delivery Build Pipeline 
✔ 
✔ 
✔ ✔ ✔ 
18 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Introduction to 
Automated Deployments 
19 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Motivation 
Production environments are often grown “works of art”: 
» Not entirely reproducible 
» Manual changes applied whenever needed 
» Not even similar to the environments developers have 
“Works on my machine.” 
20 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Automation 
21 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Automation 
Makes provisioning a repeatable, low-risk “push-button” activity 
» By providing executable specifications 
» No manual changes involved (regarded immutable) 
» The process is tested with each execution (builds confidence) 
Recreate 
Environments 
22 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Automation 
Makes provisioning an engineering discipline: 
» Iteratively plan, code, test and verify 
» Open to frequently changing requirements (agile) 
Helps align efforts between Development and Operations: 
» Jointly define desired environmental states 
» Integrate and respect each others processes 
23 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Implement 
and test Verification 
DEVELOPMENT 
OPERATIONS 
Benefits: Automation 
current iteration 
(2 weeks) 
time 
Planning 
24 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Automation 
Allows the provisioning process to be integrated into the Continuous Delivery build 
pipeline (build automation server): 
» Environments can be provisioned multiple times a day 
» When the process fails in staging, the release candidate is discarded - the production 
environment will not be harmed 
25 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Automation 
Reduces the risks of software releases by providing a consistent process for all staging 
and production environments 
Risks? 
» Differing library versions 
» Differing middleware configurations 
» Differing environmental variables in the OS 
» Differing number of max. open file handles in the OS,… 
26 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Auditability 
27 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Auditability 
What, who, why and when? 
» Keep all (executable) specifications in VCS 
» Provide meaningful commit messages (changelog) 
» Build history tells you which revision got deployed 
“Infrastructure as Code” 
28 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Repeatability 
29 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Repeatability 
Establishes a process that is repeatable at any time: 
» Environments are no longer in the hands of single people 
» Any (authorized) person could recreate the environments 
» Requires command execution to be idempotent 
30 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Benefits: Repeatability 
Allows for testability of the deployment process: 
» Failures will be caught early-on in the process 
What if something breaks? 
» Caught a bug: use a version that is known to work 
» Hardware failure: redeploy environment in minutes 
Minimizes MTTR 
31 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Deployment Automation Solutions: 
Agent-based vs. Agentless 
32 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Solutions 
33 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Deployments (Chef, Puppet) 
34 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Deployments (Chef, Puppet) 
35 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Deployments (Chef, Puppet) 
36 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Deployments (Chef, Puppet) 
» Can be used in client-server or client-only modes 
» Client must be installed on each host to be provisioned 
» Clients have dependencies: Ruby 
37 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agent-Based Deployments 
Puppet 
» Written and extensible in Ruby (comes with a DSL) 
» Order of statement does not specify order of execution 
» Huge ecosystem (PuppetDB, MCollective, Hiera) 
» Large entrance barrier 
38 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Solutions 
39 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Deployments (Ansible) 
40 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Deployments (Ansible) 
41 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Deployments (Ansible) 
42 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Deployments (Ansible) 
43 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Agentless Deployments 
Ansible 
» Written and extensible (Python) 
» Human- and machine-readable configuration (YAML) 
» No boot-strapping required on deployment hosts (SSH) 
» Simple, easy to ramp up with (think of new employees!) 
» Clear and concise documentation 
44 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Hands-On Training: Environment 
45 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Sample Environment 
Web Server Frontend 
Application Server 
Backend 
Application Server 
Database 
check out deploy 
VCS Build Automation 
46 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Sample Environment 
Apache Apache Tomcat Apache Tomcat PostgreSQL 
Web Server Frontend 
Application Server 
Backend 
Application Server 
Database 
Git 
VCS 
Jenkins 
check out deploy 
Build Automation 
47 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Use Case: Deploy Dynatrace Agents 
Apache Apache Tomcat Apache Tomcat PostgreSQL 
Web Server Frontend 
Application Server 
Backend 
Application Server 
Database 
Git 
VCS 
Jenkins 
check out deploy 
Build Automation 
48 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Use Case: Deploy Dynatrace Agents 
Apache Apache Tomcat Apache Tomcat PostgreSQL 
Web Server Frontend 
Application Server 
Backend 
Application Server 
Database 
Git 
VCS 
Jenkins 
check out deploy 
Build Automation 
Dynatrace Server 
49 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Hands-On Training: Environment 
50 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Today you will learn how to automatically... 
1. Inject dynaTrace Agents into Apache Tomcats 
2. Load database data into PostgreSQL 
3. Integrate all this into Jenkins 
51 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible: Core Concepts 
52 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: 
Inventories 
53 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Inventories 
» Ansible provisions groups of servers at once 
» Groups and hosts are stored in inventory files 
» An inventory file is expressed in a simple INI format 
» Default location: /etc/ansible/hosts 
» bit.ly/ansible-inventory 
54 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Inventories 
[frontends] 
frontend.example.com 
[backends] 
backend.example.com 
[frontends:vars] 
dt_agent_name=frontend 
Group 
Variables Variable 
[backends:vars] 
dt_agent_name=backend 
Group 
Host 
55 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: 
Ad-hoc Commands 
56 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Ad-hoc Commands 
ansible <host-pattern> [options] 
Module Arguments 
Examples? 
» ansible localhost -m copy –a ‘src=/usr/bin/a dest=/usr/bin/b’ 
» ansible appservers –a ‘/sbin/reboot’ –f 10 
» ansible appservers –a ‘/sbin/reboot’ –f 10 
–u deploy ––sudo ––ask–sudo–pass 
57 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Ad-hoc Commands 
ansible <host-pattern> [options] 
Examples? 
Forks 
» ansible localhost -m copy –a ‘src=/usr/bin/a dest=/usr/bin/b’ 
» ansible appservers –a ‘/sbin/reboot’ –f 10 
» ansible appservers –a ‘/sbin/reboot’ –f 10 
–u deploy ––sudo ––ask–sudo–pass 
58 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Ad-hoc Commands 
ansible <host-pattern> [options] 
Examples? 
» ansible localhost -m copy –a Ask ‘src=/password 
usr/bin/a dest=/usr/bin/b’ 
» User Use sudo 
ansible appservers –a ‘/sbin/reboot’ interactively 
–f 10 
» ansible appservers –a ‘/sbin/reboot’ –f 10 
–u deploy ––sudo ––ask–sudo–pass 
59 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
60 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
ansible-playbook [–i <inventory>] <playbook> 
Playbooks 
» Describe policies your remote systems shall enforce 
» Consist of variables, tasks, handlers, files and roles 
» Are expressed in the YAML format 
» bit.ly/ansible-playbook 
61 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Excursion to YAML 
YAML (YAML Ain’t No Markup Language): Motivation 
» “All data structures can be expressed via dicts, lists and scalars” 
» Simplicity makes it much easier to read and parse than XML 
62 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Dictionaries 
--- # Block 
name: Michael Jordan 
age: 34 
--- # Inline 
{ name: Michael Jordan, age: 34 } 
63 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Dictionaries 
--- # Block 
name: Michael Jordan 
age: 34 
--- # Inline 
{ name: Michael Jordan, age: 34 } 
Document 
64 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Dictionaries 
--- # Block 
name: Michael Jordan 
age: 34 
--- # Inline 
{ name: Michael Jordan, age: 34 } 
key: value 
Same 
Indentation 
level 
65 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Dictionaries 
--- # Block 
name: Michael Jordan 
age: 34 
Comment 
Optional quotes 
for Strings 
--- # Inline 
{ name: Michael Jordan, age: 34 } 
66 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Lists 
--- # Block 
- milk 
- bread 
- butter 
--- # Inline 
[milk, bread, butter] 
67 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Lists 
--- # Block 
- milk 
- bread 
- butter 
--- # Inline 
[milk, bread, butter] 
Items start with 
hyphen + space 
68 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Lists 
--- # Block 
- milk 
- bread 
- butter 
--- # Inline 
[Smaimlke, bread, butter] 
indentation 
level 
69 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Complex 
--- 
men: 
- { name: Jimi Hendrix, year: 1970 } 
- { name: Jim Morrison, year: 1971 } 
women: 
- { name: Janis Joplin, year: 1970 } 
- { name: Amy Winehouse, year: 2011 } 
70 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Complex 
List 
--- 
men: 
- { name: Jimi Hendrix, year: 1970 } 
- { name: Jim Morrison, year: 1971 } 
women: 
- { name: Janis Joplin, year: 1970 } 
- { name: Amy Winehouse, year: 2011 } 
Dictionary 
71 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
YAML Excursion » Complex 
Dictionary 
--- 
men: 
- { name: Jimi Hendrix, year: 1970 } 
- { name: Jim Morrison, year: 1971 } 
women: 
- { name: Janis Joplin, year: 1970 } 
- { name: Amy Winehouse, year: 2011 } 
List 
72 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
--- # appservers.yml 
- hosts: frontends:backends 
vars_files: 
- variables.yml 
handlers: 
- name: restart tomcat 
Play 
service: name=tomcat state=restarted 
tasks: 
- name: Inject dynaTrace Java agent into Apache Tomcat 
template: > 
src=templates/tomcat-setenv.sh 
dest={{ tomcat_home }}/bin/setenv.sh 
notify: restart tomcat 
remote_user: deploy 
sudo: yes 
73 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
# production 
[frontends] 
frontend.example.com 
[backends] 
backend.example.com 
[frontends:vars] 
dt_agent_name=frontend 
[backends:vars] 
dt_agent_name=backend 
74 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
# templates/tomcat-setenv.sh 
CATALINA_OPTS="$CATALINA_OPTS  
-agentpath:{{ dt_agent_dir }}/libdtagent.so 
=name={{ dt_agent_name }},collector={{ dt_collector_url }}" 
75 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
--- # variables.yml 
tomcat_home: /opt/tomcat 
dt_agent_dir: /opt/dynatrace/agents 
dt_collector_url: dynatrace.example.com 
76 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
ansible-playbook –i production appservers.yml 
Run! 
PLAY [frontends:backends] 
****************************************************** 
TASK: [Inject dynaTrace Java agent into Apache Tomcat] 
************************ 
changed: [backend.example.com] 
changed: [frontend.example.com] 
PLAY RECAP 
************************************************************************ 
backend.example.com : ok=1 changed=1 unreachable=0 failed=0 
frontend.example.com : ok=1 changed=1 unreachable=0 failed=0 
77 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks 
--- # playbook.yml 
- include: appservers.yml 
- include: dbservers.yml 
- include: webservers.yml 
Includes multiple plays 
into a single playbook 
78 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Usage 
» {{ foo }} 
» {{ foo[i] }} 
» {{ foo.bar }} 
» Hello, my name is {{ foo }} 
» bit.ly/ansible-variables 
79 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
80 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
Forces ‘foo’ to be defined 
81 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
Defaults ‘foo’ to 0 if undefined 
82 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
Computes the minimum in ‘list’ 
83 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
Computes distinct values in ‘list’ 
84 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Advance Usage 
» {{ foo | mandatory }} 
» {{ foo | default(0) }} 
» {{ list| min }} 
» {{ list| unique }} 
» {{ list1 | union(list2) }} 
» bit.ly/ansible-variables 
Computes a join of lists ‘list1 and ‘list2’ 
85 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
Validity 
» Valid: ‘foo_bar’, ‘foo5’ 
» Invalid: ‘foo-bar’, ‘foo bar’, ‘foo.bar’, ‘5foo’, ‘5’ 
86 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
--- # playbook.yml 
- hosts: all 
vars: 
- cleanup_home: yes 
- settings: 
ports: 
http: 80 
ssl: 443 
… 
Inlined 
87 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
--- # playbook.yml 
- hosts: all 
vars_files: 
- variables.yml 
… 
--- # variables.yml 
cleanup_home: yes 
settings: 
ports: 
http: 80 
ssl: 443 
Imported 
88 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
--- # playbook.yml 
- hosts: all 
tasks: 
- { include: create-user.yml, user: deploy } 
… 
Defined in 
task inclusion 
89 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
--- # playbook.yml 
- hosts: all 
roles: 
- { role: create-user, user: deploy } 
… 
Defined in 
role inclusion 
90 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Variables 
ansible –e ‘user=deploy’ playbook.yml 
Defined at 
invocation 
91 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Tasks 
Tasks are... 
» invocations of Ansible modules 
» the units that do the actual deployment and configuration 
» bit.ly/ansible-module 
92 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Tasks 
Example: Install package ‘apache2’ 
--- # webservers.yml 
- hosts: webservers 
tasks: 
- name: Install package ‘apache2’ 
apt: pkg=apache2 state=latest update_cache: yes 
93 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Tasks 
Example: Copy file from src (localhost) to dest (remote host) 
--- # webservers.yml 
- hosts: webservers 
tasks: 
- name: Copy file from ‘foo.conf’ to /etc/default 
copy: > 
src=/srv/files/foo.conf 
dest=/etc/default 
owner=deploy 
group=deploy 
mode=644 
94 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Roles 
» Are the preferred means to organize and reuse related tasks 
» Build on the idea of include files to form clean abstractions 
» bit.ly/ansible-roles 
95 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Reusing Roles in a Play 
--- # webservers.yml 
- hosts: webservers 
roles: 
- { role: common } 
- { role: apache2 } 
remote_user: deploy 
sudo: yes 
96 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
Top-level Playbook 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
97 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
Plays 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
98 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Holds a role named ‘x’ 
99 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Dependencies 
100 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Default variables 
101 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/Files 
main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
102 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Handlers 
103 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Tasks 
104 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml Templates 
105 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
Ansible Concepts: Playbooks » Roles 
Best Practice: Directory Layout for Role-based Playbooks 
playbook.yml 
appservers.yml 
dbservers.yml 
webservers.yml 
/roles/x 
/roles/x/meta/main.yml 
/roles/x/defaults/main.yml 
/roles/x/files 
/roles/x/handlers/main.yml 
/roles/x/tasks/main.yml 
/roles/x/templates/main.yml 
/roles/x/vars/main.yml 
Variables 
106 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
107 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014

More Related Content

What's hot

Azure DevOps CI/CD For Beginners
Azure DevOps CI/CD  For BeginnersAzure DevOps CI/CD  For Beginners
Azure DevOps CI/CD For BeginnersRahul Nath
 
Azure DevOps Presentation
Azure DevOps PresentationAzure DevOps Presentation
Azure DevOps PresentationInCycleSoftware
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and AlertingKhairul Zebua
 
Azure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Azure Pipeline Tutorial | Azure DevOps Tutorial | EdurekaAzure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Azure Pipeline Tutorial | Azure DevOps Tutorial | EdurekaEdureka!
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker IntroductionPeng Xiao
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...Simplilearn
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...SlideTeam
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsGlobalLogic Ukraine
 
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Edureka!
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Megan O'Keefe
 
Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service MeshKnoldus Inc.
 
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Commit University
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github ActionsKnoldus Inc.
 

What's hot (20)

Azure DevOps CI/CD For Beginners
Azure DevOps CI/CD  For BeginnersAzure DevOps CI/CD  For Beginners
Azure DevOps CI/CD For Beginners
 
Azure DevOps Presentation
Azure DevOps PresentationAzure DevOps Presentation
Azure DevOps Presentation
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and Alerting
 
Azure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Azure Pipeline Tutorial | Azure DevOps Tutorial | EdurekaAzure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
Azure Pipeline Tutorial | Azure DevOps Tutorial | Edureka
 
(ARC307) Infrastructure as Code
(ARC307) Infrastructure as Code(ARC307) Infrastructure as Code
(ARC307) Infrastructure as Code
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOps
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service Mesh
 
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Introduction to Github Actions
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
 
"DevOps > CI+CD "
"DevOps > CI+CD ""DevOps > CI+CD "
"DevOps > CI+CD "
 

Similar to Automated Deployments

Introduction to Automated Deployments with Ansible
Introduction to Automated Deployments with AnsibleIntroduction to Automated Deployments with Ansible
Introduction to Automated Deployments with AnsibleMartin Etmajer
 
Continuous Deployment To The Cloud
Continuous Deployment To The CloudContinuous Deployment To The Cloud
Continuous Deployment To The CloudMarcin Grzejszczak
 
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...Marcin Grzejszczak
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with AnsibleMartin Etmajer
 
AzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release ManagementAzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release ManagementSergii Kryshtop
 
Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Mike McGarr
 
Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Marcin Grzejszczak
 
Continuous Delivery Applied (AgileDC)
Continuous Delivery Applied (AgileDC)Continuous Delivery Applied (AgileDC)
Continuous Delivery Applied (AgileDC)Mike McGarr
 
From Iterative to Continuous Delivery, PNSQC 2014
From Iterative to Continuous Delivery, PNSQC 2014From Iterative to Continuous Delivery, PNSQC 2014
From Iterative to Continuous Delivery, PNSQC 2014John Ruberto
 
Continuous Delivery Applied
Continuous Delivery AppliedContinuous Delivery Applied
Continuous Delivery AppliedExcella
 
Continuous Delivery Applied (Agile Richmond)
Continuous Delivery Applied (Agile Richmond)Continuous Delivery Applied (Agile Richmond)
Continuous Delivery Applied (Agile Richmond)Mike McGarr
 
Infrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessInfrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessDynatrace
 
Continuous Deployment of your Application @JUGtoberfest
Continuous Deployment of your Application @JUGtoberfestContinuous Deployment of your Application @JUGtoberfest
Continuous Deployment of your Application @JUGtoberfestMarcin Grzejszczak
 
Continuous delivery applied
Continuous delivery appliedContinuous delivery applied
Continuous delivery appliedMike McGarr
 
Continuous Delivery in the Enterprise, powered by Serena and CloudBees
Continuous Delivery in the Enterprise, powered by Serena and CloudBeesContinuous Delivery in the Enterprise, powered by Serena and CloudBees
Continuous Delivery in the Enterprise, powered by Serena and CloudBeesSerena Software
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous IntegrationZahra Golmirzaei
 
Nginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceNginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceHarald Zeitlhofer
 
Continuous delivery applied (DC CI User Group)
Continuous delivery applied (DC CI User Group)Continuous delivery applied (DC CI User Group)
Continuous delivery applied (DC CI User Group)Mike McGarr
 
Continous integration and delivery for single page applications
Continous integration and delivery for single page applicationsContinous integration and delivery for single page applications
Continous integration and delivery for single page applicationsSunil Dalal
 

Similar to Automated Deployments (20)

Introduction to Automated Deployments with Ansible
Introduction to Automated Deployments with AnsibleIntroduction to Automated Deployments with Ansible
Introduction to Automated Deployments with Ansible
 
Continuous Deployment To The Cloud
Continuous Deployment To The CloudContinuous Deployment To The Cloud
Continuous Deployment To The Cloud
 
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
AzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release ManagementAzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release Management
 
Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)
 
Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017
 
Continuous Delivery Applied
Continuous Delivery AppliedContinuous Delivery Applied
Continuous Delivery Applied
 
Continuous Delivery Applied (AgileDC)
Continuous Delivery Applied (AgileDC)Continuous Delivery Applied (AgileDC)
Continuous Delivery Applied (AgileDC)
 
From Iterative to Continuous Delivery, PNSQC 2014
From Iterative to Continuous Delivery, PNSQC 2014From Iterative to Continuous Delivery, PNSQC 2014
From Iterative to Continuous Delivery, PNSQC 2014
 
Continuous Delivery Applied
Continuous Delivery AppliedContinuous Delivery Applied
Continuous Delivery Applied
 
Continuous Delivery Applied (Agile Richmond)
Continuous Delivery Applied (Agile Richmond)Continuous Delivery Applied (Agile Richmond)
Continuous Delivery Applied (Agile Richmond)
 
Infrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps SuccessInfrastructure Automation How to Use Chef For DevOps Success
Infrastructure Automation How to Use Chef For DevOps Success
 
Continuous Deployment of your Application @JUGtoberfest
Continuous Deployment of your Application @JUGtoberfestContinuous Deployment of your Application @JUGtoberfest
Continuous Deployment of your Application @JUGtoberfest
 
Continuous delivery applied
Continuous delivery appliedContinuous delivery applied
Continuous delivery applied
 
Continuous Delivery in the Enterprise, powered by Serena and CloudBees
Continuous Delivery in the Enterprise, powered by Serena and CloudBeesContinuous Delivery in the Enterprise, powered by Serena and CloudBees
Continuous Delivery in the Enterprise, powered by Serena and CloudBees
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous Integration
 
Nginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceNginx performance monitoring with Dynatrace
Nginx performance monitoring with Dynatrace
 
Continuous delivery applied (DC CI User Group)
Continuous delivery applied (DC CI User Group)Continuous delivery applied (DC CI User Group)
Continuous delivery applied (DC CI User Group)
 
Continous integration and delivery for single page applications
Continous integration and delivery for single page applicationsContinous integration and delivery for single page applications
Continous integration and delivery for single page applications
 

More from Martin Etmajer

Continuous Delivery 101
Continuous Delivery 101Continuous Delivery 101
Continuous Delivery 101Martin Etmajer
 
User Story Mapping 101
User Story Mapping 101User Story Mapping 101
User Story Mapping 101Martin Etmajer
 
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Martin Etmajer
 
Monitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMonitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMartin Etmajer
 
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)Martin Etmajer
 
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecMartin Etmajer
 
(R)Evolutionize APM - APM in Continuous Delivery and DevOps
(R)Evolutionize APM - APM in Continuous Delivery and DevOps(R)Evolutionize APM - APM in Continuous Delivery and DevOps
(R)Evolutionize APM - APM in Continuous Delivery and DevOpsMartin Etmajer
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecMartin Etmajer
 
Deploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with AnsibleDeploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with AnsibleMartin Etmajer
 

More from Martin Etmajer (9)

Continuous Delivery 101
Continuous Delivery 101Continuous Delivery 101
Continuous Delivery 101
 
User Story Mapping 101
User Story Mapping 101User Story Mapping 101
User Story Mapping 101
 
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
 
Monitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMonitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on Kubernetes
 
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)
Monitoring Microservices at Scale on OpenShift (OpenShift Commons Briefing #52)
 
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
 
(R)Evolutionize APM - APM in Continuous Delivery and DevOps
(R)Evolutionize APM - APM in Continuous Delivery and DevOps(R)Evolutionize APM - APM in Continuous Delivery and DevOps
(R)Evolutionize APM - APM in Continuous Delivery and DevOps
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
 
Deploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with AnsibleDeploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with Ansible
 

Recently uploaded

Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 

Recently uploaded (20)

Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 

Automated Deployments

  • 1. Automated Deployments – Hands-On Orlando, October 2014 Martin Etmajer martin.etmajer@dynatrace.com Senior Technology Strategist @ Dynatrace 1 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 2. image here “ Martin Etmajer Insert headshot Senior Technology Strategist @ Dynatrace martin.etmajer@dynatrace.com @metmajer 2 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 3. From Continuous Integration to Continuous Delivery 3 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 4. Continuous Integration 4 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 5. Continuous Integration 5 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 6. Continuous Integration 6 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 7. Continuous Integration 7 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 8. Continuous Delivery Build Pipeline 8 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 9. Continuous Delivery Build Pipeline 9 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 10. Continuous Delivery Build Pipeline ✔ 10 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 11. Continuous Delivery Build Pipeline ✔ 11 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 12. Continuous Delivery Build Pipeline ✔ ✔ 12 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 13. Continuous Delivery Build Pipeline ✔ ✔ 13 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 14. Continuous Delivery Build Pipeline ✔ ✔ ✔ 14 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 15. Continuous Delivery Build Pipeline ✔ ✔ ✔ 15 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 16. Continuous Delivery Build Pipeline ✔ ✔ ✔ ✔ 16 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 17. Continuous Delivery Build Pipeline ✔ ✔ ✔ ✔ 17 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 18. Continuous Delivery Build Pipeline ✔ ✔ ✔ ✔ ✔ 18 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 19. Introduction to Automated Deployments 19 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 20. Motivation Production environments are often grown “works of art”: » Not entirely reproducible » Manual changes applied whenever needed » Not even similar to the environments developers have “Works on my machine.” 20 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 21. Benefits: Automation 21 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 22. Benefits: Automation Makes provisioning a repeatable, low-risk “push-button” activity » By providing executable specifications » No manual changes involved (regarded immutable) » The process is tested with each execution (builds confidence) Recreate Environments 22 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 23. Benefits: Automation Makes provisioning an engineering discipline: » Iteratively plan, code, test and verify » Open to frequently changing requirements (agile) Helps align efforts between Development and Operations: » Jointly define desired environmental states » Integrate and respect each others processes 23 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 24. Implement and test Verification DEVELOPMENT OPERATIONS Benefits: Automation current iteration (2 weeks) time Planning 24 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 25. Benefits: Automation Allows the provisioning process to be integrated into the Continuous Delivery build pipeline (build automation server): » Environments can be provisioned multiple times a day » When the process fails in staging, the release candidate is discarded - the production environment will not be harmed 25 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 26. Benefits: Automation Reduces the risks of software releases by providing a consistent process for all staging and production environments Risks? » Differing library versions » Differing middleware configurations » Differing environmental variables in the OS » Differing number of max. open file handles in the OS,… 26 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 27. Benefits: Auditability 27 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 28. Benefits: Auditability What, who, why and when? » Keep all (executable) specifications in VCS » Provide meaningful commit messages (changelog) » Build history tells you which revision got deployed “Infrastructure as Code” 28 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 29. Benefits: Repeatability 29 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 30. Benefits: Repeatability Establishes a process that is repeatable at any time: » Environments are no longer in the hands of single people » Any (authorized) person could recreate the environments » Requires command execution to be idempotent 30 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 31. Benefits: Repeatability Allows for testability of the deployment process: » Failures will be caught early-on in the process What if something breaks? » Caught a bug: use a version that is known to work » Hardware failure: redeploy environment in minutes Minimizes MTTR 31 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 32. Deployment Automation Solutions: Agent-based vs. Agentless 32 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 33. Agent-Based Solutions 33 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 34. Agent-Based Deployments (Chef, Puppet) 34 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 35. Agent-Based Deployments (Chef, Puppet) 35 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 36. Agent-Based Deployments (Chef, Puppet) 36 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 37. Agent-Based Deployments (Chef, Puppet) » Can be used in client-server or client-only modes » Client must be installed on each host to be provisioned » Clients have dependencies: Ruby 37 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 38. Agent-Based Deployments Puppet » Written and extensible in Ruby (comes with a DSL) » Order of statement does not specify order of execution » Huge ecosystem (PuppetDB, MCollective, Hiera) » Large entrance barrier 38 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 39. Agentless Solutions 39 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 40. Agentless Deployments (Ansible) 40 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 41. Agentless Deployments (Ansible) 41 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 42. Agentless Deployments (Ansible) 42 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 43. Agentless Deployments (Ansible) 43 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 44. Agentless Deployments Ansible » Written and extensible (Python) » Human- and machine-readable configuration (YAML) » No boot-strapping required on deployment hosts (SSH) » Simple, easy to ramp up with (think of new employees!) » Clear and concise documentation 44 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 45. Hands-On Training: Environment 45 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 46. Sample Environment Web Server Frontend Application Server Backend Application Server Database check out deploy VCS Build Automation 46 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 47. Sample Environment Apache Apache Tomcat Apache Tomcat PostgreSQL Web Server Frontend Application Server Backend Application Server Database Git VCS Jenkins check out deploy Build Automation 47 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 48. Use Case: Deploy Dynatrace Agents Apache Apache Tomcat Apache Tomcat PostgreSQL Web Server Frontend Application Server Backend Application Server Database Git VCS Jenkins check out deploy Build Automation 48 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 49. Use Case: Deploy Dynatrace Agents Apache Apache Tomcat Apache Tomcat PostgreSQL Web Server Frontend Application Server Backend Application Server Database Git VCS Jenkins check out deploy Build Automation Dynatrace Server 49 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 50. Hands-On Training: Environment 50 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 51. Today you will learn how to automatically... 1. Inject dynaTrace Agents into Apache Tomcats 2. Load database data into PostgreSQL 3. Integrate all this into Jenkins 51 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 52. Ansible: Core Concepts 52 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 53. Ansible Concepts: Inventories 53 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 54. Ansible Concepts: Inventories » Ansible provisions groups of servers at once » Groups and hosts are stored in inventory files » An inventory file is expressed in a simple INI format » Default location: /etc/ansible/hosts » bit.ly/ansible-inventory 54 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 55. Ansible Concepts: Inventories [frontends] frontend.example.com [backends] backend.example.com [frontends:vars] dt_agent_name=frontend Group Variables Variable [backends:vars] dt_agent_name=backend Group Host 55 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 56. Ansible Concepts: Ad-hoc Commands 56 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 57. Ansible Concepts: Ad-hoc Commands ansible <host-pattern> [options] Module Arguments Examples? » ansible localhost -m copy –a ‘src=/usr/bin/a dest=/usr/bin/b’ » ansible appservers –a ‘/sbin/reboot’ –f 10 » ansible appservers –a ‘/sbin/reboot’ –f 10 –u deploy ––sudo ––ask–sudo–pass 57 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 58. Ansible Concepts: Ad-hoc Commands ansible <host-pattern> [options] Examples? Forks » ansible localhost -m copy –a ‘src=/usr/bin/a dest=/usr/bin/b’ » ansible appservers –a ‘/sbin/reboot’ –f 10 » ansible appservers –a ‘/sbin/reboot’ –f 10 –u deploy ––sudo ––ask–sudo–pass 58 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 59. Ansible Concepts: Ad-hoc Commands ansible <host-pattern> [options] Examples? » ansible localhost -m copy –a Ask ‘src=/password usr/bin/a dest=/usr/bin/b’ » User Use sudo ansible appservers –a ‘/sbin/reboot’ interactively –f 10 » ansible appservers –a ‘/sbin/reboot’ –f 10 –u deploy ––sudo ––ask–sudo–pass 59 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 60. Ansible Concepts: Playbooks 60 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 61. Ansible Concepts: Playbooks ansible-playbook [–i <inventory>] <playbook> Playbooks » Describe policies your remote systems shall enforce » Consist of variables, tasks, handlers, files and roles » Are expressed in the YAML format » bit.ly/ansible-playbook 61 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 62. Excursion to YAML YAML (YAML Ain’t No Markup Language): Motivation » “All data structures can be expressed via dicts, lists and scalars” » Simplicity makes it much easier to read and parse than XML 62 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 63. YAML Excursion » Dictionaries --- # Block name: Michael Jordan age: 34 --- # Inline { name: Michael Jordan, age: 34 } 63 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 64. YAML Excursion » Dictionaries --- # Block name: Michael Jordan age: 34 --- # Inline { name: Michael Jordan, age: 34 } Document 64 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 65. YAML Excursion » Dictionaries --- # Block name: Michael Jordan age: 34 --- # Inline { name: Michael Jordan, age: 34 } key: value Same Indentation level 65 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 66. YAML Excursion » Dictionaries --- # Block name: Michael Jordan age: 34 Comment Optional quotes for Strings --- # Inline { name: Michael Jordan, age: 34 } 66 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 67. YAML Excursion » Lists --- # Block - milk - bread - butter --- # Inline [milk, bread, butter] 67 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 68. YAML Excursion » Lists --- # Block - milk - bread - butter --- # Inline [milk, bread, butter] Items start with hyphen + space 68 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 69. YAML Excursion » Lists --- # Block - milk - bread - butter --- # Inline [Smaimlke, bread, butter] indentation level 69 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 70. YAML Excursion » Complex --- men: - { name: Jimi Hendrix, year: 1970 } - { name: Jim Morrison, year: 1971 } women: - { name: Janis Joplin, year: 1970 } - { name: Amy Winehouse, year: 2011 } 70 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 71. YAML Excursion » Complex List --- men: - { name: Jimi Hendrix, year: 1970 } - { name: Jim Morrison, year: 1971 } women: - { name: Janis Joplin, year: 1970 } - { name: Amy Winehouse, year: 2011 } Dictionary 71 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 72. YAML Excursion » Complex Dictionary --- men: - { name: Jimi Hendrix, year: 1970 } - { name: Jim Morrison, year: 1971 } women: - { name: Janis Joplin, year: 1970 } - { name: Amy Winehouse, year: 2011 } List 72 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 73. Ansible Concepts: Playbooks --- # appservers.yml - hosts: frontends:backends vars_files: - variables.yml handlers: - name: restart tomcat Play service: name=tomcat state=restarted tasks: - name: Inject dynaTrace Java agent into Apache Tomcat template: > src=templates/tomcat-setenv.sh dest={{ tomcat_home }}/bin/setenv.sh notify: restart tomcat remote_user: deploy sudo: yes 73 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 74. Ansible Concepts: Playbooks # production [frontends] frontend.example.com [backends] backend.example.com [frontends:vars] dt_agent_name=frontend [backends:vars] dt_agent_name=backend 74 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 75. Ansible Concepts: Playbooks # templates/tomcat-setenv.sh CATALINA_OPTS="$CATALINA_OPTS -agentpath:{{ dt_agent_dir }}/libdtagent.so =name={{ dt_agent_name }},collector={{ dt_collector_url }}" 75 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 76. Ansible Concepts: Playbooks --- # variables.yml tomcat_home: /opt/tomcat dt_agent_dir: /opt/dynatrace/agents dt_collector_url: dynatrace.example.com 76 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 77. Ansible Concepts: Playbooks ansible-playbook –i production appservers.yml Run! PLAY [frontends:backends] ****************************************************** TASK: [Inject dynaTrace Java agent into Apache Tomcat] ************************ changed: [backend.example.com] changed: [frontend.example.com] PLAY RECAP ************************************************************************ backend.example.com : ok=1 changed=1 unreachable=0 failed=0 frontend.example.com : ok=1 changed=1 unreachable=0 failed=0 77 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 78. Ansible Concepts: Playbooks --- # playbook.yml - include: appservers.yml - include: dbservers.yml - include: webservers.yml Includes multiple plays into a single playbook 78 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 79. Ansible Concepts: Playbooks » Variables Usage » {{ foo }} » {{ foo[i] }} » {{ foo.bar }} » Hello, my name is {{ foo }} » bit.ly/ansible-variables 79 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 80. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables 80 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 81. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables Forces ‘foo’ to be defined 81 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 82. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables Defaults ‘foo’ to 0 if undefined 82 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 83. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables Computes the minimum in ‘list’ 83 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 84. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables Computes distinct values in ‘list’ 84 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 85. Ansible Concepts: Playbooks » Variables Advance Usage » {{ foo | mandatory }} » {{ foo | default(0) }} » {{ list| min }} » {{ list| unique }} » {{ list1 | union(list2) }} » bit.ly/ansible-variables Computes a join of lists ‘list1 and ‘list2’ 85 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 86. Ansible Concepts: Playbooks » Variables Validity » Valid: ‘foo_bar’, ‘foo5’ » Invalid: ‘foo-bar’, ‘foo bar’, ‘foo.bar’, ‘5foo’, ‘5’ 86 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 87. Ansible Concepts: Playbooks » Variables --- # playbook.yml - hosts: all vars: - cleanup_home: yes - settings: ports: http: 80 ssl: 443 … Inlined 87 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 88. Ansible Concepts: Playbooks » Variables --- # playbook.yml - hosts: all vars_files: - variables.yml … --- # variables.yml cleanup_home: yes settings: ports: http: 80 ssl: 443 Imported 88 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 89. Ansible Concepts: Playbooks » Variables --- # playbook.yml - hosts: all tasks: - { include: create-user.yml, user: deploy } … Defined in task inclusion 89 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 90. Ansible Concepts: Playbooks » Variables --- # playbook.yml - hosts: all roles: - { role: create-user, user: deploy } … Defined in role inclusion 90 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 91. Ansible Concepts: Playbooks » Variables ansible –e ‘user=deploy’ playbook.yml Defined at invocation 91 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 92. Ansible Concepts: Playbooks » Tasks Tasks are... » invocations of Ansible modules » the units that do the actual deployment and configuration » bit.ly/ansible-module 92 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 93. Ansible Concepts: Playbooks » Tasks Example: Install package ‘apache2’ --- # webservers.yml - hosts: webservers tasks: - name: Install package ‘apache2’ apt: pkg=apache2 state=latest update_cache: yes 93 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 94. Ansible Concepts: Playbooks » Tasks Example: Copy file from src (localhost) to dest (remote host) --- # webservers.yml - hosts: webservers tasks: - name: Copy file from ‘foo.conf’ to /etc/default copy: > src=/srv/files/foo.conf dest=/etc/default owner=deploy group=deploy mode=644 94 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 95. Ansible Concepts: Playbooks » Roles Roles » Are the preferred means to organize and reuse related tasks » Build on the idea of include files to form clean abstractions » bit.ly/ansible-roles 95 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 96. Ansible Concepts: Playbooks » Roles Reusing Roles in a Play --- # webservers.yml - hosts: webservers roles: - { role: common } - { role: apache2 } remote_user: deploy sudo: yes 96 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 97. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml Top-level Playbook /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml 97 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 98. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml Plays /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml 98 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 99. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Holds a role named ‘x’ 99 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 100. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Dependencies 100 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 101. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Default variables 101 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 102. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/Files main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml 102 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 103. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Handlers 103 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 104. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Tasks 104 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 105. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Templates 105 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 106. Ansible Concepts: Playbooks » Roles Best Practice: Directory Layout for Role-based Playbooks playbook.yml appservers.yml dbservers.yml webservers.yml /roles/x /roles/x/meta/main.yml /roles/x/defaults/main.yml /roles/x/files /roles/x/handlers/main.yml /roles/x/tasks/main.yml /roles/x/templates/main.yml /roles/x/vars/main.yml Variables 106 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014
  • 107. 107 COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE #Perform2014

Editor's Notes

  1. ad “Immutability”: whenever a change needs to be done, the environments are recreated by pushing a button
  2. ad “jointly define”: but driven by development (which is itself driven by product management)
  3. ad “multiple times a day”: some companies do this multiple times per hour even; Cloud-based deployments make this feasible by creating spinning up new environments and let load balancers point to them after have been provisioned
  4. ad “Consistency”: Consistency does not necessarily mean equality; often only a high degree of similarity can be achieved (however, all environments must be created by the same process)
  5. ad “idempotent”: commands in popular hosting automation tools are already implementated that way, so usually this is nothing you need to worry about, unless you with to implement your own; Examples: install a service only if it is not already installed; add a line to some configuration file only if it is not already contained
  6. ad “testability”: building up an automated deployment strategy is not an undertaking that is free of errors; being able to apply a fix and reinitiate the whole process inside a testing environment (that skips all those commands which are already fulfilled) greatly improves development speed MTTR = Mean Time to Recover / Mean Time to Repair
  7. There are a variety of deployment automation tools out there. But how to choose a deployment solution that is right for you? Maybe a differentiation between agent-based vs. agentless architectures can help you make a decision.
  8. Note: terms “agent” and “client” are used interchangeably
  9. Note: terms “agent” and “client” are used interchangeably
  10. Note: terms “agent” and “client” are used interchangeably
  11. ad “client must be installed”: how do you get them there (often done manually)? client may also require an update once in a while
  12. ad “written in Ruby”: consequently has Ruby as a dependency, problematic in mixed environments (AIX, BSD, Unix, etc.) ad “order of statements”: in Puppet you specify the desired end state, Puppet decides on its own how to get there ad “large entrance barrier”: takes a long time for new hires to ramp up and understand existing specifications “As a user has claimed on reddit.com, there seem to be version incompatibilities with PuppetDB (PuppetDB requires client nodes to install a “PuppetDB terminus” plugin), which have prevented this user from upgrading older environments easily. Usually, this is not something that you would consider when evaluating a tool. Clearly, having to rely on agents can have its disadvantages. Let’s look at a different approach.”
  13. Ad-hoc commands are a great way to test commands on the command line, however, for real server orchestration, there’s a much more powerful concept: Ansible Playbooks.
  14. Ad-hoc commands are a great way to test commands on the command line, however, for real server orchestration, there’s a much more powerful concept: Ansible Playbooks.
  15. Ad-hoc commands are a great way to test commands on the command line, however, for real server orchestration, there’s a much more powerful concept: Ansible Playbooks.
  16. ad “read and parse”: most computer languages already have dicts, lists and scalar types (String, Number, etc.) built in. XML goes a different way here.
  17. “There are a couple of things to identify here.”
  18. “There are a couple of things to identify here.”
  19. “There are a couple of things to identify here.”
  20. Everything you see here is executed in order. ad “play”: A play maps a group of hosts to a set of tasks. By composing a playbook of multiple plays, it is possible to orchestrate multi-server deployments: run certain tasks on the group of webservers, then some tasks on the group of dbservers, then some more commands back on the webservers group, etc.
  21. “So, let’s install a package.”
  22. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  23. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  24. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  25. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  26. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  27. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  28. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  29. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  30. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.
  31. ad “dependencies”: Role dependencies allow you to transitively pull in other roles, e.g. a -> b -> c ad “default variables”: Role default variables allow you to define default variables for included and dependent roles. These variables have the lowest priority and can thus be overridden easily. ad “files”: Placing files within a role comes with great convenience: copy and script tasks can reference files relatively to this folder ad “templates”: Templates are similar to files with the difference that variables will be replaced in templates. They are then processed with the template tasks and locations can be referenced relatively to this folder. ad “variables”: Variables placed in here will be added to the play. They override any default variables.