ansible-role-basic-system-s.../tasks/custom_bashrc.yml

114 lines
4.1 KiB
YAML

---
- 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 }}"
state: present
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_skel_bashrc_file }}') }}"
- 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 }}"
state: absent
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_skel_bashrc_file }}') }}"
- 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 }}"
state: present
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_root_bashrc_file }}') }}"
- 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 }}"
state: absent
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_root_bashrc_file }}') }}"
- 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 }}"
state: present
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_history_settings_file }}') }}"
- 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 }}"
state: absent
loop:
- "{{ lookup('ansible.builtin.file', '{{ bash_custom_history_settings_file }}') }}"
- name: custom_bashrc | Remove the bash history logs directory
ansible.builtin.file:
path: "{{ bash_custom_history_directory }}"
state: absent