-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-ec2-win-lic.yaml
97 lines (77 loc) · 3.16 KB
/
update-ec2-win-lic.yaml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
- hosts: all
user: administrator
gather_facts: true
tasks:
tasks:
- name: Get Ansible network facts
debug:
msg: "{{ item.connection_name }}"
with_items:
- "{{ ansible_facts['interfaces'] }}"
- name: Get Ansible network facts
debug:
var: ansible_facts.distribution
- name: Activate windows
win_shell: route DELETE 169.254.169.251; route DELETE 169.254.169.250; route delete 169.254.169.254 ; route add 169.254.169.254 MASK 255.255.255.255 0.0.0.0; route -p ADD 169.254.169.251 MASK 255.255.255.255 0.0.0.0; route -p ADD 169.254.169.250 MASK 255.255.255.255 0.0.0.0
register: kmskey1
args:
chdir: C:\Windows\System32\
- debug:
var: kmsroute.stdout_lines | list
- name: Activate windows
win_shell: cscript slmgr.vbs /act-type 2
args:
chdir: C:\Windows\System32\
register: kmsact
- name: Activate windows
win_shell: cscript slmgr.vbs /upk
args:
chdir: C:\Windows\System32\
register: kmskey
- name: Activate windows
win_shell: cscript slmgr.vbs /skms 169.254.169.250:1688
args:
chdir: C:\Windows\System32\
register: kmskey
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk CB7KF-XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2016DC
when: ansible_facts.distribution == "Microsoft Windows Server 2016 Datacenter"
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk WC2BQ--XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2016STD
when: ansible_facts.distribution == "Microsoft Windows Server 2016 Standard"
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk D2N9P--XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2012STD
when: ansible_facts.distribution == "Microsoft Windows Server 2012 R2 Standard"
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk W3GGN--XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2012DC
when: ansible_facts.distribution == "Microsoft Windows Server 2012 R2 Datacenter"
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk WMDGN--XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2019DC
when: ansible_facts.distribution == "Microsoft Windows Server 2019 Datacenter"
- name: Activate windows
win_shell: cscript slmgr.vbs /ipk N69G4--XXXXX-XXXXX-XXXXX-XXXXX
args:
chdir: C:\Windows\System32\
register: kmskey2019STD
when: ansible_facts.distribution == "Microsoft Windows Server 2019 Standard"
- name: Activate windows
win_shell: cscript slmgr.vbs /ato
args:
chdir: C:\Windows\System32\
register: kmskeyato