accounts: configure user home, ssh keys and groups only if it already exists, so that there is no error when run in check mode and user doesn't exist yet
This commit is contained in:
parent
b4e1afa698
commit
a66e1c1ee9
|
@ -84,6 +84,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* post-install: fix missing space in generateldif.sh script
|
||||
* logsentry: fix variables for configuration files
|
||||
* nagios-nrpe: fix allowed_hosts configuration: keep potential added IP, but we cannot use backrefs if the line does not exist yet
|
||||
* accounts: configure user home, ssh keys and groups only if it already exists, so that there is no error when run in check mode and user doesn't exist yet
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
- accounts
|
||||
- admin
|
||||
|
||||
- name: "Gather available local users"
|
||||
getent:
|
||||
database: passwd
|
||||
|
||||
- name: "Home directory for '{{ user.name }}' is only accesible by owner"
|
||||
file:
|
||||
name: '/home/{{ user.name }}'
|
||||
|
@ -30,6 +34,7 @@
|
|||
owner: "{{ user.name }}"
|
||||
group: "{{ user.name }}"
|
||||
state: directory
|
||||
when: user.name in getent_passwd.keys()
|
||||
tags:
|
||||
- accounts
|
||||
- admin
|
||||
|
@ -42,7 +47,9 @@
|
|||
with_items: "{{ user.ssh_keys }}"
|
||||
loop_control:
|
||||
loop_var: ssk_key
|
||||
when: user.ssh_keys is defined
|
||||
when:
|
||||
- user.ssh_keys is defined
|
||||
- user.name in getent_passwd.keys()
|
||||
tags:
|
||||
- accounts
|
||||
- admin
|
||||
|
@ -58,6 +65,7 @@
|
|||
- "{{ evobsd_sudo_group }}"
|
||||
loop_control:
|
||||
loop_var: groups_item
|
||||
when: user.name in getent_passwd.keys()
|
||||
tags:
|
||||
- accounts
|
||||
- admin
|
||||
|
|
Loading…
Reference in a new issue