💾 Archived View for carnage.edvinbasil.com › knowledge › unix › ansible › index.md captured on 2021-12-05 at 23:47:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-11-07)

-=-=-=-=-=-=-

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`