ansible-antidote-role/tasks/configure.yml

57 lines
1.5 KiB
YAML
Raw Normal View History

2022-11-20 18:55:05 +01:00
---
2022-12-29 16:07:16 +01:00
- name: Set default shell for users
become: true
ansible.builtin.user:
2022-11-20 18:55:05 +01:00
name: "{{ user.username }}"
shell: /bin/zsh
when: user.antidote_plugins is defined
2022-11-20 18:59:29 +01:00
loop: "{{ antidote_users }}"
2022-11-20 18:55:05 +01:00
loop_control:
loop_var: user
label: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
- name: Write .antidoterc for users
become: true
2022-11-20 18:55:05 +01:00
become_user: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
ansible.builtin.template:
2022-11-20 18:55:05 +01:00
src: antidoterc.j2
dest: "~{{ user.username }}/.antidoterc"
mode: "u=rw,go=r"
when: user.antidote_plugins is defined
2022-11-20 18:59:29 +01:00
loop: "{{ antidote_users }}"
2022-11-20 18:55:05 +01:00
loop_control:
loop_var: user
label: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
- name: Write .zsh_plugins.txt for users
become: true
2022-11-20 18:55:05 +01:00
become_user: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
ansible.builtin.template:
2022-11-20 18:55:05 +01:00
src: zsh_plugins.txt.j2
dest: "~{{ user.username }}/.zsh_plugins.txt"
mode: "u=rw,go=r"
when: user.antidote_plugins is defined
2022-11-20 18:59:29 +01:00
loop: "{{ antidote_users }}"
2022-11-20 18:55:05 +01:00
loop_control:
loop_var: user
label: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
notify: "clean antidote"
2022-11-20 18:55:05 +01:00
2022-12-29 16:07:16 +01:00
- name: Add .antidoterc to .zshrc
become: true
2022-11-20 18:55:05 +01:00
become_user: "{{ user.username }}"
2022-12-29 16:07:16 +01:00
ansible.builtin.lineinfile:
2022-11-20 18:55:05 +01:00
path: "~/.zshrc"
line: "source ~/.antidoterc"
2022-11-20 18:59:29 +01:00
insertbefore: "source ~/.ansible_zshrc"
2022-12-29 16:07:16 +01:00
create: true
2022-11-20 18:55:05 +01:00
mode: "u=rw,go=r"
when: user.antidote_plugins is defined
2022-11-20 18:59:29 +01:00
loop: "{{ antidote_users }}"
2022-11-20 18:55:05 +01:00
loop_control:
loop_var: user
label: "{{ user.username }}"
# - name: configure console for Debian family distributions
# include_tasks: configure-debian-console.yml
# when: ansible_os_family == 'Debian'