Meraki group policy deployment using API via Ansible uri module

FarhanJamil
Just browsing

Meraki group policy deployment using API via Ansible uri module

Hi all

I am new to both Ansible and Meraki APIs.

I am trying to create a Meraki group policy via API using Ansible.

When running the ansible-playbook, I get "New group policies must have a name" error message.

Name is added in the json files.

Can you please check the json and playbook files and help and sorting this issue.

Many Thanks.

 

Playbook.yml

- name: Group Policy via API
  hosts: localhost
  gather_facts: no
 
  
  tasks:
    - name: Deploy Group Policy
      uri:
        method: POST
        return_content: yes
        headers:
          X-Cisco-Meraki-API-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        body_format: json
        body: "{{ lookup('ansible.builtin.file','create_body_4.json') | to_json }}"
 
create_body.json
{
   "name": "test01"
}

 

 

I have also tried the RequestBody(JSON) from the Meraki example (https://developer.cisco.com/meraki/api-v1/#!create-network-group-policy) but still get the same error message. It seems like "create_body.json" file is not in correct format hence "name" is not parsed properly.

0 Replies 0
Get notified when there are additional replies to this discussion.