Skip to content
Snippets Groups Projects
Commit 9a2fedee authored by Nico's avatar Nico
Browse files

users: remove users which don't have access any more

Remove the users which are in users_database, but not in the individual
users for the host/group.
parent 790f2eed
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
loop_control: loop_control:
loop_var: user loop_var: user
- name: Removing users without access
include: user_remove.yml
loop: '{{ user_database | dict2items }}'
loop_control:
loop_var: user
- name: Deploying public key for users with root access - name: Deploying public key for users with root access
include: root_pubkey.yml include: root_pubkey.yml
vars: vars:
......
---
- name: "Remove user {{ user.key }}"
user:
name: "{{ user.key }}"
uid: "{{ user_database[user.key].uid }}"
state: absent
when: 'user.key not in users'
- name: "Remove root ssh keys for {{ user.key }}"
authorized_key:
user: "root"
state: absent
key: '{{ pubkey }}'
when: 'user.key not in users'
loop: '{{ user.value.pubkeys }}'
loop_control:
loop_var: pubkey
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment