SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Modern Infrastructure Automation
Modern Infrastructure AutomationModern Infrastructure Automation
Modern Infrastructure Automation
 
How to implement DevOps in your Organization
How to implement DevOps in your OrganizationHow to implement DevOps in your Organization
How to implement DevOps in your Organization
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Azure DevOps
Azure DevOpsAzure DevOps
Azure DevOps
 
GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)
 
CI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cdCI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cd
 
Managing Infrastructure as a Product - Introduction to Platform Engineering
Managing Infrastructure as a Product - Introduction to Platform EngineeringManaging Infrastructure as a Product - Introduction to Platform Engineering
Managing Infrastructure as a Product - Introduction to Platform Engineering
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCD
 
GitOps and ArgoCD
GitOps and ArgoCDGitOps and ArgoCD
GitOps and ArgoCD
 
Kubeflow
KubeflowKubeflow
Kubeflow
 
The what, why and how of knative
The what, why and how of knativeThe what, why and how of knative
The what, why and how of knative
 
CI CD Basics
CI CD BasicsCI CD Basics
CI CD Basics
 
Azure DevOps
Azure DevOpsAzure DevOps
Azure DevOps
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
DevOps-as-a-Service: Towards Automating the Automation
DevOps-as-a-Service: Towards Automating the AutomationDevOps-as-a-Service: Towards Automating the Automation
DevOps-as-a-Service: Towards Automating the Automation
 
Knative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and OpenshiftKnative, Serverless on Kubernetes, and Openshift
Knative, Serverless on Kubernetes, and Openshift
 
Building Immutable Machine Images with Packer and Ansible
Building Immutable Machine Images with Packer and AnsibleBuilding Immutable Machine Images with Packer and Ansible
Building Immutable Machine Images with Packer and Ansible
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Terraform GitOps on Codefresh
Terraform GitOps on CodefreshTerraform GitOps on Codefresh
Terraform GitOps on Codefresh
 

Similar a Automated Deployments

Continuous delivery applied
Continuous delivery appliedContinuous delivery applied
Continuous delivery applied
Mike McGarr
 
Nginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceNginx performance monitoring with Dynatrace
Nginx performance monitoring with Dynatrace
Harald Zeitlhofer
 

Similar a 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
 

Más de Martin Etmajer

Más de 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
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Último (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

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

Notas del editor

  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.