SlideShare a Scribd company logo
1 of 43
Download to read offline
[ jonny@latticework ~ ] $ cat .profile
# Author: chusiang (at) drx.tw
# Blog: http://note.drx.tw
# Modified: 2017-03-10 18:43
The Ansible automated configuration tips
of modern IT engineer must be know (2/e)
About Me
• Chu-Siang Lai
• More than 1 year experience
in Ansible use.
• Maintaining Ansible Roles:
• php7 (php-fpm)
• switch-apt-mirror
• vim-and-vi-mode
• zabbix-agent
2
Ready ?
Go
3
Outline
I. What is the modern IT Engineer ?
4
Outline
I. What is the modern IT Engineer ?
II. What are the benefits of use an automated
configuration management tool ?
5
Outline
I. What is the modern IT Engineer ?
II. What are the benefits of use an automated
configuration management tool ?
III. What is the Ansible ?
6
Outline
I. What is the modern IT Engineer ?
II. What are the benefits of use an automated
configuration management tool ?
III. What is the Ansible ?
IV. How to deploy the Ansible environment ?
7
Outline
I. What is the modern IT Engineer ?
II. What are the benefits of use an automated
configuration management tool ?
III. What is the Ansible ?
IV. How to deploy the Ansible environment ?
V. How to use the Ansible ?
8
Outline
I. What is the modern IT Engineer ?
II. What are the benefits of use an automated
configuration management tool ?
III. What is the Ansible ?
IV. How to deploy the Ansible environment ?
V. How to use the Ansible ?
VI. Q & A
9
Ⅰ. What is the modern IT Engineer ?
10
DevOps
What is modern IT Engineer ?
11
CLASSICS MODERN
UP AND RUNNING More than hours Less than 30 minutes
GET TO WORK
Knock the many
commands, ofter forgot
the anything change
Manage machines
with coding
GET OFF WORK Write the job diary
Write the tools
(for get off work early)
Ⅱ. What are the benefits of use an automated
configuration management tool ?
12
Using Ansible,
We can reduce the
service interruption time,
test the infrastructure,
reduce the risk of accidents
, and seamless integration
the development, testing
and production environment.
source: Ansible as Automation Glue
13
HUMAN AUTOMATE
REPEAT COSTS High Low
HUMAN ERROR High Low
TESTABILITY Hard Easy
MODULARIZATION Hard Easy
GET OFF WORK EARLY Hard Easy
What are the benefits of use an automated
configuration management tool ?
14
Ⅲ. What is the Ansible ?
15
Ansible named from novel

Ender's Game . It is
a fictional superluminal
communication device.
With Ansible, we can control
the servers like Ender
command the warships.
source: https://goo.gl/4xftZT
16
Ansible is the rising
popularity of DevOps
automation software
in recent years
Using agentless architecture,
flexible deployment,
easy to read, so become a
popular DevOps tool, quickly.
source: http://goo.gl/yJbWtz
17
What is the Ansible ?
• It's Configuration Management Tools (Infrastructure as
Code) like the Puppet, SaltStack, Chef.
• Easy to use.
• Somebody in the DevOps world.
• Using the Push architecture, no need the agent, only
need the Python and SSH.



• Python base !!!
18
Ⅳ. How to deploy the Ansible environment ?
19
concept, setup, setting
How does the Ansible work ?
Define the Managed node with inventory, communicate with SSH and Python.
20
How to setup the Ansible ?
• Only install the Ansible on Control Machine; 

the Managed node need the Python 2.5+ and SSH.
21
# Debian & Ubuntu (apt).
$ sudo apt-get install ansible
# RHEL & CentOS (yum).
$ sudo yum install ansible
# Mac OS X (homebrew).
$ brew install ansible
# Python (pip).
$ sudo pip install ansible
How to setting the Ansible ?
• Setting the inventory (host file) path, remote username
and ssh key of Managed node with ansible.cfg.
22
$ vim ansible.cfg
[defaults]
# Setting the inventory file path.
hostfile = hosts
# Remote username.
remote_user = docker
#private_key_file = ~/.ssh/id_rsa
# Don’t checking ssh key.
host_key_checking = False
What is the inventory ?
• Define the host address, group of Managed node,

it can also setting the ssh connect config.
23
$ vim hosts
# ansible_ssh_host: remote ssh host address.
# ansible_ssh_port: remote ssh port.
# ansible_ssh_user: remote ssh username.
# ansible_ssh_private_key_file: local ssh private key.
# ansible_ssh_pass: remote ssh password (recommend use the private key).
[dev]
ansible-demo ansible_ssh_host=127.0.0.1 ansible_ssh_pass=pwd
[test]
ansible-test ansible_ssh_host=172.10.10.1 ansible_ssh_port=2222
[prod]
ansible-prod ansible_ssh_host=10.10.10.1 ansible_ssh_user=deploy
Ⅴ. How to use the Ansible
24
Ad-Hoc command, Playbook* (Module)
Ad-Hoc
command
and
25
Playbook
What is the Ad-Hoc command ?
• Short (temporality) command, like the normal (classic)
command line mode, operate it with one line at a time.
26
# classic command line
$ ping ansible-demo.local
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.037 ms
--- localhost ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.037/0.037/0.037/0.000 ms
$ echo Hello World
Hello World
What is the Ad-Hoc command ?
• Use the Module after the -m, please refer the official
documents for detailed usage.
27
# ansible <host-pattern> -m [module_name] [-a args] [options]
$ ansible all -m ping
ansible-demo.local | SUCCESS => {
"changed": false,
"ping": "pong"
}
$ ansible all -m command -a "echo Hello World"
ansible-demo.local | SUCCESS | rc=0 >>
Hello World
What is the Playbooks ?
• More structured than the Shell
Script language, it’s good for
large deployment.
• Use the YAML format, the
playbook is like documents,
easy to read.
• There are usually the Play,
Task and Module.
• Use the Jinja2 (template)
expression, it’s support the
variables, conditional judgment,
loop and other syntax.
source: http://goo.gl/GKJvXn
28
What is the Playbooks ?
• A Playbook can have multiple Play and multiple Tasks.
• The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).

























29
$ vim example.yml
---
- name: This is a Super-basic playbook.
hosts: all
tasks:
- name: Hello World
command: echo "Hello World"
- name: Install Vim & Emacs
become: yes
apt: name={{ item }} state=present
with_items:
- vim
- emacs
# Expelliarmus for Emacs.
- name: use vi-mode in readline
become: yes
lineinfile: dest=/etc/inputrc line="set editing-mode vi"
What is the Playbooks ?
• A Playbook can have multiple Play and multiple Tasks.
• The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).

























30
$ vim example.yml
---
- name: This is a Super-basic playbook.
hosts: all
tasks:
- name: Hello World
command: echo "Hello World"
- name: Install Vim & Emacs
become: yes
apt: name={{ item }} state=present
with_items:
- vim
- emacs
# Expelliarmus for Emacs.
- name: use vi-mode in readline
become: yes
lineinfile: dest=/etc/inputrc line="set editing-mode vi"
Play
What is the Playbooks ?
• A Playbook can have multiple Play and multiple Tasks.
• The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).

























31
$ vim example.yml
---
- name: This is a Super-basic playbook.
hosts: all
tasks:
- name: Hello World
command: echo "Hello World"
- name: Install Vim & Emacs
become: yes
apt: name={{ item }} state=present
with_items:
- vim
- emacs
# Expelliarmus for Emacs.
- name: use vi-mode in readline
become: yes
lineinfile: dest=/etc/inputrc line="set editing-mode vi"
Task 1
Task 2
Task 3
What is the Playbooks ?
• A Playbook can have multiple Play and multiple Tasks.
• The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).

























32
$ vim example.yml
---
- name: This is a Super-basic playbook.
hosts: all
tasks:
- name: Hello World
command: echo "Hello World"
- name: Install Vim & Emacs
become: yes
apt: name={{ item }} state=present
with_items:
- vim
- emacs
# Expelliarmus for Emacs.
- name: use vi-mode in readline
become: yes
lineinfile: dest=/etc/inputrc line="set editing-mode vi"
Module
What is the Playbooks ?
• Run the playbook of example.yml.
33
$ ansible-playbook example.yml
PLAY [This is a Super-basic playbook.] *****************************************
TASK [setup] *******************************************************************
ok: [ansible-demo.local]
TASK [Hello World] *************************************************************
changed: [ansible-demo.local]
TASK [Install Vim & Emacs] *****************************************************
changed: [ansible-demo.local] => (item=[u'vim', u'emacs'])
TASK [use vi-mode in readline] *************************************************
changed: [ansible-demo.local]
PLAY RECAP *********************************************************************
ansible-demo.local : ok=4 changed=3 unreachable=0 failed=0
What is the Playbooks ?
• Run the playbook of example.yml.
34
$ ansible-playbook example.yml
PLAY [This is a Super-basic playbook.] *****************************************
TASK [setup] *******************************************************************
ok: [ansible-demo.local]
TASK [Hello World] *************************************************************
changed: [ansible-demo.local]
TASK [Install Vim & Emacs] *****************************************************
changed: [ansible-demo.local] => (item=[u'vim', u'emacs'])
TASK [use vi-mode in readline] *************************************************
changed: [ansible-demo.local]
PLAY RECAP *********************************************************************
ansible-demo.local : ok=4 changed=3 unreachable=0 failed=0
Setup
Recap
Module
35
http://docs.ansible.com/ansible/list_of_commands_modules.html
Docs » commands Modules
yes = requirement to use
Play Lab
39
Going to https://goo.gl/EYJ40O
(for get the lab of Control Machine*1 and Managed node*2).
Control the Managed node with Ansible
40
Try the Ansible on Jupyter notebook by myself.
Q & A
Pleast do not
pat and feed !
42
E N D

More Related Content

What's hot

Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansibleKhizer Naeem
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environmentSoshi Nemoto
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them AllTim Fairweather
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartHenry Stamerjohann
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
#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
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
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
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with AnsibleAhmed AbouZaid
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點William Yeh
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 

What's hot (20)

Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Ansible Crash Course
Ansible Crash CourseAnsible Crash Course
Ansible Crash Course
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
Introducing Ansible
Introducing AnsibleIntroducing Ansible
Introducing Ansible
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
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
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 

Viewers also liked

Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTreeChu-Siang Lai
 
Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Chu-Siang Lai
 
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & WindowsChu-Siang Lai
 
Automate with Ansible basic (3/e)
Automate with Ansible basic (3/e)Automate with Ansible basic (3/e)
Automate with Ansible basic (3/e)Chu-Siang Lai
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)Continuous Delivery Workshop with Ansible x GitLab CI (2nd)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)Chu-Siang Lai
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIChu-Siang Lai
 
Continuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CIContinuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CIChu-Siang Lai
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧Chu-Siang Lai
 
Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)Chu-Siang Lai
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Chu-Siang Lai
 
現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧Chu-Siang Lai
 

Viewers also liked (11)

Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTree
 
Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)
 
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
現代 IT 人一定要知道的 Ansible 自動化組態技巧 Ⅱ - Roles & Windows
 
Automate with Ansible basic (3/e)
Automate with Ansible basic (3/e)Automate with Ansible basic (3/e)
Automate with Ansible basic (3/e)
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)Continuous Delivery Workshop with Ansible x GitLab CI (2nd)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd)
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CI
 
Continuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CIContinuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CI
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧
 
Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
 
現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧
 

Similar to Automate with Ansible basic (2/e, English)

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
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)iman darabi
 
Getting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfGetting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfssuserd254491
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleOmid Vahdaty
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)iman darabi
 
Network Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleNetwork Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleAPNIC
 
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot
 
Aucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricksAucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricksGlen Ogilvie
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101APNIC
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupRamesh Godishela
 
Configuration primer
Configuration primerConfiguration primer
Configuration primerfeanil
 

Similar to Automate with Ansible basic (2/e, English) (20)

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)
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
 
Getting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfGetting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdf
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
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
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Ansible101
Ansible101Ansible101
Ansible101
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 
Network Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleNetwork Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with Ansible
 
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Aucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricksAucklug slides - desktop tips and tricks
Aucklug slides - desktop tips and tricks
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetup
 
Configuration primer
Configuration primerConfiguration primer
Configuration primer
 
Ansible
AnsibleAnsible
Ansible
 

More from Chu-Siang Lai

The System Engineer in Agile Team
The System Engineer in Agile TeamThe System Engineer in Agile Team
The System Engineer in Agile TeamChu-Siang Lai
 
Is it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationIs it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationChu-Siang Lai
 
See the Agile from Mindset
See the Agile from MindsetSee the Agile from Mindset
See the Agile from MindsetChu-Siang Lai
 
Writing skills for Information Technology
Writing skills for Information TechnologyWriting skills for Information Technology
Writing skills for Information TechnologyChu-Siang Lai
 
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 Continuous Delivery Workshop with Ansible x GitLab CI (5th) Continuous Delivery Workshop with Ansible x GitLab CI (5th)
Continuous Delivery Workshop with Ansible x GitLab CI (5th)Chu-Siang Lai
 
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Chu-Siang Lai
 
使用 Multi-sites 技術快速建置多 Drupal 網站
使用 Multi-sites 技術快速建置多 Drupal 網站使用 Multi-sites 技術快速建置多 Drupal 網站
使用 Multi-sites 技術快速建置多 Drupal 網站Chu-Siang Lai
 
歡迎來到 Ubuntu 9.10 Release Party (台中)
歡迎來到 Ubuntu 9.10 Release Party (台中)歡迎來到 Ubuntu 9.10 Release Party (台中)
歡迎來到 Ubuntu 9.10 Release Party (台中)Chu-Siang Lai
 
無痛入門 Chromecast
無痛入門 Chromecast無痛入門 Chromecast
無痛入門 ChromecastChu-Siang Lai
 
Ubuntu 藍星侵略計劃
Ubuntu 藍星侵略計劃Ubuntu 藍星侵略計劃
Ubuntu 藍星侵略計劃Chu-Siang Lai
 
Intro of Network, WiFi on Ubuntu
Intro of Network, WiFi on UbuntuIntro of Network, WiFi on Ubuntu
Intro of Network, WiFi on UbuntuChu-Siang Lai
 

More from Chu-Siang Lai (16)

My DevOps Tour 2.3
My DevOps Tour 2.3My DevOps Tour 2.3
My DevOps Tour 2.3
 
The System Engineer in Agile Team
The System Engineer in Agile TeamThe System Engineer in Agile Team
The System Engineer in Agile Team
 
Is it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationIs it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automation
 
My DevOps Tour 0.1
My DevOps Tour 0.1My DevOps Tour 0.1
My DevOps Tour 0.1
 
See the Agile from Mindset
See the Agile from MindsetSee the Agile from Mindset
See the Agile from Mindset
 
Writing skills for Information Technology
Writing skills for Information TechnologyWriting skills for Information Technology
Writing skills for Information Technology
 
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 Continuous Delivery Workshop with Ansible x GitLab CI (5th) Continuous Delivery Workshop with Ansible x GitLab CI (5th)
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 
My DevOps Tour 1.0
My DevOps Tour 1.0My DevOps Tour 1.0
My DevOps Tour 1.0
 
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
 
helloTux 2012
helloTux 2012helloTux 2012
helloTux 2012
 
Unity & Googlizer
Unity & GooglizerUnity & Googlizer
Unity & Googlizer
 
使用 Multi-sites 技術快速建置多 Drupal 網站
使用 Multi-sites 技術快速建置多 Drupal 網站使用 Multi-sites 技術快速建置多 Drupal 網站
使用 Multi-sites 技術快速建置多 Drupal 網站
 
歡迎來到 Ubuntu 9.10 Release Party (台中)
歡迎來到 Ubuntu 9.10 Release Party (台中)歡迎來到 Ubuntu 9.10 Release Party (台中)
歡迎來到 Ubuntu 9.10 Release Party (台中)
 
無痛入門 Chromecast
無痛入門 Chromecast無痛入門 Chromecast
無痛入門 Chromecast
 
Ubuntu 藍星侵略計劃
Ubuntu 藍星侵略計劃Ubuntu 藍星侵略計劃
Ubuntu 藍星侵略計劃
 
Intro of Network, WiFi on Ubuntu
Intro of Network, WiFi on UbuntuIntro of Network, WiFi on Ubuntu
Intro of Network, WiFi on Ubuntu
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Automate with Ansible basic (2/e, English)

  • 1. [ jonny@latticework ~ ] $ cat .profile # Author: chusiang (at) drx.tw # Blog: http://note.drx.tw # Modified: 2017-03-10 18:43 The Ansible automated configuration tips of modern IT engineer must be know (2/e)
  • 2. About Me • Chu-Siang Lai • More than 1 year experience in Ansible use. • Maintaining Ansible Roles: • php7 (php-fpm) • switch-apt-mirror • vim-and-vi-mode • zabbix-agent 2
  • 4. Outline I. What is the modern IT Engineer ? 4
  • 5. Outline I. What is the modern IT Engineer ? II. What are the benefits of use an automated configuration management tool ? 5
  • 6. Outline I. What is the modern IT Engineer ? II. What are the benefits of use an automated configuration management tool ? III. What is the Ansible ? 6
  • 7. Outline I. What is the modern IT Engineer ? II. What are the benefits of use an automated configuration management tool ? III. What is the Ansible ? IV. How to deploy the Ansible environment ? 7
  • 8. Outline I. What is the modern IT Engineer ? II. What are the benefits of use an automated configuration management tool ? III. What is the Ansible ? IV. How to deploy the Ansible environment ? V. How to use the Ansible ? 8
  • 9. Outline I. What is the modern IT Engineer ? II. What are the benefits of use an automated configuration management tool ? III. What is the Ansible ? IV. How to deploy the Ansible environment ? V. How to use the Ansible ? VI. Q & A 9
  • 10. Ⅰ. What is the modern IT Engineer ? 10 DevOps
  • 11. What is modern IT Engineer ? 11 CLASSICS MODERN UP AND RUNNING More than hours Less than 30 minutes GET TO WORK Knock the many commands, ofter forgot the anything change Manage machines with coding GET OFF WORK Write the job diary Write the tools (for get off work early)
  • 12. Ⅱ. What are the benefits of use an automated configuration management tool ? 12
  • 13. Using Ansible, We can reduce the service interruption time, test the infrastructure, reduce the risk of accidents , and seamless integration the development, testing and production environment. source: Ansible as Automation Glue 13
  • 14. HUMAN AUTOMATE REPEAT COSTS High Low HUMAN ERROR High Low TESTABILITY Hard Easy MODULARIZATION Hard Easy GET OFF WORK EARLY Hard Easy What are the benefits of use an automated configuration management tool ? 14
  • 15. Ⅲ. What is the Ansible ? 15
  • 16. Ansible named from novel
 Ender's Game . It is a fictional superluminal communication device. With Ansible, we can control the servers like Ender command the warships. source: https://goo.gl/4xftZT 16
  • 17. Ansible is the rising popularity of DevOps automation software in recent years Using agentless architecture, flexible deployment, easy to read, so become a popular DevOps tool, quickly. source: http://goo.gl/yJbWtz 17
  • 18. What is the Ansible ? • It's Configuration Management Tools (Infrastructure as Code) like the Puppet, SaltStack, Chef. • Easy to use. • Somebody in the DevOps world. • Using the Push architecture, no need the agent, only need the Python and SSH.
 
 • Python base !!! 18
  • 19. Ⅳ. How to deploy the Ansible environment ? 19 concept, setup, setting
  • 20. How does the Ansible work ? Define the Managed node with inventory, communicate with SSH and Python. 20
  • 21. How to setup the Ansible ? • Only install the Ansible on Control Machine; 
 the Managed node need the Python 2.5+ and SSH. 21 # Debian & Ubuntu (apt). $ sudo apt-get install ansible # RHEL & CentOS (yum). $ sudo yum install ansible # Mac OS X (homebrew). $ brew install ansible # Python (pip). $ sudo pip install ansible
  • 22. How to setting the Ansible ? • Setting the inventory (host file) path, remote username and ssh key of Managed node with ansible.cfg. 22 $ vim ansible.cfg [defaults] # Setting the inventory file path. hostfile = hosts # Remote username. remote_user = docker #private_key_file = ~/.ssh/id_rsa # Don’t checking ssh key. host_key_checking = False
  • 23. What is the inventory ? • Define the host address, group of Managed node,
 it can also setting the ssh connect config. 23 $ vim hosts # ansible_ssh_host: remote ssh host address. # ansible_ssh_port: remote ssh port. # ansible_ssh_user: remote ssh username. # ansible_ssh_private_key_file: local ssh private key. # ansible_ssh_pass: remote ssh password (recommend use the private key). [dev] ansible-demo ansible_ssh_host=127.0.0.1 ansible_ssh_pass=pwd [test] ansible-test ansible_ssh_host=172.10.10.1 ansible_ssh_port=2222 [prod] ansible-prod ansible_ssh_host=10.10.10.1 ansible_ssh_user=deploy
  • 24. Ⅴ. How to use the Ansible 24 Ad-Hoc command, Playbook* (Module)
  • 26. What is the Ad-Hoc command ? • Short (temporality) command, like the normal (classic) command line mode, operate it with one line at a time. 26 # classic command line $ ping ansible-demo.local PING localhost (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.037 ms --- localhost ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.037/0.037/0.037/0.000 ms $ echo Hello World Hello World
  • 27. What is the Ad-Hoc command ? • Use the Module after the -m, please refer the official documents for detailed usage. 27 # ansible <host-pattern> -m [module_name] [-a args] [options] $ ansible all -m ping ansible-demo.local | SUCCESS => { "changed": false, "ping": "pong" } $ ansible all -m command -a "echo Hello World" ansible-demo.local | SUCCESS | rc=0 >> Hello World
  • 28. What is the Playbooks ? • More structured than the Shell Script language, it’s good for large deployment. • Use the YAML format, the playbook is like documents, easy to read. • There are usually the Play, Task and Module. • Use the Jinja2 (template) expression, it’s support the variables, conditional judgment, loop and other syntax. source: http://goo.gl/GKJvXn 28
  • 29. What is the Playbooks ? • A Playbook can have multiple Play and multiple Tasks. • The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).
 
 
 
 
 
 
 
 
 
 
 
 
 29 $ vim example.yml --- - name: This is a Super-basic playbook. hosts: all tasks: - name: Hello World command: echo "Hello World" - name: Install Vim & Emacs become: yes apt: name={{ item }} state=present with_items: - vim - emacs # Expelliarmus for Emacs. - name: use vi-mode in readline become: yes lineinfile: dest=/etc/inputrc line="set editing-mode vi"
  • 30. What is the Playbooks ? • A Playbook can have multiple Play and multiple Tasks. • The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).
 
 
 
 
 
 
 
 
 
 
 
 
 30 $ vim example.yml --- - name: This is a Super-basic playbook. hosts: all tasks: - name: Hello World command: echo "Hello World" - name: Install Vim & Emacs become: yes apt: name={{ item }} state=present with_items: - vim - emacs # Expelliarmus for Emacs. - name: use vi-mode in readline become: yes lineinfile: dest=/etc/inputrc line="set editing-mode vi" Play
  • 31. What is the Playbooks ? • A Playbook can have multiple Play and multiple Tasks. • The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).
 
 
 
 
 
 
 
 
 
 
 
 
 31 $ vim example.yml --- - name: This is a Super-basic playbook. hosts: all tasks: - name: Hello World command: echo "Hello World" - name: Install Vim & Emacs become: yes apt: name={{ item }} state=present with_items: - vim - emacs # Expelliarmus for Emacs. - name: use vi-mode in readline become: yes lineinfile: dest=/etc/inputrc line="set editing-mode vi" Task 1 Task 2 Task 3
  • 32. What is the Playbooks ? • A Playbook can have multiple Play and multiple Tasks. • The example uses the Play*1, Task*3 and Module*3 (command, apt, lineinfile).
 
 
 
 
 
 
 
 
 
 
 
 
 32 $ vim example.yml --- - name: This is a Super-basic playbook. hosts: all tasks: - name: Hello World command: echo "Hello World" - name: Install Vim & Emacs become: yes apt: name={{ item }} state=present with_items: - vim - emacs # Expelliarmus for Emacs. - name: use vi-mode in readline become: yes lineinfile: dest=/etc/inputrc line="set editing-mode vi" Module
  • 33. What is the Playbooks ? • Run the playbook of example.yml. 33 $ ansible-playbook example.yml PLAY [This is a Super-basic playbook.] ***************************************** TASK [setup] ******************************************************************* ok: [ansible-demo.local] TASK [Hello World] ************************************************************* changed: [ansible-demo.local] TASK [Install Vim & Emacs] ***************************************************** changed: [ansible-demo.local] => (item=[u'vim', u'emacs']) TASK [use vi-mode in readline] ************************************************* changed: [ansible-demo.local] PLAY RECAP ********************************************************************* ansible-demo.local : ok=4 changed=3 unreachable=0 failed=0
  • 34. What is the Playbooks ? • Run the playbook of example.yml. 34 $ ansible-playbook example.yml PLAY [This is a Super-basic playbook.] ***************************************** TASK [setup] ******************************************************************* ok: [ansible-demo.local] TASK [Hello World] ************************************************************* changed: [ansible-demo.local] TASK [Install Vim & Emacs] ***************************************************** changed: [ansible-demo.local] => (item=[u'vim', u'emacs']) TASK [use vi-mode in readline] ************************************************* changed: [ansible-demo.local] PLAY RECAP ********************************************************************* ansible-demo.local : ok=4 changed=3 unreachable=0 failed=0 Setup Recap
  • 37.
  • 38. Docs » commands Modules yes = requirement to use
  • 40. Going to https://goo.gl/EYJ40O (for get the lab of Control Machine*1 and Managed node*2). Control the Managed node with Ansible 40
  • 41. Try the Ansible on Jupyter notebook by myself.
  • 42. Q & A Pleast do not pat and feed ! 42
  • 43. E N D