tech:ansible_collection
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:ansible_collection [2025/09/03 16:42] – Jean-Baptiste | tech:ansible_collection [2025/11/13 12:02] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 2: | Ligne 2: | ||
| = Ansible collection | = Ansible collection | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | Dépendances : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Exemple | ||
| + | |||
| + | ''/ | ||
| + | |||
| + | '' | ||
| + | <code python> | ||
| + | collections_path = / | ||
| + | </ | ||
| + | |||
| + | Voir aussi la variable d’environnement '' | ||
| + | |||
| + | '' | ||
| + | <code yaml> | ||
| + | --- | ||
| + | |||
| + | collections: | ||
| + | - name: https:// | ||
| + | # type: git | ||
| + | scm: git | ||
| + | version: master | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | ansible-galaxy collection install -r collections/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | <code yaml> | ||
| + | - name: Install collections | ||
| + | community.general.ansible_galaxy_install: | ||
| + | type: collection | ||
| + | requirements_file: | ||
| + | dest: ~/ | ||
| + | changed_when: | ||
| + | </ | ||
| + | |||
| == Généralités | == Généralités | ||
| Ligne 16: | Ligne 73: | ||
| <code -> | <code -> | ||
| - | $ ansible --version |grep collection | + | $ ansible --version | grep collection |
| ansible collection location = / | ansible collection location = / | ||
| - | $ ansible-config dump |grep -i collection | + | $ ansible-config dump | grep -i collection |
| + | |||
| + | $ ansible-config init --disabled | ||
| </ | </ | ||
| - | == Utiliser une collection | + | Lister les collections installées |
| + | <code bash> | ||
| + | ansible-galaxy | ||
| + | </ | ||
| + | Rechercher une collection distante | ||
| + | <code bash> | ||
| + | ansible-galaxy search plop | ||
| + | </ | ||
| + | |||
| + | |||
| + | == Utiliser une collection distante | ||
| - | <code yaml requirements.yml> | + | '' |
| + | <code yaml> | ||
| --- | --- | ||
| collections: | collections: | ||
| Ligne 41: | Ligne 111: | ||
| </ | </ | ||
| - | <code yaml play.yml> | + | '' |
| + | <code yaml> | ||
| # | # | ||
| --- | --- | ||
| Ligne 66: | Ligne 137: | ||
| ansible-doc acme.awx.tower_credential | ansible-doc acme.awx.tower_credential | ||
| </ | </ | ||
| + | |||
| + | |||
| + | === Exemple de role distant sur Git | ||
| + | |||
| + | '' | ||
| + | <code yaml> | ||
| + | --- | ||
| + | |||
| + | - src: ssh:// | ||
| + | scm: git | ||
| + | version: master | ||
| + | |||
| + | </ | ||
| + | |||
| === Exemple de collection distante sur Git | === Exemple de collection distante sur Git | ||
| - | <code yaml requirements.yml> | + | '' |
| + | <code yaml> | ||
| --- | --- | ||
| collections: | collections: | ||
| - name: https:// | - name: https:// | ||
| - | type: git | + | |
| + | scm: git | ||
| </ | </ | ||
| Ligne 86: | Ligne 173: | ||
| - | <code yaml galaxy.yml> | + | '' |
| + | <code yaml> | ||
| --- | --- | ||
| Ligne 100: | Ligne 188: | ||
| </ | </ | ||
| - | <code yaml tasks/ | + | |
| + | '' | ||
| + | <code yaml> | ||
| - name: Enable local cache DNS | - name: Enable local cache DNS | ||
| Ligne 132: | Ligne 222: | ||
| * tests/ | * tests/ | ||
| * tools/ | * tools/ | ||
| + | |||
| == Autres | == Autres | ||
| - | < | + | < |
| git clone ssh:// | git clone ssh:// | ||
| Ligne 148: | Ligne 239: | ||
| - | ----------------- | ||
| - | |||
| - | Créer un paquet d'un role | ||
| - | <code bash> | ||
| - | tar czvf ./ | ||
| - | </ | ||
| - | |||
| - | La documentation est dans : | ||
| - | * meta/ | ||
| - | * README.md | ||
| - | |||
| - | Installer un role | ||
| - | <code bash> | ||
| - | ansible-galaxy install ./ | ||
| - | ansible-galaxy install role_name | ||
| - | </ | ||
| - | |||
| - | Par défaut dans '' | ||
| - | |||
| - | |||
| - | Voir : | ||
| - | * ansible-galaxy list | ||
| - | * ansible-galaxy search | ||
| - | * ansible-galaxy install | ||
| - | * ansible-galaxy import | ||
| - | * ansible-galaxy info | ||
tech/ansible_collection.1756910540.txt.gz · Dernière modification : de Jean-Baptiste
