infrastructure:ansible
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
infrastructure:ansible [2018/08/01 09:16] – créée ronan | infrastructure:ansible [2019/01/10 14:46] (Version actuelle) – [Windows support] rguyader | ||
---|---|---|---|
Ligne 147: | Ligne 147: | ||
=== Exemples === | === Exemples === | ||
- | | + | ansible-playbook -i production site.yml |
- | | + | ansible-playbook -i production site.yml --tags ntp |
- | | + | ansible-playbook -i production webservers.yml |
- | | + | ansible-playbook -i production webservers.yml --limit boston |
- | | + | ansible-playbook -i production webservers.yml --limit boston[0-10] |
- | | + | ansible-playbook -i production webservers.yml --limit boston[10-20] |
- | | + | ansible boston -i production -m ping |
- | | + | ansible boston -i production -m command -a '/ |
Confirm what task names would be run if I ran this command and said "just ntp tasks" | Confirm what task names would be run if I ran this command and said "just ntp tasks" | ||
- | | + | ansible-playbook -i production webservers.yml --tags ntp --list-tasks |
Confirm what hostnames might be communicated with if I said "limit to boston" | Confirm what hostnames might be communicated with if I said "limit to boston" | ||
- | | + | ansible-playbook -i production webservers.yml --limit boston --list-hosts |
===== Information préalable ===== | ===== Information préalable ===== | ||
Ligne 181: | Ligne 181: | ||
===== Installation ===== | ===== Installation ===== | ||
- | | + | apt-get install ansible ansible-doc |
- | | + | sudo sed --in-place " |
- | | + | iceweasel / |
Par défaut, Ansible utilise l' | Par défaut, Ansible utilise l' | ||
Ligne 247: | Ligne 247: | ||
**Pinger les machines :** | **Pinger les machines :** | ||
- | | + | ansible --inventory=${INVENTORY} --limit=${LIMIT} --forks=${PARALLELISM} --module-name=ping all |
| | ||
**Voir si l' | **Voir si l' | ||
- | | + | ansible --inventory=${INVENTORY} --limit=${LIMIT} --forks=${PARALLELISM} --module-name=command --args=" |
Ligne 426: | Ligne 426: | ||
Via powershell en natif. Requiert pywinrm sur la machine de contrôle : | Via powershell en natif. Requiert pywinrm sur la machine de contrôle : | ||
- | # pip install http:// | + | <code bash> |
+ | | ||
+ | </ | ||
Gestion de paquets via chocolatey : https:// | Gestion de paquets via chocolatey : https:// | ||
Ligne 1458: | Ligne 1460: | ||
(l' | (l' | ||
- | | + | ansible-playbook example.yml --tags " |
- | | + | ansible-playbook example.yml --skip-tags " |
===== Vault ===== | ===== Vault ===== | ||
- | | + | ansible-vault create foo.yml => demande un mot de passe |
- | | + | ansible-vault edit foo.yml |
- | | + | ansible-vault rekey foo.yml bar.yml baz.yml |
- | | + | ansible-vault encrypt foo.yml bar.yml baz.yml |
- | | + | ansible-vault decrypt foo.yml bar.yml baz.yml |
- | | + | ansible-playbook site.yml --ask-vault-pass => lance un playbook qui appelle des fichiers chiffrés (avec le même mot de passe) |
- | | + | ansible-playbook site.yml --vault-password-file ~/ |
- | | + | ansible-playbook site.yml --vault-password-file ~/ |
===== Modules ===== | ===== Modules ===== | ||
Ligne 1476: | Ligne 1478: | ||
En ligne de commande : -m | En ligne de commande : -m | ||
- | | + | ansible webservers -m service -a " |
- | | + | ansible webservers -m ping |
- | | + | ansible webservers -m command -a "/ |
En playbook : | En playbook : |
infrastructure/ansible.1533115005.txt.gz · Dernière modification : 2018/08/01 09:16 de ronan