diff --git a/changelogs/fragments/ansible-connection_decode.yml b/changelogs/fragments/ansible-connection_decode.yml new file mode 100644 index 00000000000..7e13dc98265 --- /dev/null +++ b/changelogs/fragments/ansible-connection_decode.yml @@ -0,0 +1,3 @@ +bugfixes: + - ansible-connection - decrypt vaulted parameters before sending over the socket, as + vault secrets are not available on the other side. diff --git a/lib/ansible/module_utils/connection.py b/lib/ansible/module_utils/connection.py index fd0b134087c..1396c1c1510 100644 --- a/lib/ansible/module_utils/connection.py +++ b/lib/ansible/module_utils/connection.py @@ -144,7 +144,7 @@ class Connection(object): ) try: - data = json.dumps(req, cls=AnsibleJSONEncoder) + data = json.dumps(req, cls=AnsibleJSONEncoder, vault_to_text=True) except TypeError as exc: raise ConnectionError( "Failed to encode some variables as JSON for communication with ansible-connection. "