Currently, i am setting up an Ansible Engine server to manage the Window
Patching in my test environment, i tried with the attached playbook but
somehow ansible not able to complete it and always stuck at: META: ran
handlers
My playbook:
---
- name: Set location
hosts: localhost
connection: local
tasks:
- name: create file
file:
path: /home/test01/log/WindowsPatches_{{ansible_date_time.date}}.txt
state: touch
- name: Get window update patches available in server
hosts: wsus
serial:
- 3
tasks:
- set_fact:
oufile=/home/test01/log/success_{{ansible_date_time.date}}.txt
- name: Verify the Secondary Logon
win_service:
name: seclogon
register: service_info
- name: Enabled secondary logon
win_service:
name: seclogon
start_mode: manual
state: started
when: service_info.start_mode == 'disabled'
- name: find the patches
win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
- UpdateRollups
state: searched
log_path: C:\ansible_wu.txt
register: update_result
ignore_errors: yes
- name: Write data to file
lineinfile:
dest: "{{outfile}}"
line: "{{inventory_hostname}} has
{{update_result.found_update_count}} patches pending installation"
insertafter: EOF
delegate_to: localhost
- name: Stop secondary logon
win_service:
name: seclogon
start_mode: disabled
state: stopped
when: service_info.start_mode == 'disabled'
===========================================
[image: Stuck.JPG]
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/bdbcb57b-e3fe-47ff-a855-45a047e25879%40googlegroups.com.