How to encode a str on a AnsibleUnicode format?

Hi there,

I’m trying to modify the assert module, but I am having some troubles.

The error says that the entry variables must be unicode, but encoding it still do not work.

I am trying to extend the “that” array with some values, the correct type of objects on the array are this:

`

[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
(<ansible.plugins.callback.default.CallbackModule object at 0x7fea57a73610>): <class
‘ansible.parsing.yaml.objects.AnsibleUnicode’> is not JSON serializable

`

And this is the native unicode:

`

[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
(<ansible.plugins.callback.default.CallbackModule object at 0x7f8dd9784610>): <type ‘unicode’> is not JSON
serializable

`

There is any way to encode a variable from string to AnsibleUnicode?

Thank in advance.

Best regards

The original error is the next:

`

TASK [[Assert Comparission] SUCCESS] *********************************************************************************
task path: /home/jparrill/ownCloud/RedHat/RedHat_Consulting/BBVA/repos/ansible-config-management/assert.yml:8
fatal: [localhost]: FAILED! => {
“failed”: true,
“msg”: “The conditional check ‘5af5b95a8e0d6c0455abeb5e2d435380 != 21bfc66dfa05f9f531e50298ff422986’ failed. The error was: template error while templating string: unexpected char u’a’ at 7. String: {% if 5af5b95a8e0d6c0455abeb5e2d435380 != 21bfc66dfa05f9f531e50298ff422986 %} True {% else %} False {% endif %}”
}

PLAY RECAP ***********************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1

`