### ping
To check the connectivity with the *managing node*s, Ansible can ping it through ssh. Change `localhost` with desired name that is defined in *host file*:
```sh
ansiable localhost -m ping
```
### [Directory Layout](https://docs.ansible.com/ansible/2.8/user_guide/playbooks_best_practices.html#id11)
The top level of the directory would contain files and directories like so:
```
production # inventory file for production servers
staging # inventory file for staging environment
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml
library/ # if any custom modules, put them here (optional)
module_utils/ # if any custom module_utils to support modules, put them here (optional)
filter_plugins/ # if any custom filter plugins, put them here (optional)
site.yml # master playbook
webservers.yml # playbook for webserver tier
dbservers.yml # playbook for dbserver tier
roles/
common/ # this hierarchy represents a "role"
** tasks/ #
main.yml # <-- tasks file can include smaller files if warranted
* handlers/ #
main.yml # <-- handlers file
* templates/ # <-- files for use with the template resource
ntp.conf.j2 # <------- templates end in .j2
files/ #
bar.txt # <-- files for use with the copy resource
foo.sh # <-- script files for use with the script resource
vars/ #
main.yml # <-- variables associated with this role
* defaults/ #
main.yml # <-- default lower priority variables for this role
meta/ #
main.yml # <-- role dependencies
library/ # roles can also include custom modules
module_utils/ # roles can also include custom module_utils
lookup_plugins/ # or other types of plugins, like lookup in this case
webtier/ # same kind of structure as "common" was above, done for the webtier role
monitoring/ # ""
fooapp/ # ""
```
#### Bootstrap
In order to make a bootstrap directory for a new role:
```sh
ansible-galaxy init my_role
```
### Ad-hoc commands
Ad-hoc commands are a set of commands that are used when we want to temporarily do somethings with the host(s). e.g. checking their connectivity
They do not require specific playbook, roles and any ansible structures.
#### ping
To check the connectivity with the *managing node*s, Ansible can ping it through ssh. Change `localhost` with desired name that is defined in *host file*:
```sh
ansiable localhost -m ping
```
```sh
ansiable all -i inventory/hosts.yml -m ping
```
#### gather facts
To have a better understanding of hosts, we can gather setup facts. These facts can be used as *variables* to tune the configuration toward specific set of variables. e.g. by gather facts about OS, we can have different behaviors for Debian-based servers and Ubuntu-based servers.
```sh
ansiable localhost -m setup
```
```sh
ansiable all -i inventory/hosts.yml -m setup a="filter=ansiable_os_family"
```
### Vault
Password management in Ansiable
### AWX
It serves as a managed *controller node* for ansible.
* when multiple people are working on ansible in a team
* adds history to ansible management
* has a new GUI
There is also a commercial version of it called **Ansible Tower**.
### Mitogen
`mitogen` is an Ansible plugin that speeds up the execution by running the commands in parallel. It can be used by changing the `strategy` variable in `ansible.cfg`