script return dict() type. This dict saves in ansible variable as string.
How can I save dict from python as dict in ansible?
have you tried from_json/to_nice_json filters?
yepp, I tried both (python returns: json.dump(data))
Can you give example of python result? Like debug: var=python_result?
FAILED! => {"msg": "|combine expects dictionaries, got '{\"key1\": \"val1\", \"key2\": \"val2"}\\n'"} and from python script: self.result_json = json.dumps(self.result) print(self.result_json)
Before combine? Just result
no, could you show the var itself without any filters
ok: [ip.ip.ip.ip] => { "msg": { "changed": false, "failed": false, "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "{\"key1\": \"val1\", \"key2\": \"val2"}\n", "stdout_lines": [ "{"{\"key1\": \"val1\", \"key2\": \"val2"}\n"}" ] } }
Look above please
Wrong formatted it seems "stdout": "{\"key1\": \"val1\", \"key2\": \"val2"}\n" Check two last quotes
Обсуждают сегодня