Outils pour utilisateurs

Outils du site


tech:ansible_collection

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:ansible_collection [2025/09/05 15:49] Jean-Baptistetech:ansible_collection [2025/11/13 12:02] (Version actuelle) Jean-Baptiste
Ligne 2: Ligne 2:
  
 = Ansible collection = Ansible collection
 +
 +Voir :
 +  * https://setgetweb.com/p/ansible/user_guide/collections_using.html
 +  * https://www.jeffgeerling.com/blog/2020/ansible-best-practices-using-project-local-collections-and-roles:
 +  * https://bryanttseng.medium.com/use-ansible-collection-from-github-private-repository-cd7837958ddd
 +  * https://docs.fedoraproject.org/en-US/packaging-guidelines/Ansible_collections/
 +  * https://blog.octo.com/introduction-aux-ansible-content-collections
 +  * https://docs.ansible.com/ansible/latest/reference_appendices/config.html
 +
 +
 +Dépendances :
 +  * https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#role-dependencies
 +  * https://labexio.medium.com/how-to-manage-dependencies-in-ansible-roles-6148675bf4b8
 +  * https://docs.ansible.com/ansible/latest/galaxy/user_guide.html
 +  * https://labex.io/fr/tutorials/ansible-how-to-manage-dependencies-in-ansible-roles-415194
 +  * https://docs.debops.org/en/master/ansible/roles/etc_aliases/dependency.html
 +  * https://hostperl.com/kb/tutorials/advanced-ansible-playbooks
 +
 +
  
  
Ligne 21: Ligne 40:
 collections: collections:
   - name: https://git.acme.local/ansible_collections/my_collection   - name: https://git.acme.local/ansible_collections/my_collection
-    type: git+    type: git 
 +    scm: git
     version: master     version: master
 </code> </code>
Ligne 75: Ligne 95:
 == Utiliser une collection distante == Utiliser une collection distante
  
- +''collections/requirements.yml'' 
-<code yaml collections/requirements.yml>+<code yaml>
 --- ---
 collections: collections:
Ligne 91: Ligne 111:
 </code> </code>
  
-<code yaml play.yml>+''play.yml'' 
 +<code yaml>
 #!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
 --- ---
Ligne 116: Ligne 137:
 ansible-doc acme.awx.tower_credential ansible-doc acme.awx.tower_credential
 </code> </code>
 +
 +
 +=== Exemple de role distant sur Git
 +
 +''roles/requirements.yml''
 +<code yaml>
 +---
 +
 +- src: ssh://git@git.acme.local:2222/ansible/ansible-role-test_jb.git
 +  scm: git
 +  version: master
 +
 +</code>
 +
  
  
 === Exemple de collection distante sur Git === Exemple de collection distante sur Git
  
-<code yaml collections/requirements.yml>+''collections/requirements.yml'' 
 +<code yaml>
 ---     ---    
  
 collections: collections:
   - name: https://git.acme.fr/ansible-automation-platform/PlaybooksGroupe/dns_cache_enable   - name: https://git.acme.fr/ansible-automation-platform/PlaybooksGroupe/dns_cache_enable
-    type: git+    type: git 
 +    scm: git
 </code> </code>
  
Ligne 136: Ligne 173:
  
  
-<code yaml galaxy.yml>+''galaxy.yml'' 
 +<code yaml>
 --- ---
  
Ligne 150: Ligne 188:
 </code> </code>
  
-<code yaml tasks/main.yml>+ 
 +''tasks/main.yml'' 
 +<code yaml>
  
 - name: Enable local cache DNS - name: Enable local cache DNS
Ligne 199: Ligne 239:
  
  
------------------ 
- 
-Créer un paquet d'un role 
-<code bash> 
-tar czvf ./role_name.tar.gz ./role_name 
-</code> 
- 
-La documentation est dans : 
-* meta/main.yml 
-* README.md 
- 
-Installer un role 
-<code bash> 
-ansible-galaxy install ./role_name.tar.gz 
-ansible-galaxy install role_name 
-</code> 
- 
-Par défaut dans ''~/.ansible/roles/'' 
- 
- 
-Voir : 
-  * ansible-galaxy list 
-  * ansible-galaxy search  
-  * ansible-galaxy install 
-  * ansible-galaxy import 
-  * ansible-galaxy info 
  
  
  
tech/ansible_collection.1757080151.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki