diff --git a/tasks/users.yml b/tasks/users.yml index b3e54fa..026ba81 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -4,7 +4,8 @@ ansible.builtin.user: name: "{{ user.username }}" state: "{{ user.state | default(omit) }}" - groups: "{{ user.groups | default(omit) | join(',') }}" + group: "{{ user.group | default(omit) }}" + groups: "{{ user.groups | default(omit) }}" comment: "{{ user.comment | default(omit) }}" shell: "{{ user.shell | default(omit) }}" password: "{{ user.password | default(omit) }}" @@ -72,24 +73,26 @@ - name: "Install antigen for '{{ user.username }}'." tags: users - become: true - become_user: "{{ user.username }}" ansible.builtin.get_url: url: https://git.io/antigen dest: "{{ user.home_dir | default('/home/' + user.username) }}/.zsh/antigen.zsh" mode: 0600 - when: - - user.shell is defined - - "'/zsh' in user.shell" - name: "Install tpm for user '{{ user.username }}'." tags: users - become: true - become_user: "{{ user.username }}" ansible.builtin.git: repo: "https://github.com/tmux-plugins/tpm" dest: "{{ user.home_dir | default('/home/' + user.username) }}/.tmux/plugins/tpm" version: v3.0.0 + - name: "Fix permissions for user '{{ user.username }}'" + ansible.builtin.file: + path: "{{ item }}" + owner: "{{ user.username }}" + recurse: yes + with_items: + - "{{ user.home_dir | default('/home/' + user.username) }}/.tmux/plugins/tpm" + - "{{ user.home_dir | default('/home/' + user.username) }}/.zsh" + when: - user.state | default('present') == 'present'