mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-28 23:37:21 +00:00
User creation for protected zone
This commit is contained in:
1 parent
b160516078
commit
621d97fb63
6 files changed
+65
-11
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Check User Action
|
- name: Check User Action is valid
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- user_action is defined
|
- user_action is defined
|
||||||
@@ -19,10 +19,11 @@
|
|||||||
- username|length <= 20
|
- username|length <= 20
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
- name: Check User Info
|
- name: Check User Info [CREATE]
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- study_code is defined
|
- study_code is defined
|
||||||
|
# - username checked already
|
||||||
- password is defined
|
- password is defined
|
||||||
- firstname is defined
|
- firstname is defined
|
||||||
- lastname is defined
|
- lastname is defined
|
||||||
@@ -31,6 +32,31 @@
|
|||||||
quiet: true
|
quiet: true
|
||||||
when: user_action == 'create'
|
when: user_action == 'create'
|
||||||
|
|
||||||
|
- name: Check User Info [RESET]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
# - username checked already
|
||||||
|
- password is defined
|
||||||
|
quiet: true
|
||||||
|
when: user_action == 'reset'
|
||||||
|
|
||||||
|
- name: Check User Info [DISABLE]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
# - username checked already
|
||||||
|
- study_code is defined # so can be removed from group (WIP)
|
||||||
|
- user_role is defined # so can be removed from group (WIP)
|
||||||
|
quiet: true
|
||||||
|
when: user_action == 'disable'
|
||||||
|
|
||||||
|
- name: Check User Info [MODIFY]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- study_code is defined
|
||||||
|
- user_role is defined
|
||||||
|
quiet: true
|
||||||
|
when: user_action == 'modify'
|
||||||
|
|
||||||
- name: Check Study folder & group
|
- name: Check Study folder & group
|
||||||
block:
|
block:
|
||||||
- name: Check AD group exists
|
- name: Check AD group exists
|
||||||
|
|||||||
@@ -9,11 +9,15 @@
|
|||||||
description: "{{ user_role }} - {{ study_code }}"
|
description: "{{ user_role }} - {{ study_code }}"
|
||||||
path: ou=Project Users,dc={{ win_project }},dc=loc
|
path: ou=Project Users,dc={{ win_project }},dc=loc
|
||||||
groups:
|
groups:
|
||||||
- "{{ study_code }}"
|
add:
|
||||||
- Remote Desktop Users
|
- "{{ study_code }}"
|
||||||
|
- Remote Desktop Users
|
||||||
email: "{{ email }}"
|
email: "{{ email }}"
|
||||||
attributes:
|
attributes:
|
||||||
HomeDirectory: "{{ study_folder }}"
|
add:
|
||||||
|
HomeDirectory: "{{ study_folder }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
password_expired: true
|
password_expired: true
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- import_tasks: exporter.yml # referece exporter so modify can be more general purpose
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- name: Modify Export Access
|
||||||
|
block:
|
||||||
|
- name: Add user to exporter group
|
||||||
|
microsoft.ad.user:
|
||||||
|
name: "{{ username }}"
|
||||||
|
description: "{{ user_role }} - {{ study_code }}"
|
||||||
|
path: ou=Project Users,dc={{ win_project }},dc=loc
|
||||||
|
groups:
|
||||||
|
add:
|
||||||
|
- "{{ exporter_group }}"
|
||||||
|
state: present
|
||||||
|
when: user_role == 'Exporter'
|
||||||
|
|
||||||
|
- name: Remove user from exporter group
|
||||||
|
microsoft.ad.user:
|
||||||
|
name: "{{ username }}"
|
||||||
|
description: "{{ user_role }} - {{ study_code }}"
|
||||||
|
path: ou=Project Users,dc={{ win_project }},dc=loc
|
||||||
|
groups:
|
||||||
|
remove:
|
||||||
|
- "{{ exporter_group }}"
|
||||||
|
state: present
|
||||||
|
when: user_role != 'Exporter'
|
||||||
|
when: project_zone == 'protected'
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: exporter.yml
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Reset AD user password
|
- name: Reset AD user password
|
||||||
block:
|
block:
|
||||||
- name: debug
|
|
||||||
debug:
|
|
||||||
var: password
|
|
||||||
|
|
||||||
- name: Reset AD user password
|
- name: Reset AD user password
|
||||||
microsoft.ad.user:
|
microsoft.ad.user:
|
||||||
name: "{{ username }}"
|
name: "{{ username }}"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
study_folder: \\{{ win_project }}.loc\Study_Data\{{ study_code }}
|
study_folder: \\{{ win_project }}.loc\Study_Data\{{ study_code }}
|
||||||
|
exporter_group: "{{ study_code }}-exporter"
|
||||||
|
|
||||||
valid_actions: ["create", "reset", "disable"]
|
valid_actions: ["create", "reset", "disable", "modify"]
|
||||||
Reference in new issue
Block a user