fix(scripts): update ansible.cfg generation script to include path to collections, fix noclobber issue and force ansible to run handlers even when an error is encountered
This commit is contained in:
parent
394bd151ea
commit
437e6728e6
1 changed files with 6 additions and 1 deletions
|
@ -27,6 +27,7 @@ The following environment variables are supported for overrides:
|
|||
TMPL_INVENTORY_FILE: path where the main inventory file is located (current: "$TMPL_INVENTORY_FILE")
|
||||
TMPL_CONNECTION_TIMEOUT: default connection timeout when connecting to hosts (current: $TMPL_CONNECTION_TIMEOUT)
|
||||
TMPL_PLAYBOOK_DIR: path where the playbooks are located (current: "$TMPL_PLAYBOOK_DIR")
|
||||
TMPL_COLLECTIONS_PATH: path where the collections (custom and galaxy) are located (current: "$TMPL_COLLECTIONS_PATH")
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,7 @@ TMPL_PROJECT_ROOT=$(realpath "${TMPL_PROJECT_ROOT:-"${SCRIPT_DIR}/.."}")
|
|||
TMPL_INVENTORY_FILE=$(realpath "${TMPL_INVENTORY_FILE:-"${TMPL_PROJECT_ROOT}/inventory/inventory.yml"}")
|
||||
TMPL_CONNECTION_TIMEOUT=${TMPL_CONNECTION_TIMEOUT:-30}
|
||||
TMPL_PLAYBOOK_DIR=$(realpath "${TMPL_PLAYBOOK_DIR:-"${TMPL_PROJECT_ROOT}/playbooks"}")
|
||||
TMPL_COLLECTIONS_PATH=$(realpath "${TMPL_COLLECTIONS_PATH:-"${TMPL_PROJECT_ROOT}/collections/ansible_collections"}")
|
||||
|
||||
OPTS=ho
|
||||
LONGOPTS=help,overwrite
|
||||
|
@ -87,8 +89,10 @@ CFG_TEMPLATE=$(cat <<EOF
|
|||
[defaults]
|
||||
cow_selection = random
|
||||
error_on_undefined_vars = True
|
||||
force_handlers = True
|
||||
home = ${TMPL_PROJECT_ROOT}
|
||||
inventory = ${TMPL_INVENTORY_FILE}
|
||||
collections_path = ${TMPL_COLLECTIONS_PATH}
|
||||
local_tmp = /tmp
|
||||
nocolor = 0
|
||||
nocows = 0
|
||||
|
@ -114,5 +118,6 @@ EOF
|
|||
if [ -z "${ANSIBLE_CFG_PATH}" ]; then
|
||||
echo -e "$CFG_TEMPLATE"
|
||||
else
|
||||
echo -e "$CFG_TEMPLATE" > "${ANSIBLE_CFG_PATH}"
|
||||
echo -e "$CFG_TEMPLATE" | tee "${ANSIBLE_CFG_PATH}" > /dev/null
|
||||
chmod u=rw,g=r,o= "${ANSIBLE_CFG_PATH}"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue