Hi,
im rather new to ansible (started 2 days ago) and got a problem with the win_updates module. I want all counters like failed, installed etc. for my report within the terminal. For installed, filtered and found updates it works without problems, but for failed updates it throws an attribute not found exception (Error and yml code is below).
When I look into the log file I notice that there is no failed update count either, so I guess this attribute is not created as there are no failed updates right now. Even tho this would be weird as found and installed updates are also 0 and it still works.
Is there an option to just assign it 0, if there are no updates that fall into a particular category? Because otherwise these values are kinda useless as it will constantly run into an exception if theres no failed update.
The playbook code:
- name: Create Report
debug:
msg: - “UPDATE REPORT”
- “Updates found: {{ update_output.found_update_count }}” → Works
- “Updates installed: {{ update_output.installed_update_count }}” → Works
- “Updates failed: {{ update_output.failed_update_count }}” → throws exception
- “Updates filtered: {{ update_output.filtered_updates }}” → Works
The error message:
FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘failed_update_count’\n\nThe error appears to be in ‘/home/david/ansible/playbooks/weeklyRoutine.yml’: line 26, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Create Report\n ^ here\n”}
Thanks in Advance