diff --git a/README.md b/README.md index d5bcd38..55bea93 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Red Hat Certified Specialist in Ansible Automation (EX407) Preparation Course - [Understanding Core Components of Ansible](#understanding-core-components-of-ansible) - [Understanding Core Components of Ansible Part 1](#understanding-core-components-of-ansible-part-1) - + - [Understanding Core Components of Ansible Part 2](#understanding-core-components-of-ansible-part-2) ## Understanding Core Components of Ansible ### Understanding Core Components of Ansible Part 1 @@ -42,4 +42,67 @@ innaghiyev1c.mylabserver.com | SUCCESS => { "changed": false, "ping": "pong" } -``` \ No newline at end of file +``` + +### Understanding Core Components of Ansible Part 2 +This series of lessons lays the foundation for the remainder of the course content. Through a combination of lecture and command line demonstration, Students will gain a broad overview of Ansible. This particular lesson covers the following topics at a very high level: modules, variables, facts, plays, playbooks, and configuration files. + +- Modules + - Modules are essentially tools for particular tasks + - Modules can take (and usually do) take parameters + - They return JSON + - Can run from the command line or within a playbook + - There are a significant number of modules for many kinds of work + - Custom modules can be written + +- Variables + - Variable names should be letters, numbers and underscores + - Variables should always start with a letter + - Can be scoped by a group, host, or even ini a playbook + - Typically used for configuration values and various parameters + - Variables can also be used to store the return value of executed commands + - Ansible variables may also be dictionaries + - There are a number of predefined variables used by Ansible + +- Facts + - Facts provide certain information about given target host + - Facts are discovered by Ansible automatically when it reaches out to a host + - Fact gathering may be disabled + - Facts may be cached between playbook executions, but this is not default behavior + +``` +innaghiyev1c.mylabserver.com | SUCCESS => { + "ansible_facts": { + "ansible_all_ipv4_addresses": [ + "172.31.37.72" + ], + "ansible_all_ipv6_addresses": [ + "2a05:d01c:2c7:d802:4db1:18cc:f13f:a1cf", + "fe80::9e:19ff:fe1e:7376" + ], + "ansible_apparmor": { + "status": "enabled" + }, + "ansible_architecture": "x86_64", + "ansible_bios_date": "10/16/2017", + "ansible_bios_version": "1.0", +``` + +- Plays and playbooks + - The goal of a play is to map a group of hosts to some well-defined roles + - A play may use one or more modules to achieve a desired end state on a group of hosts + - A playbook is a series of plays + - A playbook may deploy new web servers, install a new application to existing application servers, and run SQL against some database servers to support the new application + +- Configuration Files + - Several possible locations (in order processed): + - ANSIBLE_CONFIG (an environment variable) + - ansible.cfg (in the current directory) + - .ansible.cfg (in the home directory) + - /etc/ansible/ansible.cfg (master configuration) + - Configuration can also be set in environment variables + - Some commonly used settings: + - ansible_managed + - forks + - Inventory + \ No newline at end of file