Add initial ansible
This commit is contained in:
parent
53d1ad53d1
commit
b536447319
4 changed files with 31 additions and 1 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
Copyright (c) 2022 L3D <l3d@c3woc.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
windows_product_key: 'undefined'
|
13
tasks/activate.yml
Normal file
13
tasks/activate.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Check if product key is defined
|
||||
ansible.builtin.fail:
|
||||
msg: Plese define windows product key
|
||||
when: windows_product_key == 'undefined'
|
||||
|
||||
- name: Set windows product key
|
||||
ansible.windows.win_powershell:
|
||||
script: 'cscript.exe "slmgr.vbs" /ipk {{ windows_product_key }}'
|
||||
|
||||
- name: Akivate Windows
|
||||
ansible.windows.win_powershell:
|
||||
script: "cscript.exe 'slmgr.vbs' /ato"
|
15
tasks/main.yml
Normal file
15
tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Get product id and product key
|
||||
community.windows.win_product_facts:
|
||||
|
||||
- name: Display Windows edition
|
||||
debug:
|
||||
var: ansible_os_license_edition
|
||||
|
||||
- name: Display Windows license status
|
||||
debug:
|
||||
var: ansible_os_license_status
|
||||
|
||||
- name: activate windows
|
||||
ansible.builtin.include_tasks: activate.yml
|
||||
when: ansible_os_license_edition != "Windows(R), Enterprise edition" or ansible_os_license_status != "Licensed"
|
Loading…
Reference in a new issue