working with hosts file
This commit is contained in:
23
README.md
23
README.md
@@ -20,3 +20,26 @@ This series of lessons lays the foundation for the remainder of the course conte
|
||||
|
||||
##### 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