ansible-role-unix-users/tasks/create_shell_rc_file.yml
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

26 lines
833 B
YAML

---
- name: "Create shell rc file directory {{ shell_rc_file.file | dirname }}"
ansible.builtin.file:
path: "{{ shell_rc_file.file | dirname }}"
owner: "{{ unix_user.key }}"
group: "{{ unix_user.value.group | default('users') }}"
mode: "0755"
state: "directory"
- name: "Create shell rc file {{ shell_rc_file.file }}"
ansible.builtin.template:
src: shell_rc_file.j2
dest: "{{ shell_rc_file.file }}"
owner: "{{ unix_user.key }}"
group: "{{ unix_user.value.group | default('users') }}"
mode: "0644"
- name: "Source shell rc file {{ shell_rc_file.file }}"
ansible.builtin.lineinfile:
path: "{{ user_user_home }}/.bashrc"
line: "source \"{{ shell_rc_file.file }}\""
owner: "{{ unix_user.key }}"
group: "{{ unix_user.value.group | default('users') }}"
state: "present"