# EX407-Ansible-Automation 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 ### Understanding Core Components of Ansible Part 1 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, focuses on Ansible inventories. - Overview - Invetories - Modules - Variables - Facts - Plays - Playbooks - Configuration files ##### Inventories ![img](https://github.com/Bes0n/EX407-Ansible-Automation/blob/master/images/img1.png) - Inventory files may simply consist of a list of hostnames but can be much more robust - It is also possible to define groups of hosts, host or group level variables, and groups of groups withing the inventory - There are a number of variables that may be used within the inventory to control how ansible connects to and interacts with target hosts - Commands to call ansible with `ping` module: - ```ansible innaghiyev1c.mylabserver.com -m ping -k``` - call ping module on `innaghiyev1c.mylabserver.com` host. Where `-m ping` is ping module and `-k` is key for asking password - ```ansible all -m ping -k``` - call all defined hosts in your inventory list `/etc/ansible/hosts/` - ```ansible -i inv.ini httpd -m ping -k``` - where `-i` - inventory file place, `httpd` hosts group name inside of `inv.ini` file Output: ``` innaghiyev1c.mylabserver.com | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "ping": "pong" } ```