ansible-role-unix-users/templates/shell_rc_file.j2
Markus Pesch 5907f1617a
All checks were successful
continuous-integration/drone/push Build is passing
feat: support bashrc aliases, envs and functions
2024-03-02 19:20:28 +01:00

23 lines
553 B
Django/Jinja

#
# {{ ansible_managed }}
#
{% if shell_rc_file.functions is defined %}
{% for function in shell_rc_file.functions %}
function {{ function.name }} {
{{ function.body | indent(2, True) }}
}
{% endfor %}
{% endif %}
{% if shell_rc_file.envs is defined %}
{% for env in shell_rc_file.envs %}
{{ 'export ' if env.export is defined and env.export }}{{ env.key }}="{{ env.value }}"
{% endfor %}
{% endif %}
{% if shell_rc_file.aliases is defined %}
{% for alias in shell_rc_file.aliases %}
alias {{ alias.key }}='{{ alias.value }}'
{% endfor %}
{% endif %}