Skip to main content

Ansible Modules: tacp_network

The tacp_network module creates or deletes VLAN or VNET networks and provides NFV details and static DHCP bindings to VNETs.

The tacp_network module provides the following tasks:
  • Create VLAN or VNET networks

  • Delete VLAN or VNET networks

  • Configure NFV details for VNETs

  • Assign DHCP static bindings for VNETs

For an overview of networks in ThinkAgile CP, see the following topic:

Networking Concepts

Sample Playbooks

Note
  • For more information about the parameters used with the tacp_network module, run the following command:

    ansible-doc -t module tacp_network
  • For more information about obtaining the API key, which is used to access the ThinkAgile CP Cloud Controller, see the following topic:

    Authorize Token

Create a VLAN

The following is an Ansible playbook in .yml format that creates a VLAN on the ThinkAgile CP stack:

---
- name: Create a VLAN on ThinkAgile CP
hosts: localhost
gather_facts: false
vars:
api_key: <api-key-created-from-the-developer-options-page>
tasks:
- name: Create a VLAN on ThinkAgile CP
tacp_network:
api_key: "{{ api_key }}"
name: <unique-vlan-name>
state: present
network_type: VLAN
vlan_tag: <unique-vlan-tag>

Delete a VLAN

The following Ansible playbook deletes a VLAN:

---
- name: Delete a VLAN network on ThinkAgile CP
hosts: localhost
gather_facts: false
vars:
api_key: <api-key-created-from-the-developer-options-page>
tasks:
- name: Delete a VLAN network on ThinkAgile CP
tacp_network:
api_key: "{{ api_key }}"
name: <name-of-existing-vlan-name>
state: absent
network_type: VLAN

Create a VNET with NFV

The following Ansible playbook creates a VNET with network function virtualization (NFV):

---
- name: Create a VNET network with NFV on ThinkAgile CP
hosts: localhost
gather_facts: false
vars:
api_key: <api-key-created-from-the-developer-options-page>
tasks:
- name: Create a VNET network with NFV on ThinkAgile CP
tacp_network:
api_key: "{{ api_key }}"
name: <unique-VNET-name>
state: present
network_type: VNET
autodeploy_nfv: True
network_address: <IP-address>
subnet_mask: <subnet-mask>
gateway: <gateway-IP-address>
dhcp:
dhcp_start: <starting-DHCP-address>
dhcp_end: <ending-DHCP-address>
domain_name: <domain-name>
lease_time: 86400
dns1: 1.1.1.1
dns2: 8.8.8.8
static_bindings:
- hostname: <host-name>
ip_address: <IP-address-of-host>
mac_address: <MAC-address-of-host>
- hostname: <host-name>
ip_address: <IP-address-of-host>
mac_address: <MAC-address-of-host>
routing:
type: VLAN
network: <network-name>
address_mode: static
ip_address: <IP-address>
subnet_mask: <subnet-mask>
gateway: <gateway-IP-address>
nfv:
datacenter: <VDC-name>
storage_pool: <storage-pool-name>
migration_zone: <migration-zone-name>
cpu_cores: 1
memory: 1G
auto_recovery: True