SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Powerful and Simple IT automation engine
 Ansible is radically simple IT
Configuration management and
Orchestration Tool that automates
Infrastructure, Provisioning,
configuration management,
application deployment, intra-service
orchestration, and many other IT
needs.
1. Agent-less communication
 SSH-based, so it doesn’t require installing any agents on
remote nodes.
2. Procedural and Ordered
 Allow you to perform Orchestration and perform tasks in an
order that you want to .
3. Easy learning curve
 It uses YAML because it is easier for humans to read and write
than other common data formats like XML or JSON.
4. Playbook structure is simple and clearly
structured.
5. Has a variable registration feature that enables
tasks to register variables for later tasks.
Dependencies
. Python
. PyYaml
. Jinja2
Ansible control server
P
Y
T
H
O
N
Ansible consists of…
1. Inventory Files.
2. Tasks.
3. Plays.
4. Playbooks.
5. Tags
6. Roles
 Inventory File
 Ansible works against multiple systems in your
infrastructure at the same time. It does this by selecting
portions of systems listed in Ansible’s inventory file, which
defaults to being saved in the location /etc/ansible/hosts.
 Inventory allows you to Group hosts together and then you can use
those groups as part of the targets.
• The format for /etc/ansible/hosts is an INI-like format and looks like
this:
[loadbalancer]
ec2-54-183-79-180.us-west-1.compute.amazonaws.com
[database]
ec2-54-183-79-180.us-west-1.compute.amazonaws.com
[webserver]
0.0.0.0
[control]
control ansible_connection=local
• Adding a lot of hosts?... If you have a number of hosts with
similar patterns you can do this rather than listing each
hostname:
[webservers]
www[01:50].example.com
• You can also select the connection type and user on a per
host basis:
[targets]
localhost ansible_connection=local
other1.example.com ansible_connection=ssh ansible_user=fsgapp
other2.example.com ansible_connection=ssh ansible_user=fsgapp
• Sample Ansible command to list hosts in an inventory.
[root@D4687277 ansible]# ansible –i dev –list-hosts all
[root@D4687277 ansible]# ansible –i dev –list-hosts webserver:control
[root@D4687277 ansible]# ansible –i dev –list-hosts webserver[0]
 Tasks
• In ansible a task is basic building block of all execution and
configuration.
• A task is made of building blocks consists of module and
arguments to that module.
• A simple task look like :
[root@D4687277 ansible]# ansible -i stg -m ping webserver
mdc2vra025 | SUCCESS => {
"changed": false,
"ping": "pong"
}
mdc2vra021 | SUCCESS => {
"changed": false,
"ping": "pong"
}
 Plays
• A play is executed as part of playbook and play is simply a
set tasks to execute against the target host/role.
 Playbooks
• A playbook is file written in YAML syntax made up of Plays.
• A sample playbook look like:
---
- hosts: control
become: true
tasks:
- name: install apache
yum: name={{item}} state=present update_cache=yes
with_items:
- httpd
- name: Start Service
service: name=httpd state=started enabled=yes
• A playbook with multiple plays look like
---
- hosts: webservers
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum: name=httpd state=latest
- name: write the apache config file
template: src=/srv/httpd.j2 dest=/etc/httpd.conf
- hosts: databases
remote_user: root
tasks:
- name: ensure postgresql is at the latest version
yum: name=postgresql state=latest
- name: ensure that postgresql is started
service: name=postgresql state=running
Play 1
Play 2
 Install JDK1.8, Jboss-eap-6.4 version, Deploy
Jboss configuration and Deploy JBOSS
application Ansible Playbook.
My playbook contains set of tasks which use
modules provided by ansible.
Note: This playbook is for demo purpose only .
So need much more tuning.
1. Inventory File: To assign hosts and group
2. Playbook with plays.
3. Json file for passing variables.
4. Set of hosts with ssh keys.
Note: Assume ssh keys are in place on the
hosts.
My playbook give complete details on how to Install Jboss, Deploy Jboss Application and start/stop
jboss as service using tags
File look like this:
---
- name: Install JBOSS IF DOESN"T EXIST
hosts: webserver
become_user: {{user}}
tasks:
- name: CHECK IF JDK 1.8 exists
stat: path=/opt/jdk1.8.0_60
register: check_jdk_path
- name: It exists
debug: msg='Yay, the path exists!.So not Installing JDK1.8 again'
when: check_jdk_path.stat.exists
- name: It doesn't exist
when: check_jdk_path.stat.exists == false
command: "{{item}}"
args:
chdir: /opt
with_items:
- curl "http://server-ip/installables/jdk-8u60-linux-x64.tar.gz" -o "jdk-8u60-linux-x64.tar.gz"
- tar -xvf jdk-8u60-linux-x64.tar.gz
- chown -R {{user}}:{{user}} jdk1.8.0_60
- chmod -R 755 jdk1.8.0_60
- rm -rf jdk-8u60-linux-x64.tar.gz
- name: CHECK IF JBOSS-6.4 EXISTS
stat: path=/opt/jboss-eap-6.4
register: check_jboss_path
- name: CHECK IF STANALONE-your-app-name Profile exists
stat: path=/opt/jboss-eap-6.4/standalone-app-name
register: check_jboss_profile
- name: It exists
debug: msg='Yay, the path exists!.So not Installing Jboss again'
when: check_jboss_path.stat.exists
- name: It doesn't exist
when: check_jboss_path.stat.exists == false
command: "{{item}}"
args:
chdir: /opt
with_items:
- curl "http://mdc2vr6159/installables/jboss-eap-6.4.0.zip" -o "jboss-eap-6.4.0.zip"
- unzip jboss-eap-6.4.0.zip
- chown -R {{user}}:{{user}} jboss-eap-6.4
- rm -rf jboss-eap-6.4.0.zip
- cp -r jboss-eap-6.4/standalone jboss-eap-6.4/standalone-app-name
- name: deploy your-app-name jboss module configuration from svn
subversion: {{svn_user}}=user_name password={{password}}
repo=http://vcsorange/pwm/your-app-name-config/relbranches/{{version}}/{{ENV}}/modules
dest=/opt/jboss-eap-6.4/modules force=yes export=true
- name: deploy your-app-name jboss bin configuration from svn
subversion: {{svn_user}}=user_name password={{password}}
repo=http://vcsorange/pwm/your-app-name-config/relbranches/{{version}}/{{ENV}}/bin
dest=/opt/jboss-eap-6.4/bin force=yes export=true
- name: create jboss conf directory for service
file: path=/etc/jboss-as state=directory owner=root group=root mode=0775
- name: create jboss pid directory
file: path=/var/run/jboss-as state=directory owner=root group=root
mode=0775
- name: copy stom-jboss standalpone service file
when: check_jboss_path.stat.exists
command: "{{item}}"
args:
chdir: /opt/jboss-eap-6.4/
with_items:
- cp /opt/jboss-eap-6.4/bin/init.d/your-app-name-jboss /etc/init.d/
- cp /opt/jboss-eap-6.4/bin/init.d/jboss-as.conf /etc/jboss-as/
- chown root:root /etc/init.d/your-app-name-jboss
- chmod 755 /etc/init.d/your-app-name-jboss
- chmod 775 -R /var/run/jboss-as
- chmod 755 /etc/jboss-as/jboss-as.conf
- name: deploy your-app-name jboss standalone configuration from svn
subversion: {{svn_user}}=user_name password={{password}}
repo=http://vcsorange/pwm/your-app-name-
config/relbranches/{{version}}/STG/standalone-your-app-name dest=/opt/jboss-
eap-6.4/standalone-your-app-name force=yes export=true
- name: deploy UI war
maven_artifact: group_id=com.company.group artifact_id=your-app-name-ui
extension=war version={{version}}-RC1-SNAPSHOT
repository_url=http://{{nexus_url}}:{{port}}/nexus/content/repositories/stellaCIsnaps
hots dest=/opt/jboss-eap-6.4/standalone-your-app-name/deployments/your-
app-name-ui.war
- name: deploy services war
maven_artifact: group_id=com.company.your-app-name artifact_id=your-app-
name-services-war extension=war version={{version}}-RC1-SNAPSHOT
repository_url=http://{{nexus_url}}:{{port}}/nexus/content/repositories/stellaCIsnaps
hots dest=/opt/jboss-eap-6.4/standalone-your-app-name/deployments/your-
app-name-services.war
- name: change folder permissions
file: path=/opt/jboss-eap-6.4 owner={{user}} group={{user}} mode=755
recurse=yes
- name: change folder permissions
file: path=/www/a/logs/your-app-name owner={{user}} group={{user}}
mode=755 recurse=yes
- name: Start or Stop Service
service: name=storm-jboss state=restarted
tags:
- Start
- name: Start or Stop Service
service: name=storm-jboss state=stopped
tags:
- Stop
 ansible-playbook -i stg
playbooks/configure_jboss_stage.yml --
extra-vars "version=6.1.0 role=webserver
ENV=STG“ –skip-tags=“stop”
 http://docs.ansible.com/ansible/modules_by
_category.html
 http://docs.ansible.com/ansible/playbooks.h
tml

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

ansible why ?
ansible why ?ansible why ?
ansible why ?
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
Ansible
AnsibleAnsible
Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
 
Ansible
AnsibleAnsible
Ansible
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Ansible Playbook
Ansible PlaybookAnsible Playbook
Ansible Playbook
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Ansible get started
Ansible get startedAnsible get started
Ansible get started
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Ansible
AnsibleAnsible
Ansible
 
Jenkins
JenkinsJenkins
Jenkins
 

Andere mochten auch

V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with AnsibleBas Meijer
 
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
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 

Andere mochten auch (6)

V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
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...
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Cyansible
CyansibleCyansible
Cyansible
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 

Ähnlich wie Ansible presentation

A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
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
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
#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
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKI Goo Lee
 
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)Matt Fuller
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as CodeAllan Shone
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Jude A. Goonawardena
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyAAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyWASdev Community
 
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
 
Summit demystifying systemd1
Summit demystifying systemd1Summit demystifying systemd1
Summit demystifying systemd1Susant Sahani
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationNicolas Fränkel
 
Apache ant
Apache antApache ant
Apache antkoniik
 
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...WebCamp
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeSarah Z
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)iman darabi
 

Ähnlich wie Ansible presentation (20)

A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
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
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
 
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)
 
Ansible
AnsibleAnsible
Ansible
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyAAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
 
Ansible
AnsibleAnsible
Ansible
 
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.
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Summit demystifying systemd1
Summit demystifying systemd1Summit demystifying systemd1
Summit demystifying systemd1
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous Integration
 
Apache ant
Apache antApache ant
Apache ant
 
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 

Kürzlich hochgeladen

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
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
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Kürzlich hochgeladen (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
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...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
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
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Ansible presentation

  • 1. Powerful and Simple IT automation engine
  • 2.  Ansible is radically simple IT Configuration management and Orchestration Tool that automates Infrastructure, Provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.
  • 3. 1. Agent-less communication  SSH-based, so it doesn’t require installing any agents on remote nodes. 2. Procedural and Ordered  Allow you to perform Orchestration and perform tasks in an order that you want to . 3. Easy learning curve  It uses YAML because it is easier for humans to read and write than other common data formats like XML or JSON. 4. Playbook structure is simple and clearly structured. 5. Has a variable registration feature that enables tasks to register variables for later tasks.
  • 4. Dependencies . Python . PyYaml . Jinja2 Ansible control server P Y T H O N
  • 5. Ansible consists of… 1. Inventory Files. 2. Tasks. 3. Plays. 4. Playbooks. 5. Tags 6. Roles  Inventory File  Ansible works against multiple systems in your infrastructure at the same time. It does this by selecting portions of systems listed in Ansible’s inventory file, which defaults to being saved in the location /etc/ansible/hosts.
  • 6.  Inventory allows you to Group hosts together and then you can use those groups as part of the targets. • The format for /etc/ansible/hosts is an INI-like format and looks like this: [loadbalancer] ec2-54-183-79-180.us-west-1.compute.amazonaws.com [database] ec2-54-183-79-180.us-west-1.compute.amazonaws.com [webserver] 0.0.0.0 [control] control ansible_connection=local
  • 7. • Adding a lot of hosts?... If you have a number of hosts with similar patterns you can do this rather than listing each hostname: [webservers] www[01:50].example.com • You can also select the connection type and user on a per host basis: [targets] localhost ansible_connection=local other1.example.com ansible_connection=ssh ansible_user=fsgapp other2.example.com ansible_connection=ssh ansible_user=fsgapp • Sample Ansible command to list hosts in an inventory. [root@D4687277 ansible]# ansible –i dev –list-hosts all [root@D4687277 ansible]# ansible –i dev –list-hosts webserver:control [root@D4687277 ansible]# ansible –i dev –list-hosts webserver[0]
  • 8.  Tasks • In ansible a task is basic building block of all execution and configuration. • A task is made of building blocks consists of module and arguments to that module. • A simple task look like : [root@D4687277 ansible]# ansible -i stg -m ping webserver mdc2vra025 | SUCCESS => { "changed": false, "ping": "pong" } mdc2vra021 | SUCCESS => { "changed": false, "ping": "pong" }
  • 9.  Plays • A play is executed as part of playbook and play is simply a set tasks to execute against the target host/role.  Playbooks • A playbook is file written in YAML syntax made up of Plays. • A sample playbook look like: --- - hosts: control become: true tasks: - name: install apache yum: name={{item}} state=present update_cache=yes with_items: - httpd - name: Start Service service: name=httpd state=started enabled=yes
  • 10. • A playbook with multiple plays look like --- - hosts: webservers remote_user: root tasks: - name: ensure apache is at the latest version yum: name=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf - hosts: databases remote_user: root tasks: - name: ensure postgresql is at the latest version yum: name=postgresql state=latest - name: ensure that postgresql is started service: name=postgresql state=running Play 1 Play 2
  • 11.  Install JDK1.8, Jboss-eap-6.4 version, Deploy Jboss configuration and Deploy JBOSS application Ansible Playbook. My playbook contains set of tasks which use modules provided by ansible. Note: This playbook is for demo purpose only . So need much more tuning.
  • 12. 1. Inventory File: To assign hosts and group 2. Playbook with plays. 3. Json file for passing variables. 4. Set of hosts with ssh keys. Note: Assume ssh keys are in place on the hosts.
  • 13. My playbook give complete details on how to Install Jboss, Deploy Jboss Application and start/stop jboss as service using tags File look like this: --- - name: Install JBOSS IF DOESN"T EXIST hosts: webserver become_user: {{user}} tasks: - name: CHECK IF JDK 1.8 exists stat: path=/opt/jdk1.8.0_60 register: check_jdk_path - name: It exists debug: msg='Yay, the path exists!.So not Installing JDK1.8 again' when: check_jdk_path.stat.exists
  • 14. - name: It doesn't exist when: check_jdk_path.stat.exists == false command: "{{item}}" args: chdir: /opt with_items: - curl "http://server-ip/installables/jdk-8u60-linux-x64.tar.gz" -o "jdk-8u60-linux-x64.tar.gz" - tar -xvf jdk-8u60-linux-x64.tar.gz - chown -R {{user}}:{{user}} jdk1.8.0_60 - chmod -R 755 jdk1.8.0_60 - rm -rf jdk-8u60-linux-x64.tar.gz - name: CHECK IF JBOSS-6.4 EXISTS stat: path=/opt/jboss-eap-6.4 register: check_jboss_path - name: CHECK IF STANALONE-your-app-name Profile exists stat: path=/opt/jboss-eap-6.4/standalone-app-name register: check_jboss_profile - name: It exists debug: msg='Yay, the path exists!.So not Installing Jboss again' when: check_jboss_path.stat.exists
  • 15. - name: It doesn't exist when: check_jboss_path.stat.exists == false command: "{{item}}" args: chdir: /opt with_items: - curl "http://mdc2vr6159/installables/jboss-eap-6.4.0.zip" -o "jboss-eap-6.4.0.zip" - unzip jboss-eap-6.4.0.zip - chown -R {{user}}:{{user}} jboss-eap-6.4 - rm -rf jboss-eap-6.4.0.zip - cp -r jboss-eap-6.4/standalone jboss-eap-6.4/standalone-app-name - name: deploy your-app-name jboss module configuration from svn subversion: {{svn_user}}=user_name password={{password}} repo=http://vcsorange/pwm/your-app-name-config/relbranches/{{version}}/{{ENV}}/modules dest=/opt/jboss-eap-6.4/modules force=yes export=true - name: deploy your-app-name jboss bin configuration from svn subversion: {{svn_user}}=user_name password={{password}} repo=http://vcsorange/pwm/your-app-name-config/relbranches/{{version}}/{{ENV}}/bin dest=/opt/jboss-eap-6.4/bin force=yes export=true
  • 16. - name: create jboss conf directory for service file: path=/etc/jboss-as state=directory owner=root group=root mode=0775 - name: create jboss pid directory file: path=/var/run/jboss-as state=directory owner=root group=root mode=0775 - name: copy stom-jboss standalpone service file when: check_jboss_path.stat.exists command: "{{item}}" args: chdir: /opt/jboss-eap-6.4/ with_items: - cp /opt/jboss-eap-6.4/bin/init.d/your-app-name-jboss /etc/init.d/ - cp /opt/jboss-eap-6.4/bin/init.d/jboss-as.conf /etc/jboss-as/ - chown root:root /etc/init.d/your-app-name-jboss - chmod 755 /etc/init.d/your-app-name-jboss - chmod 775 -R /var/run/jboss-as - chmod 755 /etc/jboss-as/jboss-as.conf
  • 17. - name: deploy your-app-name jboss standalone configuration from svn subversion: {{svn_user}}=user_name password={{password}} repo=http://vcsorange/pwm/your-app-name- config/relbranches/{{version}}/STG/standalone-your-app-name dest=/opt/jboss- eap-6.4/standalone-your-app-name force=yes export=true - name: deploy UI war maven_artifact: group_id=com.company.group artifact_id=your-app-name-ui extension=war version={{version}}-RC1-SNAPSHOT repository_url=http://{{nexus_url}}:{{port}}/nexus/content/repositories/stellaCIsnaps hots dest=/opt/jboss-eap-6.4/standalone-your-app-name/deployments/your- app-name-ui.war - name: deploy services war maven_artifact: group_id=com.company.your-app-name artifact_id=your-app- name-services-war extension=war version={{version}}-RC1-SNAPSHOT repository_url=http://{{nexus_url}}:{{port}}/nexus/content/repositories/stellaCIsnaps hots dest=/opt/jboss-eap-6.4/standalone-your-app-name/deployments/your- app-name-services.war
  • 18. - name: change folder permissions file: path=/opt/jboss-eap-6.4 owner={{user}} group={{user}} mode=755 recurse=yes - name: change folder permissions file: path=/www/a/logs/your-app-name owner={{user}} group={{user}} mode=755 recurse=yes - name: Start or Stop Service service: name=storm-jboss state=restarted tags: - Start - name: Start or Stop Service service: name=storm-jboss state=stopped tags: - Stop
  • 19.  ansible-playbook -i stg playbooks/configure_jboss_stage.yml -- extra-vars "version=6.1.0 role=webserver ENV=STG“ –skip-tags=“stop”