I'm running the panos_op ansible module and struggling to parse the output.
ok: [localhost] => {
"result": {
"changed": true,
"failed": false,
"msg": "Done",
"stdout": "{\"response\": {\"@status\": \"success\", \"result\": \"no\"}}",
"stdout_lines": [
"{\"response\": {\"@status\": \"success\", \"result\": \"no\"}}"
],
"stdout_xml": "<response status=\"success\"><result>no</result></response>"
}
}
This is as close as I can get to assigning the value for "result".
ok: [localhost] => {
"result.stdout": {
"response": {
"@status": "success",
"result": "no"
}
}
}
My goal is to set a conditional loop for the ansible task.
tasks:
- name: Checking for pending changes
panos_op:
ip_address: '{{ host }}'
password: '{{ operator_pw }}'
username: '{{ operator_user}}'
cmd: 'check pending-changes'
register: result
until: result.stdout.result = no
retries: 10
delay: 5
tags: check
How can I make this work?
UPDATE: I've tried it another way, but now I have a new issue trying to deal with a literal "<" char.
tasks:
- name: Checking for pending changes
panos_op:
ip_address: '{{ host }}'
password: '{{ operator_pw }}'
username: '{{ operator_user}}'
cmd: 'check pending-changes'
register: result
- fail:
msg: The Firewall has pending changes to commit.
when: '"<result>no"' not in result.stdout_xml
ERROR: did not find expected key
Any help at all would be very appreciated.