Fix user creation

This commit is contained in:
Patrick Neff 2022-01-23 03:09:02 +01:00
parent 828f7b7274
commit 4aa6a08a95
1 changed files with 11 additions and 8 deletions

View File

@ -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'