{{tag>Ansible AWX Docker CA}}
= Notes Ansible ansible-navigator
Voir :
* [[Ansible Docker Execution Environment]]
== Config
''ansible.cfg''
# 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''
# # 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
ansible-navigator --ee false –m stdout playbook.yml –l server01
Afficher les infos sur une image
ansible-navigator --eei ADRESSE_HUB/EE:X.Y.Z images -d
Lancer un playbook dans un Execution Environment donné
podman images
podman login --tls-verify=false aap.acme.local -u jean@acme.local
ansible-navigator -m stdout run play.yml -i localhost, -c local -vv --eei aap.acme.local/image-standard:0.9.1
''inv.txt''
localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python
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
ansible-navigator -m stdout images | egrep '\sname:' |egrep -v '/|overlay' |awk '{print $2}'
Avoir les informations sur une image
ansible-navigator -m stdout --eei localhost/plop images -d python_version
ansible-navigator -m stdout --eei localhost/plop images -d ansible_version