- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Create networks via WAPI with existing VLAN
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2021 12:58 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2021 11:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2021 11:52 PM
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
Re: Create networks via WAPI with existing VLAN
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2021 02:53 AM
I have the same issue. It works when I remove the network template part.
Then I'm able to create a network with the functions nextavailablenetwork and nextavailablevlan.
When I add a network template, the VLAN reservation is not made.
Re: Create networks via WAPI with existing VLAN
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2021 05:39 AM
Yeah, I guess that's why it doesn't work. You can't do both in one step. When working with a network template, you first have to create the network and then assign the VLAN.
Re: Create networks via WAPI with existing VLAN
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 05:13 PM
Hi guys,
I am new to Infoblox and just started our journey to use Ansible playbooks for bulk schema uploading into Infobox. So far, the provided modules are working well however I don't see any pre-built ansible module to do the VLAN-related activities i.e. Creating VLAN View, VLAN Ranges and assigning a VLAN with a Network.
I understand it can be done via the API call (using URI module). Hence my query, is there any guide I can follow to do the assignment of VLAN-Subnet via Ansible? If someone can kindly point me in the right direction, that will be very helpful.
Re: Create networks via WAPI with existing VLAN
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:41 AM
Same issue.
I can, unfortunately, confirm the behaviour using WAPI 1.13.1
When using a network template, 201 is returned with the _ref of the new object, but the preexisting VLAN is not assigned.
URI: /wapi/v2.13.1/network? [POST]
Body:
{
"network": "<CIDR>",
"network_view":"Internal",
"comment": "Some comment",
"template": "Some vlan template name",
"extattrs": {
"attrib1": {"value": "01234"},
"attrib2": {"value": "43210"}
},
"vlans": [
{"vlan": "<VLAN/_RefID>"}
]
}