Attempt at customising the bashrc file.
This commit is contained in:
parent
6f86357582
commit
e9f2898efb
|
@ -31,6 +31,18 @@ ubuntu_configure_additional_ints_list: []
|
|||
disable_ipv6: false
|
||||
ipv6_sysctl_value: 1
|
||||
ipv6_sysctl_file: /etc/sysctl.d/10-ipv6-disable.conf
|
||||
|
||||
# Bash prompt and shell history settings
|
||||
#
|
||||
bash_customize_skel_bashrc: false
|
||||
bash_etc_skel_file: /etc/skel/.bashrc
|
||||
bash_custom_skel_bashrc_file: files/skel_bashrc.sh
|
||||
bash_customize_root_bashrc: false
|
||||
bash_custom_root_bashrc_file: files/root_bashrc.sh
|
||||
bash_root_bashrc_file: /etc/.bashrc
|
||||
bash_customize_root_history_settings: false
|
||||
bash_custom_history_directory: /var/log/users_root_history
|
||||
bash_custom_history_settings_file: files/root_bashrc_history.sh
|
||||
#
|
||||
# Define the following variables to manage additional disks and mount points, even static nfs ones
|
||||
additional_disks: false
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
export _ROOT_COLOR=33 # yellow
|
||||
PS1="\[\033[01;${_ROOT_COLOR}m\]${debian_chroot:+($debian_chroot)}ROOT\[\033[01;34m\]@$(hostname -f) \w \@ #\[\033[00m\] "
|
|
@ -0,0 +1,3 @@
|
|||
export HISTTIMEFORMAT="%Y%m%d %H:%M:%S "
|
||||
export HISTSIZE=10000
|
||||
export HISTFILE=/var/log/users_root_history/history-$(who am i | awk '{print $1}';exit)
|
|
@ -0,0 +1,7 @@
|
|||
export _ROOT_COLOR=33 # yellow
|
||||
export _USER_COLOR=36 # cyan
|
||||
if [ "`id -u`" -eq 0 ]; then
|
||||
PS1="\[\033[01;${_ROOT_COLOR}m\]${debian_chroot:+($debian_chroot)}ROOT\[\033[01;34m\]@$(hostname -f) \w \@ #\[\033[00m\] "
|
||||
else
|
||||
PS1="\[\033[01;${_USER_COLOR}m\]${debian_chroot:+($debian_chroot)}\u\[\033[01;34m\]@$(hostname -f) \w \@ $\[\033[00m\] "
|
||||
fi
|
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
- name: custom_bashrc | Manage the skel bashrc customizations
|
||||
when: bash_customize_skel_bashrc
|
||||
tags:
|
||||
- bashrc
|
||||
- etcskel
|
||||
block:
|
||||
- name: custom_bashrc | Manage the skel bashrc customizations
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_etc_skel_file }}"
|
||||
marker_begin: 'bashrc_customizations_start'
|
||||
marker_end: 'bashrc_customizations_end'
|
||||
marker: "# {mark} Customization to bashrc installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_skel_bashrc_file }}') }}"
|
||||
state: present
|
||||
|
||||
- name: custom_bashrc | Remove the skel bashrc customizations
|
||||
when: not bash_customize_skel_bashrc
|
||||
tags:
|
||||
- bashrc
|
||||
- etcskel
|
||||
block:
|
||||
- name: custom_bashrc | Remove the skel bashrc customizations
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_etc_skel_file }}"
|
||||
marker_begin: 'bashrc_customizations_start'
|
||||
marker_end: 'bashrc_customizations_end'
|
||||
marker: "# {mark} Customization to bashrc installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_skel_bashrc_file }}') }}"
|
||||
state: absent
|
||||
|
||||
- name: custom_bashrc | Manage the root user bashrc customization
|
||||
when: bash_customize_root_bashrc
|
||||
tags:
|
||||
- bashrc
|
||||
- root_bashrc
|
||||
block:
|
||||
- name: custom_bashrc | Manage the root user bashrc customization
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_root_bashrc_file }}"
|
||||
marker_begin: 'bashrc_customizations_start'
|
||||
marker_end: 'bashrc_customizations_end'
|
||||
marker: "# {mark} Customization to bashrc installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_root_bashrc_file }}') }}"
|
||||
state: present
|
||||
|
||||
- name: custom_bashrc | Remove the root user bashrc customization
|
||||
when: not bash_customize_root_bashrc
|
||||
tags:
|
||||
- bashrc
|
||||
- root_bashrc
|
||||
block:
|
||||
- name: custom_bashrc | Remove the root user bashrc customization
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_root_bashrc_file }}"
|
||||
marker_begin: 'bashrc_customizations_start'
|
||||
marker_end: 'bashrc_customizations_end'
|
||||
marker: "# {mark} Customization to bashrc installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_root_bashrc_file }}') }}"
|
||||
state: absent
|
||||
|
||||
- name: custom_bashrc | Manage the root user bashrc history settings
|
||||
when: bash_customize_root_history_settings
|
||||
tags:
|
||||
- bashrc
|
||||
- root_bashrc_history_settings
|
||||
block:
|
||||
- name: custom_bashrc | Create the bash history logs directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bash_custom_history_directory }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
- name: custom_bashrc | Manage the root user bashrc history settings
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_root_bashrc_file }}"
|
||||
marker_begin: 'history_customizations_start'
|
||||
marker_end: 'history_customizations_end'
|
||||
marker: "# {mark} Customization to the bash prompt installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_history_settings_file }}') }}"
|
||||
state: present
|
||||
|
||||
- name: custom_bashrc | Remove the root user bashrc history settings
|
||||
when: not bash_customize_root_history_settings
|
||||
tags:
|
||||
- bashrc
|
||||
- root_bashrc_history_settings
|
||||
block:
|
||||
- name: custom_bashrc | Remove the root user bashrc history settings
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ bash_root_bashrc_file }}"
|
||||
marker_begin: 'history_customizations_start'
|
||||
marker_end: 'history_customizations_end'
|
||||
marker: "# {mark} Customization to the bash prompt installed via ansible"
|
||||
block: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_history_settings_file }}') }}"
|
||||
state: absent
|
||||
- name: custom_bashrc | Remove the bash history logs directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bash_custom_history_directory }}"
|
||||
state: absent
|
|
@ -41,3 +41,5 @@
|
|||
when:
|
||||
- nfs_server_enabled
|
||||
- not nfs_server_ganesha_enabled
|
||||
- name: Custom bashrc settings
|
||||
ansible.builtin.import_tasks: custom_bashrc.yml
|
||||
|
|
Loading…
Reference in New Issue