From ed45cddfcb16b4dff62ea61fe7eb59127976c491 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 31 Dec 2022 20:40:01 +0100 Subject: [PATCH] fix and lint role --- tasks/activate.yml | 39 +++++++++++++++++++++++++++++++++++++-- tasks/main.yml | 6 +++--- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/tasks/activate.yml b/tasks/activate.yml index d72d40a..fd10ac2 100644 --- a/tasks/activate.yml +++ b/tasks/activate.yml @@ -6,8 +6,43 @@ - name: Set windows product key ansible.windows.win_powershell: - script: 'cscript.exe "slmgr.vbs" /ipk {{ windows_product_key }}' + script: 'cscript.exe "C:\Windows\System32\slmgr.vbs" /ipk {{ windows_product_key }}' + register: a1 + +- name: Show Script Output + ansible.builtin.debug: + msg: "{{ a1.output }}" + verbosity: 1 - name: Akivate Windows ansible.windows.win_powershell: - script: "cscript.exe 'slmgr.vbs' /ato" + script: 'cscript.exe "C:\Windows\System32\slmgr.vbs" /ato' + register: a2 + +- name: Show Script Output + ansible.builtin.debug: + msg: "{{ a2 }}" + verbosity: 1 + +- name: Get product id and product key + community.windows.win_product_facts: + +- name: Display Windows edition + ansible.builtin.debug: + var: ansible_os_license_edition + +- name: Display Windows license status + ansible.builtin.debug: + var: ansible_os_license_status + +- name: Install all security updates with automatic reboots + ansible.windows.win_updates: + category_names: + - SecurityUpdates + - CriticalUpdates + reboot: true + +- name: Install all critical and rollup updates without a scheduled task + ansible.windows.win_updates: + category_names: + - UpdateRollups diff --git a/tasks/main.yml b/tasks/main.yml index 816323c..867f017 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,13 +3,13 @@ community.windows.win_product_facts: - name: Display Windows edition - debug: + ansible.builtin.debug: var: ansible_os_license_edition - name: Display Windows license status - debug: + ansible.builtin.debug: var: ansible_os_license_status -- name: activate windows +- name: Activate windows ansible.builtin.include_tasks: activate.yml when: ansible_os_license_edition != "Windows(R), Enterprise edition" or ansible_os_license_status != "Licensed"