-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows.yml
57 lines (47 loc) · 1.47 KB
/
windows.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- hosts: localhost
gather_facts: true
- hosts: windows
gather_facts: false
roles:
- winrm_check
- winrm_cert
- winrm_check
tasks:
- name: disable winrm http if https is enabled too
ansible.windows.win_powershell:
script: |
winrm delete winrm/config/Listener?Address=*+Transport=HTTP
when: http | bool and https | bool
###############################################################################
- name: user and group management
#-----------------------------------------------------------------------------#
block:
- name: create new local groups
win_group:
name: "{{ item.key }}"
description: "{{ item.value.desc }}"
state: present
loop: "{{ lookup('dict', win_local_groups) }}"
- name: add local user(s)
win_user:
name: "{{ item.key }}"
fullname: "{{ item.value.fullname }}"
password: "{{ item.value.password }}"
state: present
groups: "{{ item.value.groups }}"
loop: "{{ lookup('dict', win_local_users) }}"
no_log: true
- name: remove local user(s)
win_user:
name: "{{ item.key }}"
state: absent
loop: "{{ lookup('dict', win_local_users) }}"
no_log: true
- name: remove local groups
win_group:
name: "{{ item.key }}"
state: absent
loop: "{{ lookup('dict', win_local_groups) }}"
###############################################################################
...