forked from ansible/product-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpdesk_new_user_portal.yml
39 lines (35 loc) · 1.14 KB
/
helpdesk_new_user_portal.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Helpdesk new user portal
hosts: "{{ _hosts | default('os_windows') }}"
gather_facts: false
tasks:
- name: Setting host facts using complex arguments
ansible.builtin.set_fact:
temp_password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
# Example result: ['&Qw2|E[-']
- name: Create new user
community.windows.win_domain_user:
name: "{{ firstname }} {{ surname }}"
firstname: "{{ firstname }}"
surname: "{{ surname }}"
sam_account_name: "{{ firstname[0] }}{{ surname }}"
company: BobCo
password: "{{ temp_password }}"
state: present
groups:
- "GroupA"
- "GroupB"
street: "{{ street }}"
city: "{{ city }}"
state_province: IN
postal_code: "{{ postal_code }}"
country: US
attributes:
telephoneNumber: "{{ telephone_number }}"
register: new_user
- name: Display User
ansible.builtin.debug:
var: new_user
- name: Show temp password
ansible.builtin.debug:
var: temp_password