From 0bb12fde342e5d7cca8743cd8c9bbbe38da87275 Mon Sep 17 00:00:00 2001 From: Keiran Snowden Date: Sat, 25 Nov 2023 17:04:25 -0500 Subject: [PATCH] aliases from pillar --- users/files/bashrc.jinja | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/users/files/bashrc.jinja b/users/files/bashrc.jinja index 0434bd7..7bb5607 100644 --- a/users/files/bashrc.jinja +++ b/users/files/bashrc.jinja @@ -62,13 +62,12 @@ fi PATH="${PATH}:${HOME}/.local/bin" alias random='< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo' -{%- if bashrc_user is defined and bashrc_user == 'keiran' %} -{#- TODO: this should be in pillar #} -alias keirmounts=/home/keiran/Documents/scripts/mounts.sh -alias grive=/home/keiran/Documents/scripts/grive.sh -{%- endif %} -{%- if bashrc_user is defined and bashrc_user == 'root' and 'restic' in pillar %} +{%- if bashrc_user is defined %} +{%- if bashrc_user == 'root' and 'restic' in pillar %} export RESTIC_REPOSITORY={{ salt.pillar.get('restic:repo') }} export RESTIC_PASSWORD={{ salt.pillar.get('restic:pass') }} -{% endif %} - +{%- endif %} +{%- for alias, cmd_str in salt.pillar.get("bash_aliases:{}".format(bashrc_user), {}).items() %} +alias {{ alias }}="{{ cmd_str }}" +{%- endfor %} +{%- endif %}