Ansibe basics

- Inventory files: used to specify the hosts:

```ini

mainserver

[test]

myserver

web ansible_host=10.0.34.5 ansible_port=8022

```

- specify all hosts, a group or individual hosts using ansible:

```

ansible -i inventory all -m ping

ansible -i inventory test -m ping

ansible -i inventory web -m ping

```

- Run arbitrary adhoc commands using `-a` which uses the default `command`

module

```

ansible -i inventory all -a 'ls -la'

ansible -i inventory all -m command -a 'ls -la'

```

Finding Docs (ansible-doc)

- To list alls the modules, use `ansible-doc -l`

- To view documentation for a particular module `ansible-doc ping`