2025-03-14 21:59:59 -06:00
|
|
|
# ansible
|
|
|
|
|
|
|
|
|
|
> Verwalte Computergruppen per Fernzugriff über SSH (Verwende die Datei `/etc/ansible/hosts`, um neue Gruppen/Hosts hinzuzufügen).
|
|
|
|
|
> Manche Unterbefehle wie `galaxy` sind separat dokumentiert.
|
2025-06-28 19:25:29 -06:00
|
|
|
> Weitere Informationen: <https://docs.ansible.com/ansible/latest/cli/ansible.html>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Liste Hosts auf, die zu einer Gruppe gehören:
|
|
|
|
|
|
|
|
|
|
`ansible {{gruppe}} --list-hosts`
|
|
|
|
|
|
|
|
|
|
- Pinge eine Gruppe von Hosts an:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible {{gruppe}} {{[-m|--module-name]}} ping`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Zeige Informationen über eine Gruppe von Hosts an:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible {{gruppe}} {{[-m|--module-name]}} setup`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Führe einen Befehl auf einer Gruppe von Hosts aus:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible {{gruppe}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{befehl}}'`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Führe einen Befehl mit administrativen Privilegien aus:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible {{gruppe}} {{[-b|--become]}} --ask-become-pass {{[-m|--module-name]}} command {{[-a|--args]}} '{{befehl}}'`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Führe einen Befehl mit einer benutzerdefinierten Inventardatei aus:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible {{Gruppe}} {{[-i|--inventory]}} {{inventardatei}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{befehl}}'`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Liste alle Gruppen eines Inventars auf:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`ansible localhost {{[-m|--module-name]}} debug {{[-a|--args]}} '{{var=groups.keys()}}'`
|