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/tasks/bashrc.yml
2024-05-24 11:40:08 +02:00

36 lines
939 B
YAML

---
- name: Create global bashrc configuration
become: true
ansible.builtin.template:
src: 'templates/bash.bashrc.j2'
dest: '/etc/bash.bashrc'
owner: 'root'
group: 'root'
backup: true
mode: 'u=rw,g=r,o=r'
- name: Create bashrc configuration per user
become: true
ansible.builtin.template:
src: 'templates/dotbashrc.j2'
dest: "{{ user.home | default('/home/' + user.name) }}/.bashrc"
owner: "{{ user.name }}"
group: "{{ user.name }}"
mode: '0640'
backup: true
loop: "{{ _l3d_users__merged_users }}"
loop_control:
label: "user={{ user.name }}"
loop_var: user
when: user.state | default ('present') == 'present'
- name: Create bashrc for root
become: true
ansible.builtin.template:
src: 'templates/dotbashrc.j2'
dest: "/root/.bashrc"
owner: 'root'
group: 'root'
mode: '0640'
backup: true
when: user.state | default ('present') == 'present'