Reply

Create networks via WAPI with existing VLAN

Member
Posts: 2
503     0

Hello everybody!
I am currently in the process of automatically creating networks with Ansible via WAPI. I am having problems creating new networks with existing VLANs. I try to create the networks with templates.

My playbook:

- name: Management-Netz anlegen
      uri:
        url: "https://{{ nios_provider.host }}/wapi/{{ nios_provider.wapi_version }}/network"
        method: POST
        user: "{{ nios_provider.username }}"
        password: "{{ nios_provider.password }}"
        status_code: 201, 302, 200
        headers:
          Content-Type: "application/json"
        body:
          network: "func:nextavailablenetwork:{{ new_container_cidr }},default,24"
          vlans: [{"vlan":"vlan/ZG5zLnZsYW4kLmNvbS5pbmZvYmxveC5kbnMudmxhbl9yYW5nZSRkZWZhdWx0LjEuNDA5NC5WUE5fU3RhbmRvcnRlLjEwLjI1LjEw:default/VPN_Standorte/Management/10"}]
          template: "{{ mandant }}_Netz_Management"
          extattrs: 
            Bezeichnung: {"value": "{{ iso }} Management"}
            ISO_Nr: {"value": "{{ iso }}"}
        body_format: json
        validate_certs: no
        return_content: yes

 It all works fine, but the VLAN is not linked. I don't get an error message, so the syntax should be correct.

Re: Create networks via WAPI with existing VLAN

Adviser
Posts: 170
504     0

Hi,

 

Can you try running the following curl command to ensure it is working?

curl -k -u admin:infoblox -H 'content-type: application/json' -X POST "https://grid-master/wapi/v2.11/network?_return_fields%2B=vlans&_return_as_object=1" -d '{"network_view":"default","network":"61.0.0.0/24","vlans": [{"vlan":"vlan/ZG5zLnZsYW4kLmNvbS5pbmZvYmxveC5kbnMudmxhbl92aWV3JHRlc3QuMTAuMjAuMTA:test/next-vlan/10" }]}'

Regards,

Krishna

Re: Create networks via WAPI with existing VLAN

Member
Posts: 2
504     0

Hi Krishna,

The curl command works. The problem was that I couldn't add the VLAN in the same step when creating the network. I have now implemented a workaround in which I first create the network and then assign the VLAN in a second step. My playbook is now working as it should.

Regards,

Max

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin