a2748ba201
- /home/dot_config/nvim-custom/run_onchanges_after_symlink-custom.tmpl - /home/dot_local/bin/run_onchange_ensure-executable.tmpl - /home/dot_local/share/ansible/run_onchange_after_symlink-ansible-configs.tmpl - /home/Library/Fonts/run_onchange_after_add-fonts.tmpl - /home/private_dot_ssh/fail2ban/run_onchange_after_fail2ban.tmpl - /home/private_dot_ssh/system/run_onchange_after_sshd.tmpl - /home/private_dot_ssh/endlessh/run_onchange_after_endlessh.tmpl - /home/private_dot_ssh/run_onchanges_after_decrypt-ssh-keys.tmpl - /home/private_dot_ssh/run_onchanges_after_ensure-private-key.tmpl - /home/private_dot_ssh/run_onchanges_after_generate-public-keys.tmpl - /home/.chezmoiscripts/run_onchanges_after_symlink-custom.tmpl - /home/.chezmoiscripts/run_onchange_ensure-executable.tmpl - /home/.chezmoiscripts/run_onchange_after_symlink-ansible-configs.tmpl - /home/.chezmoiscripts/run_onchange_after_add-fonts.tmpl - /home/.chezmoiscripts/run_onchange_after_fail2ban.tmpl - /home/.chezmoiscripts/run_onchange_after_sshd.tmpl - /home/.chezmoiscripts/run_onchange_after_endlessh.tmpl - /home/.chezmoiscripts/run_onchanges_after_decrypt-ssh-keys.tmpl - /home/.chezmoiscripts/run_onchanges_after_ensure-private-key.tmpl - /home/.chezmoiscripts/run_onchanges_after_generate-public-keys.tmpl
26 lines
1.3 KiB
Bash
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
|