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
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
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)
the infrastructure, reduce the risk of accidents , and seamless integration the development, testing and production environment. source: Ansible as Automation Glue 13
(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
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
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
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"
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
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
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