tldr/pages.de/common/ansible.md

34 lines
985 B
Markdown
Raw Permalink Normal View History

2020-10-01 22:42:40 +01:00
# ansible
> Verwalte Computergruppen per Fernzugriff über SSH (Verwende die Datei `/etc/ansible/hosts`, um neue Gruppen/Hosts hinzuzufügen).
> Manche Unterbefehle wie `ansible galaxy` sind separat dokumentiert.
> Weitere Informationen: <https://www.ansible.com/>.
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Liste Hosts auf, die zu einer Gruppe gehören:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{gruppe}} --list-hosts`
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Pinge eine Gruppe von Hosts an:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{gruppe}} -m ping`
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Zeige Informationen über eine Gruppe von Hosts an:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{gruppe}} -m setup`
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Führe einen Befehl auf einer Gruppe von Hosts aus:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{gruppe}} -m command -a '{{befehl}}'`
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Führe einen Befehl mit administrativen Privilegien aus:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{gruppe}} --become --ask-become-pass -m command -a '{{befehl}}'`
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
- Führe einen Befehl mit einer benutzerdefinierten Inventardatei aus:
2020-10-01 22:42:40 +01:00
2021-03-25 16:42:04 +00:00
`ansible {{Gruppe}} -i {{inventardatei}} -m command -a '{{befehl}}'`
- Liste alle Gruppen eines Inventars auf:
`ansible localhost -m debug -a '{{var=groups.keys()}}'`