community.network.cv_server_provision module – Provision server port by applying or removing template configuration to an Arista CloudVision Portal configlet that is applied to a switch.
Note
This module is part of the community.network collection (version 4.0.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.network
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.network.cv_server_provision
.
Synopsis
This module allows a server team to provision server network ports for new servers without having to access Arista CVP or asking the network team to do it for them. Provide the information for connecting to CVP, switch rack, port the new server is connected to, optional vlan, and an action and the module will apply the configuration to the switch port via CVP. Actions are add (applies template config to port), remove (defaults the interface config) and show (returns the current port config).
Requirements
The below requirements are needed on the host that executes this module.
Jinja2
cvprac >= 0.7.0
Parameters
Parameter |
Comments |
---|---|
The action for the module to take. The actions are add, which applies the specified template config to port, remove, which defaults the specified interface configuration, and show, which will return the current port configuration with no changes. Choices:
|
|
Flag that determines whether or not the module will execute the CVP task spawned as a result of changes to a switch configlet. When an add or remove action is taken which results in a change to a switch configlet, CVP will spawn a task that needs to be executed for the configuration to be applied to the switch. If this option is True then the module will determined the task number created by the configuration change, execute it and wait for the task to complete. If the option is False then the task will remain in the Pending state in CVP for a network administrator to review and execute. Choices:
|
|
The hostname or IP address of the CVP node being connected to. |
|
The password of the user that will be used to connect to CVP for API calls. |
|
The port number to use when making API calls to the CVP node. This will default to the default port for the specified protocol. Port 80 for http and port 443 for https. |
|
The vlan that should be applied to the port for this server. This parameter is dependent on a proper template that supports single vlan provisioning with it. If a port vlan is specified by the template specified does not support this the module will exit out with no changes. If a template is specified that requires a port vlan but no port vlan is specified the module will exit out with no changes. |
|
The protocol to use when making API calls to CVP. CVP defaults to https and newer versions of CVP no longer support http. Choices:
|
|
The hostname or identifier for the server that is having it’s switch port provisioned. |
|
The hostname of the switch is being configured for the server being provisioned. |
|
The physical port number on the switch that the new server is connected to. |
|
A path to a Jinja formatted template file that contains the configuration block that will be applied to the specified switch port. This template will have variable fields replaced by the module before being applied to the switch configuration. |
|
The user that will be used to connect to CVP for making API calls. |
Examples
- name: Get current configuration for interface Ethernet2
community.network.cv_server_provision:
host: cvp_node
username: cvp_user
password: cvp_pass
protocol: https
server_name: new_server
switch_name: eos_switch_1
switch_port: 2
template: template_file.j2
action: show
- name: Remove existing configuration from interface Ethernet2. Run task.
community.network.cv_server_provision:
host: cvp_node
username: cvp_user
password: cvp_pass
protocol: https
server_name: new_server
switch_name: eos_switch_1
switch_port: 2
template: template_file.j2
action: remove
auto_run: True
- name: Add template configuration to interface Ethernet2. No VLAN. Run task.
community.network.cv_server_provision:
host: cvp_node
username: cvp_user
password: cvp_pass
protocol: https
server_name: new_server
switch_name: eos_switch_1
switch_port: 2
template: single_attached_trunk.j2
action: add
auto_run: True
- name: Add template with VLAN configuration to interface Ethernet2. Run task.
community.network.cv_server_provision:
host: cvp_node
username: cvp_user
password: cvp_pass
protocol: https
server_name: new_server
switch_name: eos_switch_1
switch_port: 2
port_vlan: 22
template: single_attached_vlan.j2
action: add
auto_run: True
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Signifies if a change was made to the configlet Returned: success Sample: |
|
The current config block for the user specified interface Returned: when action = show Sample: |
|
The full config of the configlet after being updated Returned: when action = add or remove Sample: |
|
The new config block for the user specified interface Returned: when action = add or remove Sample: |
|
The current config block for the user specified interface before any changes are made Returned: when action = add or remove Sample: |
|
Signifies if the user specified port has an entry in the configlet that Ansible has access to Returned: success Sample: |
|
Signifies if the user specified switch has a configlet applied to it that CVP is allowed to edit Returned: success Sample: |
|
Information from CVP describing the switch being configured Returned: success Sample: |
|
Signifies if the task created and executed has completed successfully Returned: when action = add or remove, and auto_run = true, and configuration changes Sample: |
|
Signifies if a task was created due to configlet changes Returned: when action = add or remove, and auto_run = true or false, and configuration changes Sample: |
|
Signifies if the automation executed the spawned task Returned: when action = add or remove, and auto_run = true, and configuration changes Sample: |
|
The task ID created by CVP because of changes to configlet Returned: when action = add or remove, and auto_run = true or false, and configuration changes Sample: |
|
Response returned from CVP when configlet update is triggered Returned: when action = add or remove and configuration changes Sample: |