Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is...
Transcript of Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is...
![Page 1: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/1.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Quick-StartYour Instructor:
Twitter: @Tybstar
Friday, May 24, 13
![Page 2: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/2.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Questions during the presentation?
Join the #ansible IRC channel on FreeNode:
http://webchat.freenode.net/
Friday, May 24, 13
![Page 3: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/3.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
What is Ansible?
• Orchestration
• Software Deployment
• Configuration Management
Friday, May 24, 13
![Page 4: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/4.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
How is it different?
• No custom PKI–SSH-based
• Agentless architecture
• Configuration as data, not code
• Batteries-included
• Full configuration management, orchestration, and deployment
Friday, May 24, 13
![Page 5: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/5.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Quick-Start Outline
• Ansible Basics
• Host Inventory
• Playbooks
• Modules
• Variables
• Full Example Walkthrough
Friday, May 24, 13
![Page 6: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/6.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
An Example---- name: install and start apache hosts: all user: root
tasks:
- name: install httpd yum: name=httpd state=present
- name: start httpd service: name=httpd state=running
Friday, May 24, 13
![Page 7: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/7.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Ansible Architecture
Friday, May 24, 13
![Page 8: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/8.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Install and Configure
• Your choice:
• From Git (recommended for the examples in this presentation)
• From Packages
• From PIP
http://ansible.cc/docs/gettingstarted.html
Friday, May 24, 13
![Page 9: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/9.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Demo
• Ad-Hoc command example
• Basic playbook example
Friday, May 24, 13
![Page 10: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/10.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Host Inventory: Basics
[web]webserver-1.example.comwebserver-2.example.com
[db]dbserver-1.example.com
Friday, May 24, 13
![Page 11: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/11.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Host Inventory: Ranges
[web]webserver-[01:25].example.com
[db]dbserver-[a:f].example.com
Friday, May 24, 13
![Page 12: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/12.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Host Inventory: More
• Non-standard SSH ports:
webserver.example.com:2222
• SSH tunnel:
myhost ansible_ssh_port=5555 ansible_ssh_host=192.168.0.1
Friday, May 24, 13
![Page 13: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/13.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Inventory: child groups[east]host1host2
[west]host3host4
[us:children]eastwest
Friday, May 24, 13
![Page 14: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/14.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Connection Types
• paramiko (Python SSH module)
• ssh
• local
• chroot
Friday, May 24, 13
![Page 15: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/15.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Ansible Concepts
• Playbooks
• Plays
• Tasks and handlers
• Modules
• Variables
Friday, May 24, 13
![Page 16: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/16.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Playbooks
• Playbooks contain Plays
• Plays contain Tasks
• Tasks call Modules
• Everything is sequentially ordered–strict dependency ordering. Handlers can be triggered by tasks, and will run at the end, once.
Friday, May 24, 13
![Page 17: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/17.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Tasks• A task calls a module and may have
parameters. Ansible has a lot of modules included, and you can write your own.
tasks: - name: ensure apache is at the latest version yum: name=httpd state=latest
- name: write the apache config file template: src=templates/httpd.j2 dest=/etc/httpd.conf
- name: ensure apache is running service: name=httpd state=started
Friday, May 24, 13
![Page 18: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/18.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Modules• Ansible is “batteries included”:
add_hostaptapt_keyapt_repositoryassembleasync_statusasync_wrapperauthorized_keybzrcloudformationcommandcopycrondebugdjango_manageeasy_installec2ec2_factsec2_volfacter
failfetchfilefireballgemget_urlgitgroupgroup_byhghomebrewini_filelineinfilelvglvolmacportsmailmongodb_usermountmysql_db
mysql_usernagiosnetscalerohaiopenbsd_pkgopkgpacmanpausepingpippkginpostgresql_dbpostgresql_userrabbitmq_parameterrabbitmq_pluginrabbitmq_userrabbitmq_vhostrawrhn_channel
s3scriptsebooleanselinuxservicesetupshellslurpsubversionsupervisorctlsvr4pkgsysctltemplateuriuservagrantvirtwait_foryumzfs
Friday, May 24, 13
![Page 19: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/19.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Modules, Continued
• Package management: yum, apt
• Remote execution: command, shell
• Service management: service
• File handling: copy, template
• SCM: git, subversion
Friday, May 24, 13
![Page 20: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/20.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
command and shell• Execute arbitrary commands on remote
hosts.
• Long lines can wrap:
- name: turn off selinux command: /sbin/setenforce 0
- name: ignore return code shell: /usr/bin/somecommand && /bin/true
- name: Copy ansible inventory file to client copy: src=/etc/ansible/hosts dest=/etc/ansible/hosts owner=root group=root mode=0644
Friday, May 24, 13
![Page 21: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/21.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
copy and template• Copy a file from Ansible host to managed
host:
• Evaluate a Jinja2 template:
- name: copy a file copy: src=files/ntp.conf dest=/etc/ntp/ntp.conf owner=root group=root mode=0644
- name: Copy ansible inventory file to client template: src=templates/motd dest=/etc/motd owner=root group=root mode=0644
Friday, May 24, 13
![Page 22: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/22.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
apt and yum• Package management:
• Install a set of packages in one transaction:
- name: install httpd yum: name=httpd state=present
- name: install httpd apt: name=httpd=2.0 state=present
- name: install a set of packages yum: name={{ item }} state=present with_items: - httpd - php - git - mysql-client
Friday, May 24, 13
![Page 23: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/23.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
A Playbook---- name: install and start apache hosts: all user: root
tasks:
- name: install httpd yum: name=httpd state=latest
- name: start httpd service: name=httpd state=running
Playbook Play Tasks
Friday, May 24, 13
![Page 24: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/24.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
Friday, May 24, 13
![Page 25: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/25.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
hosts to target in this play
Friday, May 24, 13
![Page 26: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/26.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
variables
Friday, May 24, 13
![Page 27: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/27.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
tasks in this play
Friday, May 24, 13
![Page 28: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/28.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
the name of an
individual task
Friday, May 24, 13
![Page 29: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/29.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
the task’s action
Friday, May 24, 13
![Page 30: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/30.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
another task
Friday, May 24, 13
![Page 31: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/31.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---- name: webserver configuration play hosts: webservers
vars: http_port: 80 max_clients: 200
tasks: - name: ensure that apache is installed yum: name=httpd state=present
- name: write the apache config file template: src=httpd.j2 dest=/etc/httpd.conf notify: - restart apache
- name: ensure apache is running service: name=httpd state=started
handlers: - name: restart apache service: name=httpd state=restarted
we call the
handler here
the handler
itself
Friday, May 24, 13
![Page 32: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/32.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Playbook Demo
Friday, May 24, 13
![Page 33: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/33.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Playbooks Continued
• Variables
• Roles
Friday, May 24, 13
![Page 34: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/34.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Variables
• There are several sources for variables:
• Playbooks
• Inventory (group vars, host vars)
• Command line
• Discovered variables (facts)
Friday, May 24, 13
![Page 35: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/35.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Variables• You can use variables in action lines:
---- hosts: webservers vars: vhost: myhost.com
tasks: - name: create a virtual host file for {{ vhost }} template: src=vhost.j2 dest=/etc/httpd/conf.d/{{ vhost }}
- name: do something against {{ inventory_hostname }} command: echo “I’m on {{ inventory_hostname }}”
Friday, May 24, 13
![Page 36: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/36.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Facts• Discovered variables about systems
• Some examples:
"ansible_os_family": "RedHat", "ansible_distribution": "CentOS", "ansible_hostname": "webserver1", "ansible_default_ipv4": { "address": "172.16.183.141", "alias": "eth0", ... }
ansible -m setup hostname
Friday, May 24, 13
![Page 37: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/37.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Using Variables• In a playbook:
tasks: - name: report this machine’s IP command: echo “My IP is {{ ansible_default_ipv4.address }}”
• In a template:This is a template file, evaluated and then sent to the target machine.
This machine’s IP address is {{ ansible_default_ipv4.address }}
Friday, May 24, 13
![Page 38: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/38.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
---# Variables for the HAproxy configuration
# HAProxy supports "http" and "tcp".mode: http
# Port on which HAProxy should listenlistenport: 8888
# A name for the proxy daemon, this will be the# suffix in the logs.daemonname: myapplb
# Balancing algorithm:balance: roundrobin
# Ethernet interface for haproxyiface: '{{ ansible_default_ipv4.interface }}'
Friday, May 24, 13
![Page 39: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/39.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Playbook Demo
Friday, May 24, 13
![Page 40: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/40.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Roles
• Project organizational tool
• Reusable components
• Defined filesystem structure
Friday, May 24, 13
![Page 41: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/41.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Roles
webserver/!"" files# !"" epel.repo.j2# %"" RPM-GPG-KEY-EPEL-6!"" handlers# %"" main.yml!"" tasks# %"" main.yml%"" templates %"" httpd.conf.j2
Friday, May 24, 13
![Page 42: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/42.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Playbook Demo
• Roles
Friday, May 24, 13
![Page 43: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/43.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Rolling Updates
• Serial Keyword
Friday, May 24, 13
![Page 44: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/44.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Orchestration Example
The user executes an Ansible playbook which contains step-by-step instructions on how to perform the update.
Playbooks are simple, human-readable descriptions of IT workflows.
Friday, May 24, 13
![Page 45: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/45.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Orchestration Example
This step updates the app server tier. The servers are going to be updated ten at a time, in a rolling update.
Ansible will talk to the load balancers to coordinate each batch. A maintenance window is also set on the monitoring system.
Friday, May 24, 13
![Page 46: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/46.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Orchestration Example
Now the same thing happens for the web server tier.
Friday, May 24, 13
![Page 47: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/47.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Orchestration Example
Finally, Ansible returns a summary of tasks performed.
Ansible can be configured to store data in a wide variety of data sources, send email reports, and more. If any errors occurred during any of the steps, the administrator will be notified.
Friday, May 24, 13
![Page 48: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/48.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
A Full Example
• Orchestration of a multi-tier web application
Friday, May 24, 13
![Page 49: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/49.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
AnsibleFest!• Inaugural Ansible users and developers
conference
• Thursday, June 13, Boston, Mass.
• Save 20% off a ticket with code QUICKSTARTER
http://www.ansibleworks.com/fest/
Friday, May 24, 13
![Page 50: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/50.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
AnsibleWorks
• Consulting/Training services available
• Beta of AnsibleWorks Suite coming soon!
Friday, May 24, 13
![Page 51: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/51.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Next Steps• Documentation
• Example Playbooks
• IRC
• Mailing List and Newsletter
http://www.ansibleworks.com/
http://ansible.cc/
Friday, May 24, 13
![Page 52: Quick-Start - store.dockerme.ir fileCopyright (C) 2013 AnsibleWorks, Inc. Modules • Ansible is “batteries included”: add_host apt apt_key apt_repository assemble async_status](https://reader030.fdocuments.in/reader030/viewer/2022041210/5dd0a507d6be591ccb61fee2/html5/thumbnails/52.jpg)
Copyright (C) 2013 AnsibleWorks, Inc.
Q&A
Friday, May 24, 13