Outils pour utilisateurs

Outils du site


tech:ansible_docker_execution_environment

Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:ansible_docker_execution_environment [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:ansible_docker_execution_environment [2025/11/20 15:03] (Version actuelle) Jean-Baptiste
Ligne 5: Ligne 5:
 Voir : Voir :
 * [[notes_ansible_ansible-navigator|ansible-navigator]] * [[notes_ansible_ansible-navigator|ansible-navigator]]
 +* https://ansible.readthedocs.io/projects/creator/installing/#initialize-execution-environment-project
 * https://github.com/redhat-cop/ee_utilities/blob/devel/examples/ee_builder_base.yaml * https://github.com/redhat-cop/ee_utilities/blob/devel/examples/ee_builder_base.yaml
 * [[https://developers.redhat.com/articles/2023/05/08/how-create-execution-environments-using-ansible-builder|How to create execution environments using ansible-builder]] * [[https://developers.redhat.com/articles/2023/05/08/how-create-execution-environments-using-ansible-builder|How to create execution environments using ansible-builder]]
Ligne 13: Ligne 14:
 * https://www.techtransit.org/install-ansible-navigator-execution-environment/ * https://www.techtransit.org/install-ansible-navigator-execution-environment/
 * https://www.dbi-services.com/blog/create-and-manage-ansible-execution-environments/ * https://www.dbi-services.com/blog/create-and-manage-ansible-execution-environments/
 +* https://www.redhat.com/en/blog/the-anatomy-of-automation-execution-environments
 +* https://infohub.delltechnologies.com/fr-fr/l/dell-powermax-ansible-modules-best-practices-1/creating-ansible-execution-environments-using-ansible-builder/
  
 Voir aussi les execution-environment.yml : Voir aussi les execution-environment.yml :
-* https://github.com/ansible/awx-ee/blob/devel/execution-environment.yml+* https://github.com/kennedymeadows/awx-ee-juniper/tree/main et https://www.keepitsimplesimon.io/posts/awx-execution-environments
 * https://docs.ansible.com/automation-controller/latest/html/userguide/ee_reference.html * https://docs.ansible.com/automation-controller/latest/html/userguide/ee_reference.html
 * https://access.redhat.com/documentation/fr-fr/red_hat_ansible_automation_platform/2.4/html-single/creating_and_consuming_execution_environments/index * https://access.redhat.com/documentation/fr-fr/red_hat_ansible_automation_platform/2.4/html-single/creating_and_consuming_execution_environments/index
 +* https://github.com/ansible-community/images
 +* https://github.com/ansiblejunky/ansible-execution-environment
 +* https://github.com/ansible/awx-ee/
 +
  
  
Ligne 26: Ligne 33:
 pip install --user ansible-builder>=3.0.0 pip install --user ansible-builder>=3.0.0
 </code> </code>
 +
  
 == Utilisation == Utilisation
Ligne 41: Ligne 49:
 # podman login --tls-verify=false registry.acme.fr -u admin -p P@ssw0rd # podman login --tls-verify=false registry.acme.fr -u admin -p P@ssw0rd
  
 +# Créer le dossier context/ avec le Containerfile
 ansible-builder create #--file execution-environment-dev.yml ansible-builder create #--file execution-environment-dev.yml
-# Créer le dossier context/ 
  
 +# Créer l'image du container à partir du Containerfile généré
 podman build -f context/Containerfile -t img01:0.9.1 podman build -f context/Containerfile -t img01:0.9.1
 +
 +# Ou pour générer directement l'image du container :
 +ansible-builder build --tag img01:0.9.1
  
 podman images podman images
Ligne 101: Ligne 113:
 </code> </code>
  
-<code ini ansible.cfg>+''ansible.cfg'' 
 +<code ini>
 # Since Ansible 2.12 (core): # Since Ansible 2.12 (core):
 # To generate an example config file (a "disabled" one with all default settings, commented out): # To generate an example config file (a "disabled" one with all default settings, commented out):
Ligne 132: Ligne 145:
 </code> </code>
  
-<code - bindep.txt>+''bindep.txt'' 
 +<code ->
 python3-jmespath python3-jmespath
 </code> </code>
  
-<code yaml requirements.yml>+''requirements.yml'' 
 +<code yaml>
 --- ---
 collections: collections:
Ligne 146: Ligne 161:
  
  
-<code - requirements.txt>+''requirements.txt'' 
 +<code ->
 hvac hvac
 kafka-python kafka-python
 </code> </code>
  
-<code yaml execution-environment.yml>+ 
 +''execution-environment.yml'' 
 +<code yaml>
 --- ---
 version: 1 version: 1
Ligne 175: Ligne 193:
  
  
- +''context/Containerfile'' 
-<code bash context/Containerfile>+<code bash>
 ARG EE_BASE_IMAGE=aahub.acme.local/ee-minimal-rhel8:latest ARG EE_BASE_IMAGE=aahub.acme.local/ee-minimal-rhel8:latest
 ARG EE_BUILDER_IMAGE=aahub.acme.local/ansible-builder-rhel8:latest ARG EE_BUILDER_IMAGE=aahub.acme.local/ansible-builder-rhel8:latest
Ligne 211: Ligne 229:
 RUN /output/install-from-bindep && rm -rf /output/wheels RUN /output/install-from-bindep && rm -rf /output/wheels
 </code> </code>
 +
 +
 +<code yaml>
 +version: 3
 +
 +dependencies:
 +  galaxy: requirements.yml
 +  python: requirements.txt
 +  system: bindep.txt
 +
 +#  ansible_core:
 +#    package_pip: ansible-core==2.14.4
 +#
 +#  ansible_runner:
 +#    package_pip: ansible-runner
 +#
 +#  python_interpreter:
 +#    package_system: python39  # (optional) name of a Python interpreter OS package to install
 +#    python_path: /usr/bin/python3.9  # (optional) path to the Python interpreter to use
 +
 +  exclude:
 +    python:
 +      - docker
 +    system:
 +      - python3-Cython
 +
 +images:
 +  base_image:
 +    # name: quay.io/centos/centos:stream9
 +    # name: quay.io/ansible/ansible-runner:latest       # Obsoltete
 +    # name: ghcr.io/ansible-community/community-ee-minimal:2.16.0-1
 +    # name: quay.io/ansible/awx-ee:latest
 +    name: ghcr.io/ansible-community/community-ee-base:2.19.1-1
 +
 +# additional_build_files:
 +#     - src: files/ansible.cfg
 +#       dest: configs
 +
 +additional_build_steps:
 +#  prepend_galaxy:
 +#    - ADD _build/configs/ansible.cfg ~/.ansible.cfg
 +  prepend_base:
 +    # - RUN echo PLOP
 +  append_final:
 +    # - RUN groupadd --gid 1000 vscode
 +    # - RUN adduser --home-dir /vscode --create-home --gid 1000 --uid 1000 vscode
 +    - RUN ls -l
 +
 +options:
 +  user: '1000'
 +</code>
 +
 +
 +------------
 +
 +''execution-environment.yml''
 +<code yaml>
 +---
 +
 +version: 3
 +
 +dependencies:
 +  galaxy: requirements.yml
 +  python: requirements.txt
 +  system: bindep.txt
 +
 +images:
 +  base_image:
 +    name: ghcr.io/ansible-community/community-ee-base:2.19.1-1
 +
 +options:
 +  user: '1000'
 +</code>
 +
 +''requirements.yml''
 +<code yaml>
 +---
 +
 +collections:
 +  - ansible.utils
 +  - ansible.posix
 +  - ansible.windows
 +  - ansible.netcommon
 +  - community.general
 +  - community.windows
 +  - community.vmware
 +  - community.crypto
 +  - community.postgresql
 +  - community.mysql
 +  - community.network
 +  - kubernetes.core
 +  - containers.podman
 +  - awx.awx
 +  - vmware.vmware
 +  - vmware.vmware_rest
 +  - microsoft.ad
 +  # - fortinet.fortios
 +</code>
 +
 +''requirements.txt''
 +<code ->
 +six
 +psutil
 +# pywinrm
 +jc
 +jmespath
 +</code>
 +
 +
 +''bindep.txt''
 +<code ->
 +git
 +rsync
 +curl
 +wget
 +psmisc
 +tar
 +unzip
 +gzip
 +#python38-wheel [platform:centos-8 platform:rhel-8]
 +iputils [platform:rpm]
 +bind-utils [platform:rpm]
 +#python3-jmespath [platform:rpm]
 +#net-snmp-utils [platform:rpm]
 +</code>
 +
 +Exemple de fichier bindep.txt :
 +* https://github.com/openstack/openstack-ansible/blob/master/bindep.txt
 +
  
  
  
tech/ansible_docker_execution_environment.1742825205.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki