An Ansible Role for automating a Viptela Overlay Network. This is a hybrid role that provided both role tasks and modules.
This role can perform the following functions:
- Add Controllers
- Set Organization Name
- Set vBond
- Set Enterprise Root CA
- Get Controller CSR
- Install Controller Certificate
- Install Serial File
- Export Templates
- Import Templates
- Add/Change/Delete Templates
- Attach Templates
- Export Policy
- Import Policy
- Add/Change/Delete Policy
- Activate Policy
- Get Template facts
- Get Device facts
host
: IP address or FQDN of vManageuser
: Username used to log in to vManagepassword
: Password used to log into vManage
- name: vManage Settings
vmanage_settings:
host: "{{ vmanage_ip }}"
user: "{{ vmanage_user }}"
password: "{{ vmanage_password }}"
organization: "{{ organization_name }}"
vbond: 1.2.3.4
ca_type: enterprise
root_cert: "{{lookup('file', '{{ viptela_cert_dir }}/myCA.pem')}}"
organization
: Organization namevbond
: vBondvbond_port
: vBond portca_type
: CA typeroot_cert
: CA root certificate
- vmanage_device:
host: "{{ vmanage_ip }}"
user: "{{ vmanage_user }}"
password: "{{ vmanage_pass }}"
device_username: admin
device_password: admin
name: "{{ item }}"
personality: "{{ hostvars[item].viptela.personality }}"
system_ip: "{{ hostvars[item].viptela.transport_ip }}"
device_username
: Username of the device being addeddevice_password
: Password of the user specifiedname
: Name of the device being addedsystem_ip
: The System IP of the devicepersonality
: Personality of the devicestate
:present
orabsent
(default:present
)
- name: vmanage_device_certificate:
host: "{{ vmanage_ip }}"
user: "{{ vmanage_user }}"
password: "{{ vmanage_pass }}"
name: "{{ item }}"
system_ip: "{{ hostvars[item].viptela.transport_ip }}"
state: csr
register: control_devices
name
: Name of the device being added (required forpresent
andcsr
)system_ip
: The System IP of the devicecert
: The certificate to install when state ispresent
state
:present
: Add certificate vmanagecsr
: Generate CSR (CSR passed in results)push
: Push certificates to controllers
- vmanage_device_bootstrap:
host: "{{ vmanage_ip }}"
user: "{{ vmanage_user }}"
password: "{{ vmanage_pass }}"
uuid: "{{ viptela.uuid }}"
register: result
uuid
: UUID of the device
- vmanage_device_template_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
factory_default: no
Retrieves device template facts from vManange
factory_default
: Include factory default templates
device_templates
: The device templates defined in vManageattached_devices
: The devices current attached to the templateinput
: Variables required by template
- vmanage_feature_template_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
factory_default: no
Retrieves feature template facts from vManange
factory_default
: Include factory default templates
feature_templates
: The feature templates defined in vManage
- vmanage_feature_template:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
state: present
aggregate: "{{ vmanage_templates.feature_templates }}"
Create or delete a feature template
name
: Name of the feature templatedescription
: Description of the feature templatedefinition
: Feature template definitiontype
: Type of feature temaplatedevice_type
: Device type to which the the template can be appliedtemplate_min_version
: Minimum version of vManage required for templatefactory_default
: Factory default templateaggregate
: A list of items composed of the arguments above
- vmanage_device_template:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
state: present
aggregate: "{{ vmanage_templates.device_templates }}"
Create or delete a device template
name
: Name of the device templatedescription
: Description of the device templatetemplates
: Feature templates includes in the device templateconfig_type
: Template type:template
orcli
device_type
: Device type to which the the template can be appliedtemplate_min_version
: Minimum version of vManage required for templatefactory_default
: Factory default templateaggregate
: A list of items composed of the arguments above
- vmanage_device_attachment:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
device: site1-vedge1
template: colo_vedge
variables:
vpn11_ipv4_address: 172.22.2.1/24
vpn10_ipv4_address: 172.22.1.1/24
vpn0_internet_ipv4_address: 172.16.22.2/24
vpn0_default_gateway: 172.16.22.1
wait: yes
state: "{{ state }}"
Attach/Detach template to/from device
state
: The state of the attachment:absent
orpresent
device
: The name of the device to whichtemplate
: The name of the template to applyvariables
: The variable required by the template. (See vmanage_device_template_facts for required variables)wait
: Wait for the application of the template to succeed or fail.
- vmanage_policy_list:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
name: blocked_prefixes
description: Blocked Prefixes
type: dataPrefix
entries:
- ipPrefix: 10.0.1.0/24
- ipPrefix: 10.0.2.0/24
- ipPrefix: 10.0.3.0/24
state: present
aggregate: "{{ item.value }}"
name
: Policy List namedescription
: Policy List descriptiontype
: Policy List typeentries
: The list entries appropriate to the typestate
: absent or presentaggregate
: A list of items composed of the arguments above
- vmanage_policy_list_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: policy_list_facts
Retrieve policy list facts
policy_lists
: The policy lists currently defined in vManage
- vmanage_policy_definition:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
type: "{{ item.key }}"
state: present
aggregate: "{{ item.value }}"
state
: absent or presentname
: Policy List namedescription
: Policy List descriptiontype
: Policy List type (cflowd
,dnssecurity
,control
,hubandspoke
,acl
,vpnmembershipgroup
,mesh
,rewriterule
,data
,rewriterule
,aclv6
)sequences
: Policy definition sequencesdefault_action
: Default policy action (e.g.drop
)aggregate
: A list of items composed of the arguments above
- vmanage_policy_definition_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: policy_definition_facts
Retrieve policy definition facts
policy_definitions
: The policy definitions currently defined in vManage
- vmanage_central_policy:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
state: present
aggregate: "{{ vmanage_policy.vmanage_central_policies }}"
- vmanage_central_policy:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
state: activated
name: central_policy
wait: yes
register: policy_facts
state
: State (absent
,present
,activated
,deactivated
)
Note:
activated
,deactivated
must be separate invocations of the module
name
: Central Policy namedescription
: Central Policy descriptiontype
: Policy typedefinition
: Policy definitionwait
: Wait for the application of the template to succeed or fail.
- vmanage_central_policy_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: central_policy_facts
Retrieve policy definition facts
policy_definitions
: The policy definitions currently defined in vManage
- vmanage_device_action_status:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
id: "{{ attachment_results.action_id }}"
Retrieve status of device action
- vmanage_device_facts:
user: "{{ ansible_user }}"
host: "{{ ansible_host }}"
password: "{{ ansible_password }}"
Retrieve device facts
- vmanage_fileupload:
host: "{{ vmanage_ip }}"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
file: 'licenses/serialFile.viptela'
file
: name of the serial file
- vmanage_nping:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
dst_ip: 1.2.3.4
vedge: site1-vedge1
vpn: 10
vedge
: Name of the vedge from which to pingdst_ip
: The IP to pingvpn
: The VPN number in which to pingsrc_interface
: The source interface on the vedge from which to pingcount
: The number of packets to sendrapid
: Whether to do a rapid ping
CISCO SAMPLE CODE LICENSE