Here is the stat_out details
- ansible.builtin.set_fact:
stat_out: "{{ uri_result['json']['resources'] | selectattr('name', '==','LinuxOsUpdateExtension') | map(attribute='properties') |map(attribute='instanceView')|map(attribute='status')|map(attribute='message') }}"
TASK [debug] **************************************************************************************************************************
ok: [localhost] =>
msg:
- 'Extension Message: Action Completed. [ActivityId=xxxxxxxxxxxx], OperationResult: {"activityId": "xxxxxxx-xxxxxx", "sequenceNumber": 0, "inputStartTime": "2023-08-18T05:34:24.920507Z", "lastModifiedTime": "2023-08-18T06:01:56.188600Z", "extensionTriggerTime": "2023-08-18T05:34:57.745409Z", "osName": "CentOS", "osVersion": "9", "action": "Patching", "actionStatus": "Success", "patchServiceUsed": "YUM", "errors": null, "patchDetails": {"rebootNeeded": true, "rebootStatus": "Completed", "maintenanceWindowExceeded": false, "retriggerCount": 09, "notSelectedPatchCount": 0, "pendingPatchCount": 0, "installedPatchCount": 16, "failedPatchCount": 0, "patches": "eJxxxxxxxxxxx==",
"excludedPatchCount": 0}, "assessmentDetails": {"countByCategory": {"security": 0, "other": 0}, "totalCount": 0, "patches": "eJyLjgUAARUAuQ==", "rebootPending": null}, "logs": "kgjhsdcgdgscf/Y"}'
- name: status of the output
debug:
msg: "status of {{serverName}} is {{ [9] | map('extract', stat_out[0].split(',')) }}"
register: server_status
ignore_errors: yes
The output is
TASK [status of the output] *******************************************************************************************
ok: [localhost] =>
msg: 'status of client11 is ['' "Status": "Completed"'']'