When using the task below with the yaml data that is shown below I end up 
getting an error indicating that my latitude number is not a number. If I 
just hard code a number in the latitude value the task works as expected. 
Any suggestions on how to get this to work?

Ansible task
# DNA Center Site Creation
- name: Create building
cisco.dnac.site_create:
dnac_host: "{{ ansible_host }}"
dnac_username: "{{ username }}"
dnac_password: "{{ password }}"
dnac_verify: false
dnac_port: 443
dnac_version: "2.3.3.0"
site:
building:
address: "{{ item.address }}"
country: "{{ item.country }}"
latitude: "{{ (item.latitude | float) }}"
longitude: "{{ (item.longitude | float) }}" 
name: "{{ item.name }}"
parentName: "{{ item.parent_name }}"
type: "{{ item.site_type }}"
loop: "{{ sites }}"
when: item.site_type == 'building'

YAML Data 
# vars file for dnac-create-site-hierarchy
sites:
# North America
- name: "US"
site_type: "area"
parent_name: "Global"
- name: "Big Campus"
site_type: "area"
parent_name: "Global/US"
- name: "Big_bldg"
site_type: "building"
address: "2222 Big Dr."
country: "United States"
latitude: 44.22222
longitude: -111.11111
parent_name: "Global/US/Big Campus"

Error Message returned from the Cisco DNAC SDK which is required for the 
Cisco.DNAC Ansible Module

raise MalformedRequest(
dnacentersdk.exceptions.MalformedRequest: {'type': 'building', 'site': {
'building': {'address': '2222 Big Dr.', 'country': 'United States', 
'latitude': '44.22222', 'longitude': '-111.11111', 'name': 'Big_bldg', 
'parentName': 'Global/US/Big Campus'}}} is invalid. Reason: 
data.site.building.latitude 
must be number
failed: [dna-center-lab] (item={'name': 'Big_bldg', 'site_type': 'building', 
'address': '2222 Big Dr.', 'country': 'United States', 'latitude': 44.22222, 
'longitude': -111.11111, 'parent_name': 'Global/US/Big Campus'}) => {
"ansible_loop_var": "item",
"item": {
"address": "2222 Big Dr.",
"country": "United States",
"latitude": 44.22222,
"longitude": -111.11111,
"name": "Big_bldg",
"parent_name": "Global/US/Big Campus",
"site_type": "building"
},
"msg": "An error occured when executing operation. The error was: {'type': 
'building', 'site': {'building': {'address': '2222 Big Dr.', 'country': 
'United States', 'latitude': '44.22222', 'longitude': '-111.11111', 'name': 
'Big_bldg', 'parentName': 'Global/US/Big Campus'}}} is invalid. Reason: 
data.site.building.latitude must be number"
}

Thank you,

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84cec934-05e7-4ed8-a67a-44d35f83bb0cn%40googlegroups.com.

Reply via email to