I am getting following output from my ansible custom module ‘{‘failed’: False, ‘meta’: {‘Unused Policy Rules IDS’: [0, 3, 4, 5, 6]}, ‘changed’: False}’ to one variable .I need to fetch only “{‘Unused Policy Rules IDS’: [0, 3, 4, 5, 6]”}.Can anyone help to resolve this issue.
Seem like you can register the result result and extract only the meta:
register: result
debug:
var: result.meta
Anyway, you must see how is the data your module return:)
Hi
Thanks for the reply my playbook give me the following output in one variable.
ok: [localhost → localhost] => {
“changed”: false,
“invocation”: {
“module_args”: {
“forti_ip”: “xxxxx”,
“password”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“username”: “xxxx”,
“vdom”: “root”
}
},
“meta”: [
0,
3,
4,
5,
6
]
}
but I need to save this output to one remote machine where the same variable will be called there in data field the changed and failed params are came.
changed: [localhost] => {
“changed”: true,
“invocation”: {
“module_args”: {
“data”: “{‘failed’: False, ‘meta’: [0, 3, 4, 5, 6], ‘changed’: False}”,
“dirname”: “xxxxt”,
“filename”: “fortigate.txt”,
“password”: “xxxxx”,
“remote_machine”: “xxxxx”,
“username”: “xxxxx”
}
},
“meta”: “{‘failed’: False, ‘meta’: [0, 3, 4, 5, 6], ‘changed’: False}”