1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_users.git synced 2024-08-16 10:29:50 +02:00
ansible_collection_users/roles/dotfiles/templates/dotbashrc.j2
2024-05-24 11:40:08 +02:00

73 lines
2 KiB
Django/Jinja

{% if user is defined %}
# {{ user.home | default('/home/' + user.name) }}/.bashrc"
# for user {{ user.name }}
{% else %}
# /root/.bashrc
{% endif %}
{{ ansible_managed | ansible.builtin.comment }}
# Source global definitions
if [ -f /etc/bash.bashrc ]; then
source /etc/bash.bashrc
fi
# User specific environment
PATH="{{ l3d_users__bashrc_path }}"
export PATH
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
{% for alias in l3d_users__dotfiles__aliases %}
{% if alias.color %}
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
{% endif %}
{% endfor %}
fi
{% for alias in l3d_users__dotfiles__aliases %}
{% if not alias.color %}
alias {{ alias.alias }}="{{ alias.command }}"
{% endif %}
{% endfor %}
{% if l3d_users__dotfiles__bash_completion_enabled %}
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
{% endif %}
# fancy Prompt
export PS1='{{ l3d_users__dotfiles__user_prompt }} '
# bash_history
HISTCONTROL={{ l3d_users__dotfiles__history_control }}
shopt -s histappend
{% if ansible_os_family == 'Redhat' %}
# HISTSIZE={{ l3d_users__dotfiles__history_size }}
# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
{% elif ansible_distribution == "CentOS" %}
# HISTSIZE={{ l3d_users__dotfiles__history_size }}
# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
{% else %}
HISTSIZE={{ l3d_users__dotfiles__history_size }}
HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
{% endif %}
# additional general rules
{% for _row in l3d_users__dotfiles__additional_user_bashrc_lines | default() %}
{{ _row }}
{% endfor %}
{% if user is defined %}
# additional user rules
{% for custom in user.bashrc | default([]) %}
{{ custom }}
{% endfor %}
{% endif %}
# vim:ts=4:sw=4