SlideShare a Scribd company logo
1 of 23
Who are we?
Jim Vanns
Aaron Carey
Production Engineers at ILM London
What we’re covering
● Deploying a Mesos cluster in the cloud using
Ansible
● Running services on Mesos using Ansible
● Differences between AWS/GCE modules
● Tips we’ve learnt along the way
Step 1:
Ansible Dockerfile (example follows)
Fix the ansible version
Install a custom dynamic inventory file (or two)
Consider your credentials and security
Install (bake-in a ‘git archive’) your playbooks
Concise Ansible Dockerfile
FROM ubuntu:14.04
RUN apt-get update && apt-get -y install python python-pip python-dev
RUN pip install -U ansible==1.9.4 boto apache-libcloud httplib2
ADD ansible.cfg /etc/ansible/ansible.cfg
ADD ec2.py /etc/ansible/ec2.py
ADD ec2.ini /etc/ansible/ec2.ini
ADD gce.py /etc/ansible/gce.py
ADD gce.ini /etc/ansible/gce.ini
WORKDIR /srv/ansible
ADD ansible .
Step 2: Deploy cloud hosts
Requirements
Cloud Agnostic (Work with both AWS and GCE)
Split provisioning and bootstrapping into roles
Need a way to determine which are new hosts
Need a way to group hosts during and after provisioning
Tagging!
Cloud Start Role
# Launch the primary (master/leader) nameserver
- name: Launch a bootstrap consul server
hosts: localhost
connection: local
gather_facts: False
vars:
cloud_provider: ec2
count: 3
service_name: Consul
launch_group: tag_consul_server_{{ consul_domain }}
tags:
consul: server_{{ consul_domain }}
roles:
- cloud_start
Cloud Start Role
---
- include: "{{ cloud_provider }}.yml"
Cloud Start Role
- name: Launch instance
ec2:
key_name: "{{ key_name }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
wait: yes
vpc_subnet_id: "{{ vpc_subnet_id }}"
group_id: "{{ security_group_id }}"
region: "{{ region }}"
instance_tags:
ansible: base
count: "{{ count }}"
assign_public_ip: "{{ public_ip }}"
register: ec2
- name: Add instances to launched group
add_host: hostname={{ item.private_ip }} groupname=launched_cloud_default
with_items: ec2.instances
- name: Add instances to parameter group
add_host: hostname={{ item.private_ip }} groupname={{ launch_group }}
with_items: ec2.instances
Cloud Start Role
- name: Tag instances
ec2_tag: resource={{item.id}} state=present region={{region}}
with_items: ec2.instances
args:
tags:
"{{ tags }}"
- name: Wait for sshd to come up
wait_for: host={{ item.private_ip }}
port=22
state=started
delay=60
timeout=300
connect_timeout=2
with_items: ec2.instances
Taking it further...
Parallelise the provisioning
Take advantage of host groups where you can
Use ansible environment variables to target hosts and groups
AWS vs GCE
AWS - Tags are key-value pairs
GCE - Tags are string labels, Metadata are key-value pairs
We used a custom (slightly modified) GCE inventorytags = node.extra['tags']
for t in tags:
tag = 'tag_%s' % t
if groups.has_key(tag): groups[tag].append(name)
else: groups[tag] = [name]
if 'items' in node.extra['metadata']:
for item in node.extra['metadata']['items']:
tag = 'tag_%s_%s' % (item['key'], item['value'])
if groups.has_key(tag): groups[tag].append(name)
else: groups[tag] = [name]
Step 3: Mesos
Our Mesos Architecture
Zookeeper*
Mesos Master*
Mesos Agents*
Consul
Marathon (The scheduler’s scheduler)
Mesos-consul
Deploying Zookeeper
- name: Set zookeeper ID facts
gather_facts: True
hosts: tag_zookeeper_server_{{ consul_domain }}
user: ilm-user
tasks:
- set_fact: zkid={{ item.0 | int + 1 }}
when: hostvars[item.1]['ansible_hostname'] == ansible_hostname
with_indexed_items: groups['tag_zookeeper_server_{{ consul_domain }}']
- name: Apply zookeeper role
gather_facts: True
hosts: tag_zookeeper_server_{{ consul_domain }}
sudo: True
user: ilm-user
roles:
- zookeeper
Zookeeper Role
- name: Register zookeeper name with consul
uri: >
url=http://127.0.0.1:8500/v1/agent/service/register
HEADER_Content-Type=application/json
method=PUT
body_format=json
body='{
"Name": "zookeeper",
"Tags": [
"zookeeper",
"{{ zkid }}"
],
"Port": 2181
}'
- name: Register individual zookeeper node with consul
uri: >
url=http://127.0.0.1:8500/v1/agent/service/register
method=PUT
body_format=json
HEADER_Content-Type=application/json
body='{
"Name": "zookeeper-{{ zkid }}",
"Tags": [
"zookeeper",
"{{ zkid }}"
],
"Port": 2181
}'
Zookeeper Role
- name: Run zookeeper container
docker:
name: zookeeper
image: "mesoscloud/zookeeper:3.4.6-ubuntu-14.04"
state: started
net: host
restart_policy: always
volumes:
- /mnt/data/log:/tmp/zookeeper
env:
MYID: "{{ zkid }}"
SERVERS: "zookeeper-1,zookeeper-2,zookeeper-3"
Mesos Containers
- name: Run mesos-master container
docker:
name: mesos-master
image: "mesosphere/mesos-master:{{ img_version }}"
state: started
net: host
restart_policy: always
volumes:
- /mnt/data/log:/var/log
env:
MESOS_ZK: "zk://zookeeper:2181/mesos"
MESOS_CLUSTER: "{{ cluster_name }}"
MESOS_QUORUM: "1"
MESOS_LOG_DIR: "/var/log/mesos"
MESOS_WORK_DIR: "/var/lib/mesos"
MESOS_HOSTNAME: "mesos-master"
Submit tasks to Marathon
- name: Launch docker-registry
hosts: "tag_build_docker_{{ consul_domain }}"
gather_facts: False
tasks:
- name: Submit docker-registry job to marathon
uri: >
url=http://marathon:8080/v2/apps
HEADER_Content-Type=application/json
method=POST
status_code=200,201,409
body_format=json
body='{
"args": [ ],
"container": {
"type": "DOCKER",
"docker": {
"network": "HOST",
"image": "registry:2.2",
"forcePullImage": true,
"parameters":
[
{ "key": "env", "value": "REGISTRY_STORAGE=s3" }
]
}
},
"id": "docker-registry",
"instances": 1,
"cpus": 2,
"mem": 4096
}'
Done

More Related Content

What's hot

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBram Vogelaar
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleOmid Vahdaty
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?shirou wakayama
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansibleKhizer Naeem
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 

What's hot (20)

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 

Viewers also liked

ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloudAaron Carey
 
Dynamic Scheduling - Federated clusters in mesos
Dynamic Scheduling - Federated clusters in mesosDynamic Scheduling - Federated clusters in mesos
Dynamic Scheduling - Federated clusters in mesosAaron Carey
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Jeff Geerling
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchJeff Geerling
 
SIGGRAPH Presentation 2016 Slides
SIGGRAPH Presentation 2016 SlidesSIGGRAPH Presentation 2016 Slides
SIGGRAPH Presentation 2016 SlidesAaron Carey
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...Irakli Nadareishvili
 

Viewers also liked (11)

Cyansible
CyansibleCyansible
Cyansible
 
ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloud
 
Dynamic Scheduling - Federated clusters in mesos
Dynamic Scheduling - Federated clusters in mesosDynamic Scheduling - Federated clusters in mesos
Dynamic Scheduling - Federated clusters in mesos
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps Match
 
SIGGRAPH Presentation 2016 Slides
SIGGRAPH Presentation 2016 SlidesSIGGRAPH Presentation 2016 Slides
SIGGRAPH Presentation 2016 Slides
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible
AnsibleAnsible
Ansible
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...AnsibleBuilding a Docker-ized Microservice  In Node, Using Ansible - AnsibleF...
AnsibleBuilding a Docker-ized Microservice In Node, Using Ansible - AnsibleF...
 

Similar to Ansible fest Presentation slides

ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CICosmin Poieana
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcachedSkills Matter
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStackke4qqq
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStackPuppet
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackke4qqq
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloudpetriojala123
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpresoke4qqq
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
 
Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013Trevor Roberts Jr.
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Simon McCartney
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Data weekender deploying prod grade sql 2019 big data clusters
Data weekender deploying prod grade sql 2019 big data clustersData weekender deploying prod grade sql 2019 big data clusters
Data weekender deploying prod grade sql 2019 big data clustersChris Adkin
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesYevgeniy Brikman
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)HungWei Chiu
 

Similar to Ansible fest Presentation slides (20)

ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CI
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcached
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Data weekender deploying prod grade sql 2019 big data clusters
Data weekender deploying prod grade sql 2019 big data clustersData weekender deploying prod grade sql 2019 big data clusters
Data weekender deploying prod grade sql 2019 big data clusters
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 

Ansible fest Presentation slides

  • 1.
  • 2. Who are we? Jim Vanns Aaron Carey Production Engineers at ILM London
  • 3. What we’re covering ● Deploying a Mesos cluster in the cloud using Ansible ● Running services on Mesos using Ansible ● Differences between AWS/GCE modules ● Tips we’ve learnt along the way
  • 5. Ansible Dockerfile (example follows) Fix the ansible version Install a custom dynamic inventory file (or two) Consider your credentials and security Install (bake-in a ‘git archive’) your playbooks
  • 6. Concise Ansible Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get -y install python python-pip python-dev RUN pip install -U ansible==1.9.4 boto apache-libcloud httplib2 ADD ansible.cfg /etc/ansible/ansible.cfg ADD ec2.py /etc/ansible/ec2.py ADD ec2.ini /etc/ansible/ec2.ini ADD gce.py /etc/ansible/gce.py ADD gce.ini /etc/ansible/gce.ini WORKDIR /srv/ansible ADD ansible .
  • 7. Step 2: Deploy cloud hosts
  • 8. Requirements Cloud Agnostic (Work with both AWS and GCE) Split provisioning and bootstrapping into roles Need a way to determine which are new hosts Need a way to group hosts during and after provisioning Tagging!
  • 9. Cloud Start Role # Launch the primary (master/leader) nameserver - name: Launch a bootstrap consul server hosts: localhost connection: local gather_facts: False vars: cloud_provider: ec2 count: 3 service_name: Consul launch_group: tag_consul_server_{{ consul_domain }} tags: consul: server_{{ consul_domain }} roles: - cloud_start
  • 10. Cloud Start Role --- - include: "{{ cloud_provider }}.yml"
  • 11. Cloud Start Role - name: Launch instance ec2: key_name: "{{ key_name }}" instance_type: "{{ instance_type }}" image: "{{ image }}" wait: yes vpc_subnet_id: "{{ vpc_subnet_id }}" group_id: "{{ security_group_id }}" region: "{{ region }}" instance_tags: ansible: base count: "{{ count }}" assign_public_ip: "{{ public_ip }}" register: ec2 - name: Add instances to launched group add_host: hostname={{ item.private_ip }} groupname=launched_cloud_default with_items: ec2.instances - name: Add instances to parameter group add_host: hostname={{ item.private_ip }} groupname={{ launch_group }} with_items: ec2.instances
  • 12. Cloud Start Role - name: Tag instances ec2_tag: resource={{item.id}} state=present region={{region}} with_items: ec2.instances args: tags: "{{ tags }}" - name: Wait for sshd to come up wait_for: host={{ item.private_ip }} port=22 state=started delay=60 timeout=300 connect_timeout=2 with_items: ec2.instances
  • 13. Taking it further... Parallelise the provisioning Take advantage of host groups where you can Use ansible environment variables to target hosts and groups
  • 14.
  • 15. AWS vs GCE AWS - Tags are key-value pairs GCE - Tags are string labels, Metadata are key-value pairs We used a custom (slightly modified) GCE inventorytags = node.extra['tags'] for t in tags: tag = 'tag_%s' % t if groups.has_key(tag): groups[tag].append(name) else: groups[tag] = [name] if 'items' in node.extra['metadata']: for item in node.extra['metadata']['items']: tag = 'tag_%s_%s' % (item['key'], item['value']) if groups.has_key(tag): groups[tag].append(name) else: groups[tag] = [name]
  • 17. Our Mesos Architecture Zookeeper* Mesos Master* Mesos Agents* Consul Marathon (The scheduler’s scheduler) Mesos-consul
  • 18. Deploying Zookeeper - name: Set zookeeper ID facts gather_facts: True hosts: tag_zookeeper_server_{{ consul_domain }} user: ilm-user tasks: - set_fact: zkid={{ item.0 | int + 1 }} when: hostvars[item.1]['ansible_hostname'] == ansible_hostname with_indexed_items: groups['tag_zookeeper_server_{{ consul_domain }}'] - name: Apply zookeeper role gather_facts: True hosts: tag_zookeeper_server_{{ consul_domain }} sudo: True user: ilm-user roles: - zookeeper
  • 19. Zookeeper Role - name: Register zookeeper name with consul uri: > url=http://127.0.0.1:8500/v1/agent/service/register HEADER_Content-Type=application/json method=PUT body_format=json body='{ "Name": "zookeeper", "Tags": [ "zookeeper", "{{ zkid }}" ], "Port": 2181 }' - name: Register individual zookeeper node with consul uri: > url=http://127.0.0.1:8500/v1/agent/service/register method=PUT body_format=json HEADER_Content-Type=application/json body='{ "Name": "zookeeper-{{ zkid }}", "Tags": [ "zookeeper", "{{ zkid }}" ], "Port": 2181 }'
  • 20. Zookeeper Role - name: Run zookeeper container docker: name: zookeeper image: "mesoscloud/zookeeper:3.4.6-ubuntu-14.04" state: started net: host restart_policy: always volumes: - /mnt/data/log:/tmp/zookeeper env: MYID: "{{ zkid }}" SERVERS: "zookeeper-1,zookeeper-2,zookeeper-3"
  • 21. Mesos Containers - name: Run mesos-master container docker: name: mesos-master image: "mesosphere/mesos-master:{{ img_version }}" state: started net: host restart_policy: always volumes: - /mnt/data/log:/var/log env: MESOS_ZK: "zk://zookeeper:2181/mesos" MESOS_CLUSTER: "{{ cluster_name }}" MESOS_QUORUM: "1" MESOS_LOG_DIR: "/var/log/mesos" MESOS_WORK_DIR: "/var/lib/mesos" MESOS_HOSTNAME: "mesos-master"
  • 22. Submit tasks to Marathon - name: Launch docker-registry hosts: "tag_build_docker_{{ consul_domain }}" gather_facts: False tasks: - name: Submit docker-registry job to marathon uri: > url=http://marathon:8080/v2/apps HEADER_Content-Type=application/json method=POST status_code=200,201,409 body_format=json body='{ "args": [ ], "container": { "type": "DOCKER", "docker": { "network": "HOST", "image": "registry:2.2", "forcePullImage": true, "parameters": [ { "key": "env", "value": "REGISTRY_STORAGE=s3" } ] } }, "id": "docker-registry", "instances": 1, "cpus": 2, "mem": 4096 }'
  • 23. Done