Symlink group_vars directory instead of use as explicit varfile

This allows proper group var default value inheritance, instead
of applying group vars to all roles. Secondly, it reduces the
amount of management as Kargo introduces more var files for groups.

Also fixed bin_dir for configure_lgos role.

Change-Id: Iadb44d67c90a0af9bf5403395be6d91fbe9e9ef1
This commit is contained in:
Matthew Mosesohn 2017-02-27 13:27:33 +03:00
parent 4ef58baca7
commit 759a0f3abe
3 changed files with 7 additions and 4 deletions

View File

@ -142,9 +142,9 @@ function with_ansible {
--ssh-extra-args "-A\ -o\ StrictHostKeyChecking=no" -u ${ADMIN_USER} -b \
--become-user=root -i $ADMIN_WORKSPACE/inventory/inventory.cfg \
--forks=$ANSIBLE_FORKS --timeout $ANSIBLE_TIMEOUT \
$KARGO_DEFAULTS_OPT $COMMON_DEFAULTS_OPT \
$COMMON_DEFAULTS_OPT $OS_SPECIFIC_DEFAULTS_OPT \
-e ansible_ssh_user=${ADMIN_USER} \
$OS_SPECIFIC_DEFAULTS_OPT $custom_opts $retry_opt $@; do
$custom_opts $retry_opt $@; do
if [[ $tries -gt 1 ]]; then
tries=$((tries - 1))
echo "Deployment failed! Trying $tries more times..."
@ -290,6 +290,9 @@ fi
if ! admin_node_command test -e "$ADMIN_WORKSPACE/inventory/${OS_SPECIFIC_DEFAULTS_YAML}"; then
cat $OS_SPECIFIC_DEFAULTS_SRC | admin_node_command "cat > $ADMIN_WORKSPACE/inventory/${OS_SPECIFIC_DEFAULTS_YAML}"
fi
if ! admin_node_command test -e "${ADMIN_WORKSPACE}/inventory/group_vars"; then
admin_node_command ln -rsf "${ADMIN_WORKSPACE}/kargo/inventory/group_vars" "${ADMIN_WORKSPACE}/inventory/group_vars"
fi
if [[ -n "${CUSTOM_YAML}" ]]; then
echo "Uploading custom YAML for deployment..."
@ -318,7 +321,6 @@ fi
COMMON_DEFAULTS_OPT="-e @$ADMIN_WORKSPACE/inventory/${COMMON_DEFAULTS_YAML}"
OS_SPECIFIC_DEFAULTS_OPT="-e @$ADMIN_WORKSPACE/inventory/${OS_SPECIFIC_DEFAULTS_YAML}"
KARGO_DEFAULTS_OPT="-e @$ADMIN_WORKSPACE/kargo/inventory/group_vars/all.yml -e @$ADMIN_WORKSPACE/kargo/inventory/group_vars/k8s-cluster.yml"
# Stop trapping pre-setup tasks
set +e

View File

@ -1,3 +1,4 @@
bin_dir: /usr/local/bin
log_path: /var/log/ansible/
conf_file: /etc/ansible/ansible.cfg
callback_plugins:

View File

@ -10,7 +10,7 @@ if [ "${ADMIN_PASSWORD}" -a -z "${NO_SSH_PASSWORD}" ]; then
SSH_WRAPPER="-e ansible_ssh_pass=${ADMIN_PASSWORD}"
fi
/usr/bin/ansible-playbook ${LOG_LEVEL} \
ansible-playbook ${LOG_LEVEL} \
--ssh-extra-args "$SSH_EXTRA_ARGS" -u ${ADMIN_USER} -b ${SSH_WRAPPER} \
--become-user=root -i $ADMIN_WORKSPACE/inventory/inventory.cfg \
-e searchpath=$ADMIN_WORKSPACE \