108
1 #Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

Embed Size (px)

Citation preview

Page 1: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

1 #Dynatrace

QCon London 2015

Martin Etmajer, Technology Strategist @ Dynatrace

Deploying On-Prem as SaaSWhy we go with Ansible

Page 2: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

2 #Dynatrace

Martin EtmajerTechnology Strategist @Dynatrace

[email protected]

@metmajer

http://blog.dynatrace.com

Page 3: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

3 #Dynatrace

Agenda» Dynatrace On-Prem

» Dynatrace SaaS Architecture

» Ansible as Orchestration Engine

» Test-Driven Infrastructure with Test Kitchen

Page 4: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

4 #Dynatrace

Dynatrace

Page 5: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

5 #Dynatrace

Dynatrace On-Prem Environment

Page 6: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

6 #Dynatrace

Dynatrace On-Prem Environment

Page 7: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

7 #Dynatrace

Dynatrace On-Prem Environment

Page 8: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

8 #Dynatrace

Dynatrace On-Prem Environment

Page 9: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

9 #Dynatrace

Dynatrace On-Prem Environment

Page 10: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

10 #Dynatrace

Dynatrace. So What?

Presentation TierBusiness Logic Tier

Page 11: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

11 #Dynatrace

Dynatrace. So What?

# Requests

Health

Timings

Page 12: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

12 #Dynatrace

Dynatrace. So What?

Frustrated Users

Page 13: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

13 #Dynatrace

Dynatrace. So What?

What happened?

Page 14: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

14 #Dynatrace

Dynatrace. So What?

Erroneous Call Username

SQL Statements

Exception

Page 15: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

15 #Dynatrace

Reasons for Going SaaS

Page 16: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

16 #Dynatrace

Reasons for Going SaaS

#1: Operational RiskMoves from Customer to Service Provider

Page 17: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

17 #Dynatrace

Reasons for Going SaaS

#2: Customers Want SolutionsWithout Buying Extra Infrastructure

Page 18: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

18 #Dynatrace

Reasons for Going SaaS

#3: Customers Already in the Cloud

Page 19: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

19 #Dynatrace

Dynatrace SaaS Architecture

Page 20: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

20 #Dynatrace

On-Prem Dynatrace Environment

Page 21: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

21 #Dynatrace

Dynatrace SaaS Environment

Page 22: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

22 #Dynatrace

Dynatrace SaaS Environment

Page 23: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

23 #Dynatrace

Dynatrace SaaS Environment

Page 24: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

24 #Dynatrace

for Dynatrace SaaS

Elastic Compute Cloud (EC2)

Page 25: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

25 #Dynatrace

for Dynatrace SaaS

Elastic Block Store (EBS)

Page 26: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

26 #Dynatrace

for Dynatrace SaaS

Relational Database Service (RDS)

Page 27: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

27 #Dynatrace

for Dynatrace SaaS

Elastic IP (EIP)

Page 28: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

28 #Dynatrace

for Dynatrace SaaS

Route 53 (DNS)

Page 29: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

29 #Dynatrace

for Dynatrace SaaS

Simple Storage Service (S3)

Page 30: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

30 #Dynatrace

for Dynatrace SaaS

CloudWatch

Page 31: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

31 #Dynatrace

Design Decisions

Page 32: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

32 #Dynatrace

#1 – Dedicated Customer Resources

Clean Separation of Customers & Data

Page 33: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

33 #Dynatrace

#1 – Dedicated Customer Resources

Customizable SecurityIP-Based Access Rules

Page 34: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

34 #Dynatrace

#1 – Dedicated Customer Resources

Grow with the CustomerResize Resources on Demand

Page 35: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

35 #Dynatrace

#2 – Data Persistence

Prevent Data Loss When Resources Go Down

Page 36: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

36 #Dynatrace

#3 – Regular Backups

Enable < Daily Data RecoveryAll Configuration and Data

Page 37: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

37 #Dynatrace

Orchestration Platform

Page 38: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

38 #Dynatrace

Orchestration Platform

Page 39: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

39 #Dynatrace

Orchestration Platform

Page 40: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

40 #Dynatrace

Orchestration Platform

Page 41: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

41 #Dynatrace

How We Did ItLessions Learned

Page 42: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

42 #Dynatrace

We Coded Our Own Solution

#1: Lifecycle Management of Resources

Page 43: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

43 #Dynatrace

We Coded Our Own Solution

#2: Use-Cases

Page 44: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

44 #Dynatrace

We Coded Our Own Solution

#3: Monitoring

Page 45: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

45 #Dynatrace

We Coded Our Own Solution

Extensive Testing

Too much Manual Work Involved

Large Codebase, Tied to Single Vendor

Page 46: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

46 #Dynatrace

We Coded Our Own Solution

Page 47: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

47 #Dynatrace

Hey, Ansible!

Page 48: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

48 #Dynatrace

Ansible is a radically simple IT automation engine for

» environment and infrastructure provisioning

» configuration management

» application deployment

» etc.

What is Ansible?

Page 49: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

49 #Dynatrace

“I wrote Ansible because none of the existing tools fit my brain. I wanted a tool that I could not use for 6 months, come back later, and still remember how it worked.”Michael DeHaan, Ansible Founder

“We need to do a rolling deployment of changes that have certain dependencies (including external services).With Ansible this becomes trivial.Puppet on the other hand feels like the Wild West.”User IUseRhetoric on reddit.com

Why Yet Another Tool?

Page 50: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

50 #Dynatrace

» No Agents ✓

» No Scripting ✓

» Simple and Powerful ✓

Ansible Design Principles

Page 51: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

51 #Dynatrace

Agent-Based Architecture

Page 52: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

52 #Dynatrace

Agent-Based Architecture

Page 53: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

53 #Dynatrace

Agent-Based Architecture

Page 54: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

54 #Dynatrace

Ansible’s Agentless Architecture

Page 55: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

55 #Dynatrace

Ansible’s Agentless Architecture

Page 56: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

56 #Dynatrace

Ansible’s Agentless Architecture

Page 57: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

57 #Dynatrace

Ansible’s Agentless Architecture

Page 58: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

58 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 59: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

59 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 60: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

60 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 61: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

61 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 62: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

62 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 63: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

63 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 64: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

64 #Dynatrace

Ansible is an Orchestration Engine. So What?

Page 65: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

65 #Dynatrace

Ansible for the Cloud

Page 66: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

66 #Dynatrace

Ansible Cloud Modules

Page 67: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

67 #Dynatrace

Ansible Cloud Modules

Page 68: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

68 #Dynatrace

Ansible Cloud Modules for Amazon

Page 69: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

69 #Dynatrace

Ansible Concepts: Inventories

Page 70: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

70 #Dynatrace

» Ansible provisions groups of servers at once

» Groups and hosts are defined in inventories

» Use inventories for staging, production, etc.

Static vs. Dynamic Inventories

» Static: text files expressed in an INI-like format

» Dynamic: Python scripts for dynamic environments (cloud)

» Static + Dynamic: combine multiple inventories (hybrid cloud)

Ansible Inventories

Page 71: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

71 #Dynatrace

Example: Static Inventory# file: production

[balancers]www.example.com

[webservers]www[0-9].example.com

[dbservers]db[a:f].example.com

[monitoring]dynatrace.example.com

GroupHost

Numeric Range

Alphabetic Range

Page 72: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

72 #Dynatrace

Python scripts that get data from dynamic sources such as:

» Cloud: Amazon, DigitalOcean, Google, OpenShift, OpenStack, etc.

» Distributed Information Services: LDAP, etcd, etc.

Dynamic Inventories

Page 73: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

73 #Dynatrace

Ansible Concepts: Playbooks

Page 74: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

74 #Dynatrace

Ansible Playbooks$> ansible-playbook [–i <inventory>] <playbook.yml>

What is a Playbook?

» Describes policies your managed machines shall enforce

» Consist of vars, tasks, handlers, files, templates and roles

» Expressed in the YAML format (dictionaries, lists and scalars)

Page 75: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

75 #Dynatrace

Example: Ansible Playbook--- # file: webservers.yml- hosts: webservers handlers: - name: reload apache2 service: name=apache2 state=reloaded tasks: - name: Install Apache HTTP Server apt: name=apache2 update_cache=yes - name: Install Apache Modules apache2_module: name={{ item }} state=present with_items: - proxy - proxy_httpd notify: reload apache2 remote_user: deploy sudo: yes

Play

Module Arguments

Variable

Notify Handler

Page 76: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

76 #Dynatrace

Example: Ansible Playbook--- # file: playbook.yml- include: balancers.yml- include: webservers.yml- include: dbservers.yml- include: monitoring.yml

Page 77: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

77 #Dynatrace

Example: Ansible Playbook$> ansible-playbook –i production webservers.yml

PLAY [webservers]*******************************************************TASK: [Install Apache HTTP Server]*******************************************************changed: [www0.example.com]changed: [www1.example.com]...

PLAY RECAP *******************************************************web0.example.com: ok=3 changed=3 unreachable=0 failed=0 web1.example.com: ok=3 changed=3 unreachable=0 failed=0...

Page 78: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

78 #Dynatrace

Ansible Concepts: Roles

Page 79: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

79 #Dynatrace

Ansible Roles» Are the best way to organize a playbook!

» Structure content into related vars, tasks, files, handlers, etc.

» File structure for automated inclusion of role-specific content

» Roles can be shared and pulled from Ansible Galaxy, GitHub, etc.

Page 80: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

80 #Dynatrace

Ansible Roles: File Structureansible.cfg

production

staging

webservers.yml

roles/

common/

defaults/

files/

handlers/

meta/

tasks/

templates/

vars/

apache2/

...

Page 81: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

81 #Dynatrace

Example: Ansible Playbook--- # file: webservers.yml- hosts: webservers roles: - { role: common } - { role: apache2 } remote_user: deploy sudo: yes

Page 82: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

82 #Dynatrace

Ansible: Our Use-Cases

Page 83: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

83 #Dynatrace

Use-Case #1Create Dynatrace AMI

Page 84: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

84 #Dynatrace

#1 – Create Dynatrace AMI

#1: Remove Existing Dynatrace AMI

Page 85: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

85 #Dynatrace

#1 – Create Dynatrace AMI

#2: Launch Builder Instance

Page 86: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

86 #Dynatrace

#1 – Create Dynatrace AMI

#3: Add Persistent Volumes

Page 87: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

87 #Dynatrace

#1 – Create Dynatrace AMI

#4: Install Dynatrace

Page 88: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

88 #Dynatrace

#1 – Create Dynatrace AMI

#5: Bundle Dynatrace AMI

Page 89: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

89 #Dynatrace

#1 – Create Dynatrace AMI

#6: Register Dynatrace AMI

Page 90: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

90 #Dynatrace

#1 – Create Dynatrace AMI

#7: Clean Up Temporary Resources

Page 91: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

91 #Dynatrace

Use-Case #2Create Dynatrace Instance

Page 92: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

92 #Dynatrace

#2 – Launch Dynatrace Instance

#1: Get Dynatrace AMI ID

Page 93: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

93 #Dynatrace

#2 – Launch Dynatrace Instance

#2: Launch Dynatrace Instance

Page 94: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

94 #Dynatrace

#2 – Launch Dynatrace Instance

#3: Associate Static IP

Page 95: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

95 #Dynatrace

#2 – Launch Dynatrace Instance

#4: Associate Domain Name

Page 96: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

96 #Dynatrace

#2 – Launch Dynatrace Instance

#5: Launch Database Instance

Page 97: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

97 #Dynatrace

Use-Case #3Deploy Dynatrace Agents

Page 98: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

98 #Dynatrace

Dynatrace On-Prem Environment

Page 99: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

99 #Dynatrace

Test-Driven Infrastructurewith Test KitchenBecause your Infrastructure deserves tests, too!

Page 100: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

100 #Dynatrace

What is Test Kitchen?Test Kitchen allows you to test your infrastructure as code

» on multiple platforms in isolation

» supporting a wide range of drivers

» with support for various provisioners

» by using a variety of testing frameworks

» in a pluggable architecture

CentOS, Debian, Fedora, etc.

Vagrant, Docker, EC2, etc.

Ansible, Chef, Puppet

bash, Cucumber, Serverspec, etc.

extend as desired!

Page 101: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

101 #Dynatrace

Test Kitchen: Configure--- # file: .kitchen.ymlprovisioner: name: ansible_playbook require_ansible_repo: true

driver: name: vagrant customize: cpus: 2 memory: 2048 cpuexecutioncap: 50

platforms: # Opscode vagrant boxes: http://www.vagrantbox.es/ - name: centos-6.5 - name: ubuntu-12.04

suites: - name: dynatrace-agents - name: dynatrace-server

your test suites here!

Page 102: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

102 #Dynatrace

Test Kitchen: Ansible Playbook# file: test/integration/dynatrace-server/default.yml

---- hosts: all roles: - role: Dynatrace-Server foo: bar remote_user: vagrant

define a particular role under test

Page 103: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

103 #Dynatrace

Test Kitchen: Serverspec# file: test/integration/dynatrace-server/serverspec/spec.rb

require 'serverspec’...

describe user('dynatrace') do it { should exist } it { should belong_to_group 'dynatrace' }end

describe service('dynaTraceServer') do it { should be_enabled } it { should be_running }end

describe port(2021) do it { should be_listening }end

declare your assumptions

Page 104: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

104 #Dynatrace

Test Kitchen: List Instances$> kitchen list

Instance Driver Provisionerdynatrace-agents-centos-65 Vagrant AnsiblePlaybookdynatrace-agents-ubuntu-1204 Vagrant AnsiblePlaybookdynatrace-server-centos-65 Vagrant AnsiblePlaybookdynatrace-server-ubuntu-1204 Vagrant AnsiblePlaybook...

let’s test dynatrace-server* !

Page 105: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

105 #Dynatrace

Test Kitchen: Test Instances$> kitchen test dynatrace-server

-----> Starting Kitchen (v1.3.1)-----> Cleaning up any prior instances of <dynatrace-server-centos-65> ...-----> Creating <dynatrace-server-centos-65>... Bringing machine 'default' up with 'virtualbox' provider... ... Finished in 0.6908 seconds (files took 0.74047 seconds to load) 24 examples, 0 failures

-----> Starting Kitchen (v1.3.1)-----> Cleaning up any prior instances of <dynatrace-server-ubuntu-1204> ...-----> Creating <dynatrace-server-ubuntu-1204>... Bringing machine 'default' up with 'virtualbox' provider... ... Finished in 0.6947 seconds (files took 0.82016 seconds to load) 24 examples, 0 failures

Page 106: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

106 #Dynatrace

Questions?

Page 107: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

107 #Dynatrace

Page 108: 1#Dynatrace QCon London 2015 Martin Etmajer, Technology Strategist @ Dynatrace Deploying On-Prem as SaaS Why we go with Ansible

108 #Dynatrace