Hi,
I’m having trouble with the cisco.mso.mso_schema module (Doc Page). 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.
I also tried adding a schema using a POST request outside of ansible to the MSO. This worked, and the body of my POST was:
{
“displayName”: “schema1”,
“templates”: [
{
“name”: “template1”,
“displayName”: “template1”,
“tenantId”: “5fa29a543c0000e9c3a6ed80”
}
]
}
I think that the post request that ansible sends to the MSO is (Notice the extra quotes around the template definition):
{
“displayName”: “schema1”,
“templates”: [
"{
“name”: “template1”,
“displayName”: “template1”,
“tenantId”: “5fa29a543c0000e9c3a6ed80”
}"
]
}
Can someone tell me if I’m doing something wrong, or if this might be a bug in Ansible or in the used Cisco module?
Version information:
Ansible version: 2.10.2
Python3 version: 3.6.9
Cisco.mso version: 1.0.0
Kind regards,
Niek