This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-22 18:55:36 +00:00
|
|
|
---
|
2019-09-27 06:59:11 +00:00
|
|
|
- name: Load users variables
|
|
|
|
include_vars:
|
|
|
|
file: users.yml
|
|
|
|
|
|
|
|
- name: Reconcile user targets with host targets to get host users
|
|
|
|
set_fact:
|
|
|
|
local_users: >-
|
|
|
|
{{
|
|
|
|
local_users | default([]) + ([item] if item.targets | intersect(targets) else [])
|
|
|
|
}}
|
|
|
|
loop: "{{ users }}"
|
|
|
|
|
|
|
|
- name: Determine local user names
|
|
|
|
set_fact:
|
|
|
|
local_user_names: "{{ local_user_names | default([]) + [item.name] }}"
|
|
|
|
loop: "{{ local_users }}"
|
|
|
|
|
|
|
|
- name: Determine administrative users
|
|
|
|
set_fact:
|
|
|
|
local_admin_users: >-
|
|
|
|
{{
|
|
|
|
local_admin_users | default([]) + ([item] if item.admin | default(False) else [])
|
|
|
|
}}
|
|
|
|
loop: "{{ local_users }}"
|
|
|
|
|
|
|
|
- name: Determine existing users
|
|
|
|
shell: 'grep omni /etc/group | cut -d: -f4 | tr "," "\n"'
|
|
|
|
changed_when: false
|
|
|
|
register: local_existing_users
|
|
|
|
|
|
|
|
- name: Determine removed users
|
|
|
|
set_fact:
|
|
|
|
local_removed_users: >-
|
|
|
|
{{
|
|
|
|
local_removed_users | default([]) +
|
|
|
|
([item] if item not in local_user_names else [])
|
|
|
|
}}
|
|
|
|
loop: "{{ local_existing_users.stdout_lines }}"
|