install.fairie/home/.chezmoiscripts/disabled/run_onchange_after_symlink-ansible-configs.tmpl
Brian Zalewski 2f9a236021 Update 28 files
- /home/.chezmoiscripts/run_onchange_after_add-fonts.tmpl
- /home/.chezmoiscripts/run_onchange_after_endlessh.tmpl
- /home/.chezmoiscripts/run_onchange_after_fail2ban.tmpl
- /home/.chezmoiscripts/run_onchange_after_symlink-ansible-configs.tmpl
- /home/.chezmoiscripts/run_onchange_after_sshd.tmpl
- /home/.chezmoiscripts/run_onchanges_after_decrypt-ssh-keys.tmpl
- /home/.chezmoiscripts/run_onchange_ensure-executable.tmpl
- /home/.chezmoiscripts/run_onchanges_after_ensure-private-key.tmpl
- /home/.chezmoiscripts/run_onchanges_after_generate-public-keys.tmpl
- /home/.chezmoiscripts/run_onchanges_after_symlink-custom.tmpl
- /home/.chezmoitemplates/ssh/authorized-keys.yubikey
- /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-font.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_02-ensure-executable.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_05-decrypt-ssh-keys.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_07-ensure-private-key.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_08-generate-public-keys.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_08-symlink-custom.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_30-endlessh.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_30-sshd.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_31-fail2ban.sh.tmpl
- /home/.chezmoiscripts/disabled/run_onchange_after_symlink-ansible-configs.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_01-requirements.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_14-warp.sh.tmpl
- /home/.chezmoitemplates/ssh/encrypted_authorized-keys.yubikey.tmpl
2023-04-15 23:14:30 +00:00

26 lines
1.3 KiB
Bash

#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Symlink the variables / files / inventories to ~/.config/ansible folders if they are present
### i.e. Changes to upstream will not impact the play if your configuration files are stored locally
for TARGET in "files" "group_vars" "host_vars" "inventories" "templates"; do
if [ -d "$HOME/.config/ansible/$TARGET" ] && [ "$(readlink -f "$HOME/.local/share/ansible/$TARGET")" != "$HOME/.config/ansible/$TARGET" ]; then
logg 'Symlinking Ansible playbook `'"$TARGET"'` to ~/.config/ansible/$TARGET'
rm -f "$HOME/.local/share/ansible/$TARGET"
ln -s "$HOME/.config/ansible/$TARGET" "$HOME/.local/share/ansible/$TARGET"
fi
done
### Symlink tasks as well
### Note: Only handles tasks one level deep (i.e. ~/.config/ansible/tasks/my-task.yml will link to the tasks folder
### but ~/.config/ansible/tasks/directory/my-other-task.yml will not)
if [ -d "$HOME/.config/ansible/tasks" ]; then
find "$HOME/.config/ansible/tasks" -type f | while read TASK_FILE; do
TASK_FILE_NAME="$(echo "$TASK_FILE" | sed 's/.*\/\([^\/]*\)$/\1/')"
if [ "$(readlink -f "$HOME/.local/share/ansible/tasks/$TASK_FILE_NAME")" != "$TASK_FILE" ]; then
ln -s "$TASK_FILE" "$HOME/.local/share/ansible/tasks/$TASK_FILE_NAME"
fi
done
fi