SlideShare a Scribd company logo
ANSIBLE INSIDE IDEATO
Alessandro Mazzoli
Sysadmin@Ideato
am@ideato.it
@alendmazz
WHY ANSIBLE
we will consider some facts:
ideato’s scenario
dev needs
sysadm needs
IDEATO SCENARIO
focus on great software
development and good practices


50+VM’s to provision, configure
and maintain, no need a high
level of orchestration
DEV NEEDS
• easy CM tool to setup their
environments
• time spent to debug CM tool
error is waste
SYSADM NEEDS
• painless rolling updates

• going to mass production
environments
VS
ANSIBLE ROLES
≈
PUPPET MODULES
LEARNING CURVE
YAML vs RubyDSL
i don’t want learn Ruby or other DSL…
- name: set up user
user: name=alemazz
shell=/bin/bash
password={{ password}}
user{"$user":
managehome=>true,
ensure => present,
}
file{"/home/$user":
ensure=>directory,
mode=>755,
require=>User["$user"],
}
file{"/home/$user/.ssh":
ensure=>directory,
require=>File["/home/$user"],
}
Node specific information
Hiera
Node specific information
template Jinja + ansible vars + ansible
vault
add a yaml file on host_vars/ or group_vars for example:
—
aws_access_key: AKIA
aws_secret_key: ngxiw
and encrypt to AES: ansible-vault encrypt aws.yaml
Agentless
only SSH/SFTP/SCP are required
no central server scalability
no need to update minions or
puppet over your infrastructure
Inconsistency
• Ruby & PE
• Puppetforge modules
• Puppet skip everything
based on dep what just
failed
• Rspec needed
TOWARD MASS
PRODUCTION SYSTEM
DEMO: ELASTICSEARCH CLUSTER ON
AWS
USING ANSIBLE
our demo will be on AWS multi AZ……
Why Elasticsearch is fit for CM management
tools like Ansible?
Lot of sys adm configuration tips for a cluster
environment
• java settings( jmx, mlockall….)
• sysctl settings( swappiness, max_map,count..)
• ulimit settings

Do I have to change these settings by hand
repeated for n° instance times?
NOTHANKS!
As a mention before Ansible has a plenty of
sysadm modules:

- name: firewalld applying conf
firewalld: service=elasticsearch
permanent=true zone=public state=enabled
tags:
- firewall

- name: sysctl configs
sysctl: name=fs.file-max value=64000 state=present
tags:
- sysctl
Here’ s come AWS
AWS provides a special plugin for discovery your ES
instances inside your cluster just by
their security group!
discovery.type: ec2
discovery.zen.ping.multicast.enabled: false
discovery.ec2.groups: my_security_group
I don’t have to update the other node -1 configurations
if i need to replace or add a new node!!
Create our instances--
- hosts: localhost
connection: local
vars_files:
- host_vars/el.yml
vars:
security_group: elsg
instance_type: t2.medium
image: ami-7cc4f661
region: eu-central-1
keypair: example.pem
n_instances: "1"
tasks:
- name: Launch Instance to Frankfurt av 1
ec2:
group: elsg
instance_type: "{{ instance_type }}"
image: ami-7cc4f661
wait: true
region: eu-central-1
keypair: "{{ keypair }}"
vpc_subnet_id: subnet-id
count: "1"
register: ec2
with_items: ec2_instances_fav1
…
- name: Launch Instance to Frankfurt av 2
ec2:
group: elsg
instance_type: "{{ instance_type}}"
image: ami-7cc4f661
wait: true
region: eu-central-1
keypair: "{{ keypair }}"
vpc_subnet_id: subnet-id2
count: "2"
register: ec2
with_items: ec2_instances_fav2
remote_user: centos
gather_facts: True
sudo: false
ansible-playbook -i inventories/local/local
el-aws_create-instance.yml
---
- name: ensure pip is installed for curator
yum: name=python-pip state=installed enablerepo=epel
tags:
- curator
sudo: true
- stat: path=/opt/jre-8u45-linux-x64.rpm
register: jre_exists
tags:
- jre
- name: Install Elasticsearch Curator and required dependencies.
pip: "name={{ item }}"
with_items:
- elasticsearch-curator
- argparse
tags:
- curator
sudo: true
- name: download Oracle Java JRE Runtime
command: 'wget -q -O /opt/jre-8u45-linux-x64.rpm --no-cookies --no-check-certificate —header
"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jre-8u45-linux-x64.rpm"'
when: jre_exists.stat.exists == False
- name: install Oracle Java JRE Runtime
yum: name="/opt/jre-8u45-linux-x64.rpm" state=present
tags:
- jre
Set up ES cluster(1/4)
- stat: path=/opt/elasticsearch-1.5.1.noarch.rpm
register: el_exists
tags:
- elinstall
- name: download Elasticsearch
command: 'wget -q -O /opt/elasticsearch-1.5.1.noarch.rpm https://download.elastic.co/elasticsearch/elasticsearch/
elasticsearch-1.5.1.noarch.rpm'
when: el_exists.stat.exists == False
- name: install Elasticsearch
yum: name="/opt/elasticsearch-1.5.1.noarch.rpm" state=present
tags:
- elinstall
- name: install plugins
command: "{{ item }} chdir=/usr/share/elasticsearch/bin/"
with_items:
- ./plugin -install elasticsearch/elasticsearch-cloud-aws/2.5.1
- ./plugin -install royrusso/elasticsearch-HQ
ignore_errors: true
tags:
- plugin
Set up ES cluster(2/4)
-
name: copy conf to mem limit unlimited
copy: src=99-elastic-nproc.conf dest=/etc/security/limits.d/99-elastic-nproc.conf owner=root mode=0640
tags:
- ulimit
sudo: true
-
name: sysctl configs
sysctl: name=vm.swappiness value=0 state=present
tags:
- sysctl
sudo: true
-
name: sysctl configs
sysctl: name=vm.max_map_count=262144 value=0 state=present
tags:
- sysctl
sudo: true
-
name: sysctl configs
sysctl: name=fs.file-max value=64000 state=present
tags:
- sysctl
sudo: true
-
name: disable swap
command: swapoff -a
tags:
- swap
sudo: true
Set up ES cluster(3/4)
-
name: set up elasticsearch.yaml
template: src=elasticsearch.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root mode=0644 backup=yes
tags:
- elconf
-
name: ensure exists log directory and data directory
file: path={{ item }} state=directory owner=elasticsearch
with_items:
- /var/data/elasticsearch
- /var/log/elasticsearch
tags:
- directory
sudo: true
-
name: start elastic
service: name=elasticsearch state=restarted enabled=yes
-
name: copy json accounts
copy: src=accounts.json dest=/home/centos owner=centos mode=0640
tags:
- accounts
sudo: true
Set up ES cluster(4/4)
Ansible provides a special plugin to find the running
instances inside your EC2 account…
it’s called dynamic inventory
ansible-playbook -i inventories/dynamic/ec2.py
el-aws_deploy-instance.yml
./ec2.py —list
"eu-central-1b": [
“5*.2*.8*.4*”,
“5*.2*.3*.9*”,
“5*.2*.4*.3*”
],
Insert some data
let’s try to insert a sample bank dataset, here a small part of it:
{
"account_number": 0,
"balance": 16623,
"firstname": "Bradshaw",
"lastname": "Mckenzie",
"age": 29,
"gender": "F",
"address": "244 Columbus Place",
"employer": "Euron",
"email": "bradshawmckenzie@euron.com",
"city": "Hobucken",
"state": “CO"
}
curl -XPOST 'localhost:9200/bank/account/
_bulk?pretty' --data-binary @accounts.json
Let’s see the output
Elastic HQ
What we have achieved?
• a mass production system without handy configuration
• a fully reproducible environment
• scalability
• availability
• exit staff proof
• fully documentated by the code
• reduced stress
……………………………………………………
state of the art
&
current workflow
I’m almost a DevOps
Current workflow
Assumptions:
dev environment = local environment
developers usingVagrant and Ansible to configure
their environment
deploys are via Idephix or rsync
dev asks to sysadmins to provision staging & prod
sysadmins add their roles
to production environment !!
roles repo is inside local network,
remote dev can’t obtain that roles
we haven’t a single source of code for
Ansible roles
we don’t share efforts on roles
Issues
we got rolling updates on all machines
though Ansible
on newer machines we have some
sysadmin roles like:
• distrib role
• security role
• s3 role
• vpn role
but we haven’t any application oriented
roles like webserver role or php role on
stag/prod
easiest workflow
sysadmin will provision staging and
production using same roles that dev use
•developers deploy app code
•syasadmin deploy roles
2nd workflow
developers also deploy the infrastructural code
Can Idephix be also a
provisioner ??
Resources
http://www.ansible.com/home
https://docs.ansible.com/playbooks_vault.html
https://puppetlabs.com/
http://docs.puppetlabs.com/hiera/1/
https://www.elastic.co/
https://github.com/elastic/elasticsearch-cloud-aws
https://github.com/ansible/ansible/blob/devel/plugins/inventory/ec2.py
http://pavelpolyakov.com/2014/08/14/elasticsearch-cluster-on-aws-
part-2-configuring-the-elasticsearch/
https://github.com/royrusso/elasticsearch-HQ
http://getidephix.com/
Questions???

More Related Content

What's hot

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
Mitchell Pronschinske
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkMichael Peacock
 
New in php 7
New in php 7New in php 7
New in php 7
Vic Metcalfe
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkShahar Evron
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
Kris Wallsmith
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
Siarzh Miadzvedzeu
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
Amazon Web Services
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
Bram Vogelaar
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
Bram Vogelaar
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
Jon Moore
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
Cong Zhang
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
jimi-c
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to another
Michele Orselli
 
PofEAA and SQLAlchemy
PofEAA and SQLAlchemyPofEAA and SQLAlchemy
PofEAA and SQLAlchemyInada Naoki
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
Greg DeKoenigsberg
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Kris Wallsmith
 

What's hot (20)

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
New in php 7
New in php 7New in php 7
New in php 7
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend Framework
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to another
 
PofEAA and SQLAlchemy
PofEAA and SQLAlchemyPofEAA and SQLAlchemy
PofEAA and SQLAlchemy
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
 

Similar to Ansible inside

Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
Rodolfo Carvalho
 
Configuration Management and Provisioning Are Different
Configuration Management and Provisioning Are DifferentConfiguration Management and Provisioning Are Different
Configuration Management and Provisioning Are Different
Carlos Nunez
 
Julien Simon "Scaling ML from 0 to millions of users"
Julien Simon "Scaling ML from 0 to millions of users"Julien Simon "Scaling ML from 0 to millions of users"
Julien Simon "Scaling ML from 0 to millions of users"
Fwdays
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
Paolo Tonin
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
grim_radical
 
Automating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngageAutomating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngage
Vishal Uderani
 
Ufo Ship for AWS ECS
Ufo Ship for AWS ECSUfo Ship for AWS ECS
Ufo Ship for AWS ECS
Tung Nguyen
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
John Lynch
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
DevOps Ltd.
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcachedSkills Matter
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
Achieve Internet
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpresoke4qqq
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
Prajal Kulkarni
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
Allan Shone
 
Ansible
AnsibleAnsible
Ansible
Raul Leite
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
DonghuKIM2
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Simon McCartney
 
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
Provectus
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
Puppet
 

Similar to Ansible inside (20)

Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Configuration Management and Provisioning Are Different
Configuration Management and Provisioning Are DifferentConfiguration Management and Provisioning Are Different
Configuration Management and Provisioning Are Different
 
Julien Simon "Scaling ML from 0 to millions of users"
Julien Simon "Scaling ML from 0 to millions of users"Julien Simon "Scaling ML from 0 to millions of users"
Julien Simon "Scaling ML from 0 to millions of users"
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Automating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngageAutomating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngage
 
Ufo Ship for AWS ECS
Ufo Ship for AWS ECSUfo Ship for AWS ECS
Ufo Ship for AWS ECS
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcached
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
 
Ansible
AnsibleAnsible
Ansible
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 

More from Ideato

serverless, a next level for devops
serverless, a next level for devopsserverless, a next level for devops
serverless, a next level for devops
Ideato
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
Ideato
 
Jenkins with superpowers
Jenkins with superpowersJenkins with superpowers
Jenkins with superpowers
Ideato
 
Ansible pill09wp
Ansible pill09wpAnsible pill09wp
Ansible pill09wp
Ideato
 
Elk devops
Elk devopsElk devops
Elk devops
Ideato
 
TogetherJS
TogetherJS TogetherJS
TogetherJS
Ideato
 

More from Ideato (6)

serverless, a next level for devops
serverless, a next level for devopsserverless, a next level for devops
serverless, a next level for devops
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
 
Jenkins with superpowers
Jenkins with superpowersJenkins with superpowers
Jenkins with superpowers
 
Ansible pill09wp
Ansible pill09wpAnsible pill09wp
Ansible pill09wp
 
Elk devops
Elk devopsElk devops
Elk devops
 
TogetherJS
TogetherJS TogetherJS
TogetherJS
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

Ansible inside

  • 1. ANSIBLE INSIDE IDEATO Alessandro Mazzoli Sysadmin@Ideato am@ideato.it @alendmazz
  • 2. WHY ANSIBLE we will consider some facts: ideato’s scenario dev needs sysadm needs
  • 3. IDEATO SCENARIO focus on great software development and good practices 
 50+VM’s to provision, configure and maintain, no need a high level of orchestration
  • 4. DEV NEEDS • easy CM tool to setup their environments • time spent to debug CM tool error is waste
  • 5. SYSADM NEEDS • painless rolling updates
 • going to mass production environments
  • 6. VS
  • 9. YAML vs RubyDSL i don’t want learn Ruby or other DSL… - name: set up user user: name=alemazz shell=/bin/bash password={{ password}} user{"$user": managehome=>true, ensure => present, } file{"/home/$user": ensure=>directory, mode=>755, require=>User["$user"], } file{"/home/$user/.ssh": ensure=>directory, require=>File["/home/$user"], }
  • 11. Node specific information template Jinja + ansible vars + ansible vault add a yaml file on host_vars/ or group_vars for example: — aws_access_key: AKIA aws_secret_key: ngxiw and encrypt to AES: ansible-vault encrypt aws.yaml
  • 12. Agentless only SSH/SFTP/SCP are required no central server scalability no need to update minions or puppet over your infrastructure
  • 13. Inconsistency • Ruby & PE • Puppetforge modules • Puppet skip everything based on dep what just failed • Rspec needed
  • 14.
  • 15. TOWARD MASS PRODUCTION SYSTEM DEMO: ELASTICSEARCH CLUSTER ON AWS USING ANSIBLE
  • 16. our demo will be on AWS multi AZ……
  • 17. Why Elasticsearch is fit for CM management tools like Ansible? Lot of sys adm configuration tips for a cluster environment • java settings( jmx, mlockall….) • sysctl settings( swappiness, max_map,count..) • ulimit settings
 Do I have to change these settings by hand repeated for n° instance times? NOTHANKS!
  • 18. As a mention before Ansible has a plenty of sysadm modules:
 - name: firewalld applying conf firewalld: service=elasticsearch permanent=true zone=public state=enabled tags: - firewall
 - name: sysctl configs sysctl: name=fs.file-max value=64000 state=present tags: - sysctl
  • 19. Here’ s come AWS AWS provides a special plugin for discovery your ES instances inside your cluster just by their security group! discovery.type: ec2 discovery.zen.ping.multicast.enabled: false discovery.ec2.groups: my_security_group I don’t have to update the other node -1 configurations if i need to replace or add a new node!!
  • 20.
  • 21. Create our instances-- - hosts: localhost connection: local vars_files: - host_vars/el.yml vars: security_group: elsg instance_type: t2.medium image: ami-7cc4f661 region: eu-central-1 keypair: example.pem n_instances: "1" tasks: - name: Launch Instance to Frankfurt av 1 ec2: group: elsg instance_type: "{{ instance_type }}" image: ami-7cc4f661 wait: true region: eu-central-1 keypair: "{{ keypair }}" vpc_subnet_id: subnet-id count: "1" register: ec2 with_items: ec2_instances_fav1
  • 22. … - name: Launch Instance to Frankfurt av 2 ec2: group: elsg instance_type: "{{ instance_type}}" image: ami-7cc4f661 wait: true region: eu-central-1 keypair: "{{ keypair }}" vpc_subnet_id: subnet-id2 count: "2" register: ec2 with_items: ec2_instances_fav2 remote_user: centos gather_facts: True sudo: false ansible-playbook -i inventories/local/local el-aws_create-instance.yml
  • 23. --- - name: ensure pip is installed for curator yum: name=python-pip state=installed enablerepo=epel tags: - curator sudo: true - stat: path=/opt/jre-8u45-linux-x64.rpm register: jre_exists tags: - jre - name: Install Elasticsearch Curator and required dependencies. pip: "name={{ item }}" with_items: - elasticsearch-curator - argparse tags: - curator sudo: true - name: download Oracle Java JRE Runtime command: 'wget -q -O /opt/jre-8u45-linux-x64.rpm --no-cookies --no-check-certificate —header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jre-8u45-linux-x64.rpm"' when: jre_exists.stat.exists == False - name: install Oracle Java JRE Runtime yum: name="/opt/jre-8u45-linux-x64.rpm" state=present tags: - jre Set up ES cluster(1/4)
  • 24. - stat: path=/opt/elasticsearch-1.5.1.noarch.rpm register: el_exists tags: - elinstall - name: download Elasticsearch command: 'wget -q -O /opt/elasticsearch-1.5.1.noarch.rpm https://download.elastic.co/elasticsearch/elasticsearch/ elasticsearch-1.5.1.noarch.rpm' when: el_exists.stat.exists == False - name: install Elasticsearch yum: name="/opt/elasticsearch-1.5.1.noarch.rpm" state=present tags: - elinstall - name: install plugins command: "{{ item }} chdir=/usr/share/elasticsearch/bin/" with_items: - ./plugin -install elasticsearch/elasticsearch-cloud-aws/2.5.1 - ./plugin -install royrusso/elasticsearch-HQ ignore_errors: true tags: - plugin Set up ES cluster(2/4)
  • 25. - name: copy conf to mem limit unlimited copy: src=99-elastic-nproc.conf dest=/etc/security/limits.d/99-elastic-nproc.conf owner=root mode=0640 tags: - ulimit sudo: true - name: sysctl configs sysctl: name=vm.swappiness value=0 state=present tags: - sysctl sudo: true - name: sysctl configs sysctl: name=vm.max_map_count=262144 value=0 state=present tags: - sysctl sudo: true - name: sysctl configs sysctl: name=fs.file-max value=64000 state=present tags: - sysctl sudo: true - name: disable swap command: swapoff -a tags: - swap sudo: true Set up ES cluster(3/4)
  • 26. - name: set up elasticsearch.yaml template: src=elasticsearch.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root mode=0644 backup=yes tags: - elconf - name: ensure exists log directory and data directory file: path={{ item }} state=directory owner=elasticsearch with_items: - /var/data/elasticsearch - /var/log/elasticsearch tags: - directory sudo: true - name: start elastic service: name=elasticsearch state=restarted enabled=yes - name: copy json accounts copy: src=accounts.json dest=/home/centos owner=centos mode=0640 tags: - accounts sudo: true Set up ES cluster(4/4)
  • 27. Ansible provides a special plugin to find the running instances inside your EC2 account… it’s called dynamic inventory ansible-playbook -i inventories/dynamic/ec2.py el-aws_deploy-instance.yml ./ec2.py —list "eu-central-1b": [ “5*.2*.8*.4*”, “5*.2*.3*.9*”, “5*.2*.4*.3*” ],
  • 28. Insert some data let’s try to insert a sample bank dataset, here a small part of it: { "account_number": 0, "balance": 16623, "firstname": "Bradshaw", "lastname": "Mckenzie", "age": 29, "gender": "F", "address": "244 Columbus Place", "employer": "Euron", "email": "bradshawmckenzie@euron.com", "city": "Hobucken", "state": “CO" } curl -XPOST 'localhost:9200/bank/account/ _bulk?pretty' --data-binary @accounts.json
  • 29. Let’s see the output
  • 31. What we have achieved? • a mass production system without handy configuration • a fully reproducible environment • scalability • availability • exit staff proof • fully documentated by the code • reduced stress ……………………………………………………
  • 32.
  • 33. state of the art & current workflow
  • 34. I’m almost a DevOps
  • 35. Current workflow Assumptions: dev environment = local environment developers usingVagrant and Ansible to configure their environment deploys are via Idephix or rsync dev asks to sysadmins to provision staging & prod
  • 36. sysadmins add their roles to production environment !!
  • 37. roles repo is inside local network, remote dev can’t obtain that roles we haven’t a single source of code for Ansible roles we don’t share efforts on roles Issues
  • 38. we got rolling updates on all machines though Ansible on newer machines we have some sysadmin roles like: • distrib role • security role • s3 role • vpn role but we haven’t any application oriented roles like webserver role or php role on stag/prod
  • 39. easiest workflow sysadmin will provision staging and production using same roles that dev use •developers deploy app code •syasadmin deploy roles
  • 40. 2nd workflow developers also deploy the infrastructural code
  • 41. Can Idephix be also a provisioner ??