Create ansible environment variables in profile.d

This change sets our desired ansible options as default environment variables
on systems where the `tripleo-bootstrap` role is executed. This change will
ensure all of our ansible resources are accessible by users of the system,
using the default shell, and are executed in an expected way, mirroring what
we setup within our mistral ansible configuration file.

Change-Id: If5a997dc2698dc286e118289431cc441e3c03199
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2019-08-22 12:30:17 -05:00
parent ef8d3591fa
commit 1ac27c39eb
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,29 @@
function set-ansible-env {
export ANSIBLE_RETRY_FILES_ENABLED=False
export ANSIBLE_ACTION_PLUGINS="${HOME}/.ansible/plugins/action:/usr/share/ansible/plugins/action:/usr/share/ansible/tripleo-plugins/action:/usr/share/openstack-tripleo-validations/action"
export ANSIBLE_CALLBACK_PLUGINS="${HOME}/.ansible/plugins/callback:/usr/share/ansible/plugins/callback:/usr/share/ansible/tripleo-plugins/callback:/usr/share/openstack-tripleo-validations/callback"
export ANSIBLE_FILTER_PLUGINS="${HOME}/.ansible/plugins/filter:/usr/share/ansible/plugins/filter:/usr/share/ansible/tripleo-plugins/filter:/usr/share/openstack-tripleo-validations/filter"
export ANSIBLE_LIBRARY="${HOME}/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:/usr/share/ansible/tripleo-plugins/modules:/usr/share/openstack-tripleo-validations/modules"
export ANSIBLE_MODULE_UTILS="${HOME}/.ansible/plugins/module_utils:/usr/share/ansible/plugins/module_utils:/usr/share/ansible/tripleo-plugins/module_utils:/usr/share/openstack-tripleo-validations/module_utils"
export ANSIBLE_ROLES_PATH="${HOME}/.ansible/roles:/usr/share/ansible/tripleo-roles:/usr/share/ansible/roles:/etc/ansible/roles:/usr/share/openstack-tripleo-validations/roles"
export ANSIBLE_LOOKUP_PLUGINS="${HOME}/.ansible/plugins/lookup:/usr/share/ansible/plugins/lookup:/usr/share/ansible/tripleo-plugins/lookup:/usr/share/openstack-tripleo-validations/lookup"
export ANSIBLE_LOAD_CALLBACK_PLUGINS=True
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_LOG_PATH="${HOME}/.ansible/logs/ansible-$(date +"%Y-%m-%dT%H").log"
export ANSIBLE_FORKS=25
export ANSIBLE_TIMEOUT=30
export ANSIBLE_GATHER_TIMEOUT=30
export ANSIBLE_SSH_ARGS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ControlMaster=auto -o ControlPersist=30m -o ServerAliveInterval=5 -o ServerAliveCountMax=5"
export ANSIBLE_PIPELINING=True
export ANSIBLE_SSH_RETRIES=8
}
function unset-ansible-env {
for i in $(env | grep ANSIBLE_ | awk -F'=' '{print $1}'); do
unset ${i}
done
echo -e "\nAnsible environment deactivated."
echo -e "To re-activate the environment, run 'set-ansible-env'.\n"
}
set-ansible-env

View File

@ -32,6 +32,15 @@
tags:
- always
- name: Create tripleo-ansible-env file
become: true
copy:
src: "tripleo-ansible-env.sh"
dest: "/etc/profile.d/tripleo-ansible-env.sh"
owner: "root"
group: "root"
mode: "0755"
- name: Deploy required packages to bootstrap TripleO
become: true
package: