Outils pour utilisateurs

Outils du site


tech:notes_ansible_ansible-navigator

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:notes_ansible_ansible-navigator [2025/12/04 11:12] Jean-Baptistetech:notes_ansible_ansible-navigator [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Ansible AWX Docker CA}}
 +
 +# Notes Ansible ansible-navigator
 +
 +Voir :
 +* [[Ansible Docker Execution Environment]]
 +
 +
 +## Config
 +
 +`ansible.cfg`
 +~~~ini
 +# Since Ansible 2.12 (core):
 +# To generate an example config file (a "disabled" one with all default settings, commented out):
 +#               $ ansible-config init --disabled > ansible.cfg
 +#
 +# Also you can now have a more complete file by including existing plugins:
 +# ansible-config init --disabled -t all > ansible.cfg
 +#
 +# Voir la configuration :
 +# ansible-config dump --only-changed -t all
 +
 +# For previous versions of Ansible you can check for examples in the 'stable' branches of each version
 +# Note that this file was always incomplete  and lagging changes to configuration settings
 +
 +# for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg
 +[galaxy]
 +server_list = rh-certified_repo, published_repo, community_repo, galaxy, dev-community
 +
 +[galaxy_server.rh-certified_repo]
 +token=000000000000000
 +url=https://aap.acme.local/api/galaxy/content/rh-certified/
 +
 +[galaxy_server.published_repo]
 +token=000000000000000
 +url=https://aap.acme.local/api/galaxy/content/published/
 +
 +[galaxy_server.community_repo]
 +token=000000000000000
 +url=https://aap.acme.local/api/galaxy/content/community/
 +
 +[galaxy_server.galaxy]
 +url=https://galaxy.ansible.com/
 +
 +[galaxy_server.dev-community]
 +url=https://aah.acme.local/api/galaxy/content/community/
 +token=000000000000000
 +~~~
 +
 +
 +`~/.ansible-navigator.yml`
 +~~~yaml
 +# # cspell:ignore cmdline, workdir
 +---
 +
 +ansible-navigator:
 +  ansible:
 +    config:
 +      path: ./ansible.cfg
 +  execution-environment:
 +    container-engine: podman
 +    enabled: true
 +    image: image-standard:0.9.1
 +  logging:
 +    level: warning
 +~~~
 +
 +
 +
 +## Exemple
 +
 +
 +Lancer un playbook 
 +~~~bash
 +ansible-navigator --ee false –m stdout playbook.yml –l server01
 +~~~
 +
 +Afficher les infos sur une image
 +~~~bash
 +ansible-navigator --eei ADRESSE_HUB/EE:X.Y.Z images -d
 +~~~
 +
 +
 +Lancer un playbook dans un Execution Environment donné
 +~~~bash
 +podman images
 +podman login --tls-verify=false aap.acme.local -u jean@acme.local
 +~~~
 +
 +~~~bash
 +ansible-navigator -m stdout run play.yml -i localhost, -c local -vv --eei aap.acme.local/image-standard:0.9.1
 +~~~
 +
 +`inv.txt`
 +~~~ini
 +localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python
 +~~~
 +
 +~~~bash
 +ansible-navigator -m stdout run -i inv.txt --ee true --eei acme-automationhub-prod.admin.acme.local/acme-opn_lnx-recommended:0.9.4 /home/admin/play-mssql.yml
 +~~~
 +
 +Lister les images
 +~~~bash
 +ansible-navigator -m stdout images | egrep '\sname:' | egrep -v '/|overlay' | awk '{print $2}'
 +~~~
 +
 +Avoir les informations sur une image
 +~~~bash
 +ansible-navigator -m stdout --eei localhost/plop images -d python_version
 +ansible-navigator -m stdout --eei localhost/plop images -d ansible_version
 +~~~
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki