Mastering Automation With Ansible

Mastering Automation With Ansible

Ansible DevOps Automation TooL:


1. Welcome to Mastering Ansible

 2. configuration management and orchestration
3. Environment Setup
4. Installation using Ansible
 5. Inventory :

i) The concept of the inventory file and how Ansible uses it

 ii) Configure a local inventory file with hostnames and groups (dev)

6. Host Selection

 Use host patterns to target a subset of the full inventory: all, *, <hostname>, <groupname>, :, !
 7. Tasks :

i) Learn about the basic building block of Ansible: the task.

 ii) Understand the structure of tasks: modules and arguments.
 iii) Execute ad-hoc tasks using the ansible command with the ping and command modules
 8. Plays:
 i) Group tasks for a common set of hosts together into plays
 ii) Create our first playbook (hostname.yml) to encode the command task  into an Ansible YAML file.
 9. PlayBook execution
 i)  Execute the hostname.yml playbook against hosts using the ansible-playbook command.
 ii) Review the output of the ansible-playbook command.
10. Playbook Deep Dive:
i) support playbook
 ii) Write a support playbook to do a full stack restart using the service module
 iii) Write a support playbook to check the status of the application stack.

Check that a host is listening on a specific TCP port and interface using the wait_for module

 11. Packages :
i)  apt
ii)  yum
iii) become
iv) with_items
 12. Service:
i) Manage running service state with the service module
 ii) Enable services to start on system startup with enabled=yes
 iii) Enable apache2 modules using the apache2_module ansible module.
 iv) Configure handlers to restart services only when needed.
 v)  Trigger handlers after configuration changes using notify.
13. Files: (Copy,file,template,lineinfile)
 i) Copy files and directories from a local machine to a target host
 ii) Set file attributes on the target host such as owner, group, and file mode
 iii) Create and remove symbolic links using the file module.
 iv) Edit a single line in a file on the target host using regular expressions and the lineinfile modul
 14. Application Module : pip
 i)  Install python dependencies using the pip module and a requirements.txt file
 ii) Setup a python virtual environment to host the python web application
 15. Roles :
 i)  Understand the purpose and structure of roles in ansible.
 ii) Use the ansible-galaxy command to create a role skeleton
 16. Converting to Roles: tasks, handlers
 i) Convert an ansible playbook to a role by copying tasks and handlers.
 ii)  Address ordering issues by moving service tasks after configuration tasks
 iii) Convert an ansible playbook to a role by copying files and templates.

Address ordering issues by moving service tasks after configuration tasks.

 17. Variables (facts,defaults,vars,with_dict,continued,vars_files,group_vars)

i) Use system facts as variables to configure host-specific values.

 ii)  Query a target host for system facts using the setup module.
 iii) Convert the remaining playbooks to roles.
 iv) Convert a file to a template to parameterize values and leverage passed variables.
 18. Variables (Vault):
 i) Encrypt variable values using ansible-vault.
 ii) Configure a vault password file to store the vault passphrase.
 iii) Add a configuration default to use a vault password file automatically.