Update 2 files

- /home/dot_local/share/ansible/symlink_requirements.yml.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl
This commit is contained in:
Brian Zalewski 2023-01-05 23:10:07 +00:00
parent c5ac0b60de
commit 2040d0ede5
2 changed files with 18 additions and 12 deletions

View file

@ -25,18 +25,24 @@ find "$HOME/.local/src/gas-station/roles" -mindepth 2 -maxdepth 2 -type d | whil
fi fi
done done
if [ -f "$HOME/.local/src/gas-station/requirements.yml" ] && command -v ansible-galaxy > /dev/null; then if [ -f "$HOME/.local/src/gas-station/requirements.yml" ]; then
logg info 'Ensuring Ansible Galaxy collections are installed' if command -v ansible-galaxy > /dev/null; then
ansible-galaxy install -r "$HOME/.local/src/gas-station/requirements.yml" || EXIT_CODE=$? logg info 'Ensuring Ansible Galaxy collections are installed'
if [ -n "$EXIT_CODE" ]; then ansible-galaxy install -r "$HOME/.local/src/gas-station/requirements.yml" || EXIT_CODE=$?
logg error 'Failed to install Ansible requirements from Ansible Galaxy' if [ -n "$EXIT_CODE" ]; then
if [ -d "$HOME/.local/src/gas-station/collections" ]; then logg error 'Failed to install Ansible requirements from Ansible Galaxy'
logg info 'Attempting to use locally stored Ansible requirements' if [ -d "$HOME/.local/src/gas-station/collections" ]; then
cd "$HOME/.local/src/gas-station/collections" logg info 'Attempting to use locally stored Ansible requirements'
ansible-galaxy install -r requirements.yml || SECOND_EXIT_CODE=$? cd "$HOME/.local/src/gas-station/collections"
if [ -n "$SECOND_EXIT_CODE" ]; then ansible-galaxy install -r requirements.yml || SECOND_EXIT_CODE=$?
logg error 'Failed to install requirements from both the cloud and the local copy' && exit 1 if [ -n "$SECOND_EXIT_CODE" ]; then
logg error 'Failed to install requirements from both the cloud and the local copy' && exit 1
fi
fi fi
fi fi
else
logg warn 'Unable to install the Ansible Galaxy requirements.yml since the ansible-galaxy executable is missing from the PATH'
fi fi
else
logg warn '~/.local/src/gas-station/requirements.yml is missing'
fi fi

View file

@ -1,3 +1,3 @@
{{- if true -}} {{- if true -}}
{{ .host.home }}/.local/src/gas-station/playbooks {{ .host.home }}/.local/src/gas-station/requirements.yml
{{- end -}} {{- end -}}