Update dotfiles/.local/share/chezmoi/home/dot_local/share/ansible/run_onchange_after_symlink-ansible-configs.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl

This commit is contained in:
Brian Zalewski 2022-11-29 02:12:20 +00:00
parent 3024aa848d
commit 1fc68a1e42
2 changed files with 7 additions and 11 deletions

View file

@ -118,7 +118,7 @@
{{- writeToStdout "Chezmoi is running in headless environment.\n" -}}
{{- end -}}
encryption = "age"
encryption: "age"
age:
identity: "{{ .chezmoi.homeDir }}/.config/age/chezmoi.txt"
recipient: "age1necy24c4lzxheey4p2m8v4q000n442wyv47qc640ulyxx9l8dpesdqv7ey"

View file

@ -1,25 +1,21 @@
#!/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 of "files" "group_vars" "host_vars" "inventories" "templates"; do
if [ -d "$XDG_CONFIG_HOME/ansible/$TARGET" ] && [ "$(readlink -f "$XDG_DATA_HOME/ansible/$TARGET")" != "$XDG_CONFIG_HOME/ansible/$TARGET" ]; then
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 "$XDG_DATA_HOME/ansible/$TARGET"
ln -s "$XDG_CONFIG_HOME/ansible/$TARGET" "$XDG_DATA_HOME/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)
find "$XDG_CONFIG_HOME/ansible/tasks" -type f | while read TASK_FILE; do
find "$HOME/.config/ansible/tasks" -type f | while read TASK_FILE; do
TASK_FILE_NAME="$(echo "$TASK_FILE" | sed 's/.*\/\([^\/]*\)$/\1/')"
if [ "$(readlink -f "$XDG_DATA_HOME/ansible/tasks/$TASK_FILE_NAME")" != "$TASK_FILE" ]; then
logg 'Symlinking new task to ~/.local/share/ansible/tasks'
ln -s "$TASK_FILE" "$XDG_DATA_HOME/ansible/tasks/$TASK_FILE_NAME"
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