working with hosts file
This commit is contained in:
27
README.md
27
README.md
@@ -8,7 +8,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
|
||||||
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.
|
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
|
- Overview
|
||||||
- Invetories
|
- Invetories
|
||||||
- Modules
|
- Modules
|
||||||
@@ -19,4 +19,27 @@ This series of lessons lays the foundation for the remainder of the course conte
|
|||||||
- Configuration files
|
- Configuration files
|
||||||
|
|
||||||
##### Inventories
|
##### Inventories
|
||||||

|

|
||||||
|
|
||||||
|
- 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"
|
||||||
|
}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user