tech:notes_ansible-inventory
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_ansible-inventory [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_ansible-inventory [2025/11/20 14:55] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| {{tag> | {{tag> | ||
| - | = Notes Ansible Inventory | + | # Notes Ansible Inventory |
| Ligne 7: | Ligne 8: | ||
| * [[ansible_inventory_script_-_inventaire_dynamique_3|Ansible inventaire script - inventaire dynamique vers statique - Conversion JSON YAML INI]] | * [[ansible_inventory_script_-_inventaire_dynamique_3|Ansible inventaire script - inventaire dynamique vers statique - Conversion JSON YAML INI]] | ||
| * https:// | * https:// | ||
| + | |||
| + | Script pour gérer un inventaire - openstack-ansible : | ||
| + | * openstack-ansible/ | ||
| + | * https:// | ||
| + | * https:// | ||
| Linter un fichier inventaire | Linter un fichier inventaire | ||
| - | < | + | ~~~ |
| ansible-lint inventory1.yml | ansible-lint inventory1.yml | ||
| Ligne 17: | Ligne 23: | ||
| ansible-inventory -i inventory1.yml -y --list > inventory2.yml | ansible-inventory -i inventory1.yml -y --list > inventory2.yml | ||
| - | </ | + | ~~~ |
| Print all variables for all hosts from the command line | Print all variables for all hosts from the command line | ||
| - | < | + | ~~~bash |
| ansible -i inventory/ | ansible -i inventory/ | ||
| - | </ | + | ~~~ |
| Afficher les variables pour tous les hosts | Afficher les variables pour tous les hosts | ||
| - | < | + | ~~~bash |
| ansible-inventory -i inventory.yml --graph --vars | ansible-inventory -i inventory.yml --graph --vars | ||
| - | </ | + | ~~~ |
| Afficher les variables pour un host particulier | Afficher les variables pour un host particulier | ||
| - | < | + | ~~~bash |
| # En YAML | # En YAML | ||
| ansible-inventory -i inventory.yml -y --host server1 | ansible-inventory -i inventory.yml -y --host server1 | ||
| Ligne 36: | Ligne 42: | ||
| # En JSON | # En JSON | ||
| ansible-inventory -i inventory.yml --host server1 | ansible-inventory -i inventory.yml --host server1 | ||
| - | </ | + | ~~~ |
| - | == Plugin | + | ## Plugin |
| - | <code -> | + | ~~~ |
| $ ansible-doc -t inventory -l | $ ansible-doc -t inventory -l | ||
| advanced_host_list | advanced_host_list | ||
| Ligne 65: | Ligne 71: | ||
| toml Uses a specific TOML file as an inventory source | toml Uses a specific TOML file as an inventory source | ||
| yaml Uses a specific YAML file as an inventory source | yaml Uses a specific YAML file as an inventory source | ||
| - | </ | + | ~~~ |
| - | == Playbook | + | ## Playbook |
| Limiter l' | Limiter l' | ||
| - | < | + | ~~~yaml |
| | | ||
| - | </ | + | ~~~ |
| - | === Inventaire dynamique passé en extra-vars | + | ### Inventaire dynamique passé en extra-vars |
| - | <code yaml play_roles_temp_inventory.yaml> | + | '' |
| - | --- | + | ~~~yaml |
| #! / | #! / | ||
| + | |||
| + | --- | ||
| - hosts: localhost | - hosts: localhost | ||
| Ligne 108: | Ligne 116: | ||
| loop_var: role_name | loop_var: role_name | ||
| when: play_roles is defined | when: play_roles is defined | ||
| - | </ | + | ~~~ |
| - | == Tower | + | |
| + | ## Tower | ||
| Voir https:// | Voir https:// | ||
| - | < | + | ~~~bash |
| awx-manage inventory_import --source=inventory/ | awx-manage inventory_import --source=inventory/ | ||
| --inventory-name=" | --inventory-name=" | ||
| Ligne 122: | Ligne 131: | ||
| mkdir -p inventory-directory/ | mkdir -p inventory-directory/ | ||
| - | </ | + | ~~~ |
| Voir '' | Voir '' | ||
| - | == Autres | + | ## Autres |
| inventory_hostname et ansible_hostname | inventory_hostname et ansible_hostname | ||
tech/notes_ansible-inventory.1742825205.txt.gz · Dernière modification : de 127.0.0.1
