Hi,
> I'm having trouble with the cisco.mso.mso_schema module (Doc Page
> <
https://docs.ansible.com/ansible/latest/collections/cisco/mso/mso_schema_module.html#parameter-templates>).
> I can't get the first example to work and I think I know why, but I
> don't know if I can solve it. So let me explain my problem.
>
> When I try to add a schema, using the example:
>
> *- name: Add a new schema *
> *cisco.mso.mso_schema: *
> * host: mso_host*
> * username: admin *
> * password: SomeSecretPassword *
> * schema: schema1*
> * state: present *
> * templates: *
> * - name: template1*
> * displayName: template1 *
> * tenantId: niek_tenant*
>
>
>
> I get an error back from the MSO:
>
> *"msg":"MSO Error 125: Malformed body",*
> *"payload":{*
> * "code":125,*
> * "info":{*
> * "obj[0]":[*
> * "\"{'displayName': 'template1', 'name': 'template1',
> 'tenantId': 'niek_tenant'}\" is not an object"*
> * ]*
> * },*
> * "message":"Malformed body"*
> }
>
>
>
> In the error message, you can see that quotes have been added around
> the dictionary that specifies the parameters of the template that is
> created with the schema. I also get the following warning from
> ansible when I run my playbook:
>
> *[WARNING]: The value "templates: {'displayName': 'template1',
> 'name': 'template1', 'tenantId': 'niek_tenant'}" (type dict) was
> converted to "templates: u"{'displayName': 'template1', 'name':
> 'template1', 'tenantId': 'niek_tenant'}"" (type string). If this
> does not look like what you expect, quote the entire value to ensure
> it does not change.*
well, Ansible did what the mso_schema module asked for, namely convert
the list of dicts to a list of strings. See the documentation of the
parameter
(
https://docs.ansible.com/ansible/latest/collections/cisco/mso/mso_schema_module.html#parameter-templates).
I think someone accidentally set the element type to string here. You
should file a bug in the repository:
https://github.com/CiscoDevNet/ansible-mso
The error was introduced in this commit:
https://github.com/CiscoDevNet/ansible-mso/commit/98f010a6889c45536b925a0b77a99e816922929e
Cheers,
Felix