Adding user state management
This commit is contained in:
parent
5a88ccb426
commit
7c91db950b
2 changed files with 7 additions and 2 deletions
|
@ -17,6 +17,7 @@ base_users: []
|
||||||
# ssh_keys_force: false # setting ssh_keys_force to true will overwrite the authorized_keys file to only be the ssh keys provided
|
# ssh_keys_force: false # setting ssh_keys_force to true will overwrite the authorized_keys file to only be the ssh keys provided
|
||||||
# groups: []
|
# groups: []
|
||||||
# groups_append: true
|
# groups_append: true
|
||||||
|
# state: present
|
||||||
|
|
||||||
# Install all available updates at runtime
|
# Install all available updates at runtime
|
||||||
base_core_install_updates: true
|
base_core_install_updates: true
|
||||||
|
|
|
@ -4,11 +4,14 @@
|
||||||
- name: "{{ user.username }} user setup"
|
- name: "{{ user.username }} user setup"
|
||||||
user:
|
user:
|
||||||
name: "{{ user.username }}"
|
name: "{{ user.username }}"
|
||||||
|
state: "{{ user.state | default('present') }}"
|
||||||
|
force: true
|
||||||
password_lock: "{{ user.disable_password | default(false) }}"
|
password_lock: "{{ user.disable_password | default(false) }}"
|
||||||
|
|
||||||
- name: "{{ user.username }} group setup"
|
- name: "{{ user.username }} group setup"
|
||||||
user:
|
user:
|
||||||
name: "{{ user.username }}"
|
name: "{{ user.username }}"
|
||||||
|
state: "{{ user.state | default('present') }}"
|
||||||
groups: "{{ user.groups | join(',') }}"
|
groups: "{{ user.groups | join(',') }}"
|
||||||
append: "{{ user.groups_append | default('true') }}"
|
append: "{{ user.groups_append | default('true') }}"
|
||||||
when: user.groups is defined
|
when: user.groups is defined
|
||||||
|
@ -16,13 +19,14 @@
|
||||||
- name: "Configure {{ user.username }} password"
|
- name: "Configure {{ user.username }} password"
|
||||||
user:
|
user:
|
||||||
name: "{{ user.username }}"
|
name: "{{ user.username }}"
|
||||||
|
state: "{{ user.state | default('present') }}"
|
||||||
password: "{{ user.password | default('*') }}"
|
password: "{{ user.password | default('*') }}"
|
||||||
when: user.password is defined
|
when: user.password is defined
|
||||||
|
|
||||||
- name: "Setup {{ user.username }} authorized keys"
|
- name: "Setup {{ user.username }} authorized keys"
|
||||||
authorized_key:
|
authorized_key:
|
||||||
user: "{{ user.username }}"
|
user: "{{ user.username }}"
|
||||||
state: present
|
state: "{{ user.state | default('present') }}"
|
||||||
key: "{{ user.ssh_keys | join('\n') }}"
|
key: "{{ user.ssh_keys | join('\n') }}"
|
||||||
exclusive: "{{ user.ssh_keys_force | default('false') }}"
|
exclusive: "{{ user.ssh_keys_force | default('false') }}"
|
||||||
tags:
|
tags:
|
||||||
|
@ -32,7 +36,7 @@
|
||||||
- name: "Setup {{ user.username }} authorized keys from url"
|
- name: "Setup {{ user.username }} authorized keys from url"
|
||||||
authorized_key:
|
authorized_key:
|
||||||
user: "{{ user.username }}"
|
user: "{{ user.username }}"
|
||||||
state: present
|
state: "{{ user.state | default('present') }}"
|
||||||
key: "{{ user.ssh_keys }}"
|
key: "{{ user.ssh_keys }}"
|
||||||
exclusive: "{{ user.ssh_keys_force | default('false') }}"
|
exclusive: "{{ user.ssh_keys_force | default('false') }}"
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Add table
Reference in a new issue