Ansible provides the ability to source additional files containing variables using the 'vars_files' option in a play. This is not available by default when using execution environments but there's a easy fix to that problem which hides in the settings. The option is named 'Paths to expose to isolated jobs', which takes podman-style mount paths that allows to mount directories and files into the execution environment.
I would recommend to configure / modify any setting in Ansible Automation Platform / AWX using the ansible collections. Here's a quick playbook to deploy the setting:
---
- hosts: localhost
become: false
gather_facts: false
vars:
aap_procotol: https
aap_hostname: "{{ groups['ansible_tower'][0] }}"
aap_admin_user: admin
aap_admin_pass: "{{ vault['aap']['admin_password'] }}"
tasks:
- name: create ~/.tower_cli.cfg
ansible.builtin.copy:
dest: ~/.tower_cli.cfg
content: |
[general]
host = {{ aap_protocol }}://{{ aap_hostname }}
username = {{ aap_admin_user }}
password = {{ aap_admin_pass }}
verify_ssl = false
format = human
certificate =
verbose = false
description_on = false
oauth_token =
use_token = false
color = true
- hosts: ansible_tower
become: false
gather_facts: false
collections:
- awx.awx
tasks:
- name: configure execution environment directory mounting
awx.awx.settings:
name: AWX_ISOLATION_SHOW_PATHS
value:
- "/etc/pki/ca-trust:/etc/pki/ca-trust:O"
- "/usr/share/pki/:/usr/share/pki:O"
- "/my/custom/directory:/my/custom/mountpoint:O"
tower_config_file: ~/.tower_cli.cfg
...
The big advantage configuring aap using ansible is a infrastructure-as-code style configuration and deployment of your automation platform itself and reproducibility for newer installs / re-deploys.Feel free to comment and / or suggest a topic.
Comments
Post a Comment