diff --git a/scripts/generate_ansible_config.sh b/scripts/generate_ansible_config.sh index 39b483b..9414839 100755 --- a/scripts/generate_ansible_config.sh +++ b/scripts/generate_ansible_config.sh @@ -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 < "${ANSIBLE_CFG_PATH}" + echo -e "$CFG_TEMPLATE" | tee "${ANSIBLE_CFG_PATH}" > /dev/null + chmod u=rw,g=r,o= "${ANSIBLE_CFG_PATH}" fi