### Manage VSX Configuration with AOSCX Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_vsx.md These examples demonstrate how to use the `aoscx_vsx` Ansible module to manage Virtual Switching Extension (VSX) configurations. The module allows for creating, updating, and deleting VSX configurations, with options to specify device roles, ISL ports, keepalive settings, and software update parameters. Ensure the AOSCX Ansible collection is installed and the target devices are accessible. ```YAML - name: Delete VSX configuration aoscx_vsx: state: delete ``` ```YAML - name: Update VSX configuration for primary device, set ISL port aoscx_vsx: device_role: primary isl_port: 1/1/1 state: update ``` ```YAML - name: > Create simple VSX configuration with lag as ISL port for secondary device aoscx_vsx: device_role: primary isl_port: lag1 keepalive_vrf: red state: create ``` ```YAML - name: > Create detailed VSX configuration for primary device, use USB for software update, instead of TFTP server aoscx_vsx: config_sync_disable: false config_sync_features: - aaa - bgp - dns - vrrp device_role: primary isl_port: 1/1/8 isl_timers: timeout: 20 peer_detect_interval: 100 hold_time: 3 hello_interval: 5 keepalive_peer_ip: 10.0.0.2 keepalive_src_ip: 10.0.0.1 keepalive_timers: hello_interval: 5 dead_interval: 20 keepalive_udp_port: 7678 keepalive_vrf: default linkup_delay_timer: 90 software_update_abort_request: 7 software_update_schedule_time: 1635356306 software_update_url: usb://boot_bank=primary software_update_vrf: default split_recovery_disable: false system_mac: 00:FF:11:EE:22:DD ``` -------------------------------- ### Configure Interface with VSX Sync (YAML) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l3_interface.md This example configures a Layer 2 interface (1/1/3) on an AOS-CX device, enabling it and synchronizing specific features (ACL, IRDP, QoS, rate_limits, VLAN, vsx_virtual) with VSX peers. It utilizes the `aoscx_interface` Ansible module. Ensure the `aoscx_interface` module is installed and available. ```YAML - name: > Configure Interface 1/1/3 - enable interface and vsx-sync features IMPORTANT NOTE: the aoscx_interface module is needed to enable the interface and set the VSX features to be synced. aoscx_interface: name: 1/1/3 enabled: true vsx_sync: - acl - irdp - qos - rate_limits - vlan - vsx_virtual ``` -------------------------------- ### aoscx_command Module Documentation Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md Details on the aoscx_command module, including its purpose, arguments, and usage examples. ```APIDOC ## aoscx_command Module ### Description This module allows execution of CLI commands on AOS-CX devices via SSH connection. It can execute configuration commands but is not the primary module for that purpose (use `aoscx_config` for configuration-only tasks). **Important Notes:** * Does not handle commands that repeat indefinitely (e.g., `repeat`). * Cannot process commands requiring user input beyond simple "yes/no" prompts (e.g., password entry). * For "yes/no" confirmations, prepend the task with `auto-confirm`. * `auto-confirm` does not support copying AOS-CX images with TFTP. ### Method Not applicable (This is a module description, not an API endpoint). ### Endpoint Not applicable. ### Parameters #### Arguments * **commands** (list) - Required - List of commands to be executed in sequence on the switch. Commands are executed regardless of prior success or failure. Include `configure terminal` or variations to enter configuration mode before configuration commands. 'Show' commands are supported and their output can be printed, returned, or saved. Default module timeout is 30 seconds; adjustable via `ansible_command_timeout`. * **wait_for** (list of strings) - Optional - A list of conditions to wait for before proceeding. Each condition checks the `result` variable, which is a list containing the output of each command in the `commands` list (`result[0]` for `commands[0]`, etc.). * **match** (str) - Optional - Specifies if all (`all`) or any (`any`) conditions in `wait_for` must be met. Defaults to `all`. * **retries** (int) - Optional - Maximum number of retries to check for the expected prompt. Defaults to 10. * **interval** (int) - Optional - Interval in seconds between retries. Defaults to 1. * **output_file** (str) - Optional - Full path to a local file where command results will be saved. The directory must exist; the file will be created if it doesn't exist. * **output_file_format** (str) - Optional - Format for `output_file`. Can be `json` or `plain-text`. Defaults to `json`. ### Request Example ```yaml - name: VSF Renumber-To with Autoconfirm aoscx_command: lines: # Note: The provided documentation uses 'lines' in the example, but 'commands' in the ARGUMENTS section. Assuming 'commands' is the correct argument name based on ARGUMENTS. - auto-confirm - configure - vsf renumber-to 2 ``` ### Response #### Success Response (200) - **result** (list of strings) - Output of the executed commands. #### Response Example ```json { "result": [ "Command output line 1\nCommand output line 2", "Another command output" ] } ``` ## Examples ### Example 1: Execute show and configure commands, output to plaintext file ```yaml - name: > Execute show commands and configure commands, and output results to file in plaintext. aoscx_command: commands: - show run - show vsf - show interface 1/1/1 - config - interface 1/1/2 - no shut - ip address 10.10.10.10/24 - routing - ip address 10.10.10.11/24 - exit - vlan 2 - end output_file: /users/Home/configure.cfg output_file_format: plain-text ``` ### Example 2: Wait for specific conditions in command output ```yaml - name: > Show running-config and show interface mgmt, and pass only if all (both) results match. aoscx_command: commands: - show run - show int mgmt wait_for: - result[0] contains "vlan " - result[1] contains "127.0.0.1" match: all retries: 5 interval: 5 ``` ### Example 3: Show all available commands and output to JSON file ```yaml - name: Show all available commands and output them to a file (as JSON) aoscx_command: commands: - list output_file: /users/Home/config_list.cfg ``` ### Example 4: Run ping command with increased command timeout ```yaml - name: Run ping command with increased command timeout vars: - ansible_command_timeout: 60 aoscx_command: commands: - ping 10.80.2.120 vrf mgmt repetitions 100 ``` ``` -------------------------------- ### Create MCLAG Interface with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates the creation of a Multi-Chassis LAG (MCLAG) interface. It requires setting `multi_chassis` to `true` and can include specific interfaces. ```YAML - name: Create MCLAG Interface 64 with 3 interfaces. aoscx_lag_interface: state: create name: lag64 interfaces: - 1/1/1 - 1/1/2 - 1/1/3 multi_chassis: true ``` -------------------------------- ### Create OSPF Router with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospf.md This example demonstrates how to create a new OSPF router configuration using the `aoscx_ospf_router` module. It requires specifying the VRF and OSPF instance tag. No external dependencies are needed for this basic operation. ```YAML - name: Create new OSPF Router aoscx_ospf_router: vrf: default instance_tag: 1 ``` -------------------------------- ### Create Static MCLAG Interface with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example shows how to create a static MCLAG interface. It requires setting `multi_chassis` and `static_multi_chassis` to `true`. ```YAML - name: Create Static MCLAG Interface 32 with 3 interfaces. aoscx_lag_interface: state: create name: lag32 interfaces: - 1/1/1 - 1/1/2 - 1/1/3 multi_chassis: true static_multi_chassis: true ``` -------------------------------- ### Configure Quality of Service Profiles and Queues Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md An example demonstrating the configuration of Quality of Service profiles and queues using Ansible modules. It includes creating schedule profiles, setting up queues with specific bandwidth and burst settings, and deleting queues. ```YAML - name: Create Schedule Profile named 'High-Traffic' aoscx_qos: name: High-Traffic state: create vsx_sync: - all_attributes_and_dependents - name: Create Queue 5 for 'High-Traffic' Schedule Profile aoscx_queue: qos_name: High-Traffic queue: 5 state: create algorithm: dwrr bandwidth: 1024 burst: 1024 weight: 127 gmb_percent: 89 - name: Remove the Guaranteed Minimum Bandwidth from queue 4 aoscx_queue: qos_name: High-Traffic queue_number: 4 no_gmb_percent: true - name: Set a Guaranteed Minimum Bandwidth of 45% for queue 2 aoscx_queue: qos_name: High-Traffic queue_number: 2 gmb_percent: 45 algorithm: min-bandwidth - name: Delete Queue 3 for 'High-Traffic' Schedule Profile aoscx_queue: qos_name: High-Traffic queue_number: 3 state: delete ``` -------------------------------- ### Install AOSCX Ansible Collection Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/README.md Installs the Aruba Networks AOS-CX Ansible collection using the ansible-galaxy command-line tool. This is the primary method for obtaining the collection and its modules. ```bash ansible-galaxy collection install arubanetworks.aoscx ``` -------------------------------- ### Manage Schedule Profiles with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md This set of Ansible tasks illustrates how to create, delete, and globally set schedule profiles using the `aoscx_qos` and `aoscx_system` modules. It includes examples for creating a profile, assigning it globally, and reverting to the default. ```YAML - name: Create Schedule Profile 'MEDIUM-TRAFFIC' aoscx_qos: name: MEDIUM-TRAFFIC state: create - name: Set Schedule Profile 'MEDIUM-TRAFFIC' as global aoscx_system: global_schedule_profile: MEDIUM-TRAFFIC - name: Delete 'MEDIUM-TRAFFIC' Schedule Profile aoscx_qos: name: MEDIUM-TRAFFIC state: delete - name: Use default global Schedule Profile aoscx_system: use_default_global_schedule_profile: true - name: Delete 'MEDIUM-TRAFFIC' Schedule Profile aoscx_qos: name: MEDIUM-TRAFFIC state: delete - name: Create Schedule Profile 'MEDIUM-TRAFFIC2' aoscx_qos: name: MEDIUM-TRAFFIC2 state: create - name: Set global Schedule Profile aoscx_system: global_schedule_profile: MEDIUM-TRAFFIC2 - name: Use the default global Schedule Profile aoscx_system: use_default_global_schedule_profile: true ``` -------------------------------- ### Create Static MCLAG with LACP Fallback using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates creating a static MCLAG interface with LACP fallback enabled. It requires setting `multi_chassis`, `static_multi_chassis`, and `lacp_fallback` to `true`. ```YAML - name: Create static MCLAG with LACP fallback mode. aoscx_lag_interface: state: create name: lag2 multi_chassis: true static_multi_chassis: true lacp_fallback: true ``` -------------------------------- ### Create LAG Interface with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates how to create a basic LAG interface using the `aoscx_lag_interface` module in Ansible. It requires specifying the LAG interface name. ```YAML - name: Create LAG Interface 1. aoscx_lag_interface: name: lag1 ``` -------------------------------- ### Create MCLAG with LACP Fallback Enabled using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates creating an MCLAG interface with the LACP fallback mode enabled. It sets `multi_chassis` to `true` and `lacp_fallback` to `true`. ```YAML - name: Create MCLAG with LACP fallback mode set. aoscx_lag_interface: state: create name: lag256 multi_chassis: true lacp_fallback: true ``` -------------------------------- ### Install pycurl (Red Hat/CentOS/Fedora) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/README.md Installs the pycurl Python library on Red Hat-based systems by first installing system dependencies like curl, openssl, and related development headers. ```bash yum install curl openssl openssl-devel libcurl libcurl-devel python3-devel ``` ```bash python3 -m pip install pycurl ``` -------------------------------- ### Install pycurl (Debian/Ubuntu) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/README.md Installs the pycurl Python library on Debian-based systems by first installing system dependencies like curl, openssl, and related development headers. ```bash apt-get install curl openssl libcurl4-openssl-dev libssl-dev python3-dev ``` ```bash python3 -m pip install pycurl ``` -------------------------------- ### Install Python Requirements Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/README.md Installs all Python package dependencies required by the AOS-CX Ansible collection, as listed in the 'requirements.txt' file. This is crucial for the collection's modules to function correctly. ```bash python3 -m pip install -r requirements.txt ``` -------------------------------- ### Install Ansible Collection Requirements Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/README.md Installs all Ansible dependencies defined in the 'requirements.yml' file for the AOS-CX collection. This ensures that all necessary collections and roles are present. ```bash ansible-galaxy install -r requirements.yml ``` -------------------------------- ### Create OSPFv3 Virtual Link using aoscx_ospfv3_vlink Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospfv3.md This example demonstrates creating a new OSPFv3 virtual link. It requires the VRF, OSPF ID, area ID, and the peer router ID. The default state is 'present'. ```YAML - name: Create new OSPFv3 Vlink aoscx_ospfv3_vlink: vrf: default ospf_id: 1 area_id: 1.1.1.1 peer_router_id: 0.0.0.1 ``` -------------------------------- ### Update OSPFv3 Router with Redistribution using aoscx_ospfv3_router Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospfv3.md This example shows how to update an existing OSPFv3 router to include BGP and static routes for redistribution. The 'state' is set to 'update' and the 'redistribute' list is populated. ```YAML - name: > Create new OSPFv3 Router, with bgp, and static as OSPF redistribution methods. aoscx_ospfv3_router: state: update vrf: default instance_tag: 1 redistribute: - bgp - static ``` -------------------------------- ### Execute Commands and Save to Plaintext File Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md This example demonstrates executing a series of show and configuration commands on an AOS-CX device and saving the combined output to a specified file in plain text format. It requires the 'commands' argument as a list of strings and the 'output_file' and 'output_file_format' arguments to specify the destination and format. ```YAML - name: > Execute show commands and configure commands, and output results to file in plaintext. aoscx_command: commands: - show run - show vsf - show interface 1/1/1 - config - interface 1/1/2 - no shut - ip address 10.10.10.10/24 - routing - ip address 10.10.10.11/24 - exit - vlan 2 - end output_file: /users/Home/configure.cfg output_file_format: plain-text ``` -------------------------------- ### Enable Sticky Learning for Port Security on AOS-CX Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l2_interface.md This example shows how to enable sticky learning for port security on an interface. Sticky learning allows the interface to learn and dynamically add MAC addresses. Requires port security to be enabled. ```YAML - name: Configure Interface 1/1/13 - enable sticky learning aoscx_l2_interface: interface: 1/1/13 port_security_enable: true port_security_sticky_learning: true ``` -------------------------------- ### Add Interfaces to LAG with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example shows how to add multiple physical interfaces to an existing LAG interface. The `state` is set to `update`, and the `interfaces` parameter takes a list of interface identifiers. ```YAML - name: Set 6 interfaces to LAG Interface 1. aoscx_lag_interface: state: update name: lag1 interfaces: - 1/1/1 - 1/1/2 - 1/1/3 - 1/1/4 - 1/1/5 - 1/1/6 ``` -------------------------------- ### Configure LACP Mode on LAG with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates how to configure LACP (Link Aggregation Control Protocol) settings for a LAG interface. It includes setting the `lacp_mode` to `passive` and `lacp_rate` to `fast`. ```YAML - name: Configure LAG1 as dynamic. aoscx_lag_interface: state: update name: lag1 lacp_mode: passive lacp_rate: fast ``` -------------------------------- ### Create OSPF Area with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospf.md This example shows how to create a new OSPF area using the `aoscx_ospf_area` module. It requires specifying the VRF, OSPF instance ID, and the area ID for the new area. This is a fundamental step in OSPF network configuration. ```YAML - name: Create new OSPF Area aoscx_ospf_area: vrf: default ospf_id: 1 area_id: 1 ``` -------------------------------- ### Configure QoS Rate Limiting Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l2_interface.md This example shows how to configure rate limiting for different traffic types (unknown unicast, broadcast, multicast) on an interface. The `interface_qos_rate` parameter is a dictionary where keys represent traffic types and values are the rate limits. ```YAML interface_qos_rate: unknown-unicast: "10000" broadcast: "5000" multicast: "20000" ``` -------------------------------- ### Override OSPFv3 Router Redistribution using aoscx_ospfv3_router Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospfv3.md This example demonstrates overriding the redistribution list for an OSPFv3 router to include only 'connected' and 'static'. It uses 'state: override' to replace the existing list. ```YAML - name: > Update OSPFv3 Router, set redistribute to connected, and static only. This deletes bgp from the list. aoscx_ospfv3_router: state: override vrf: default instance_tag: 1 redistribute: - connected - static ``` -------------------------------- ### Configure IPv6 Static Route with VRF default - Forwarding Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_static_route.md This example shows how to configure an IPv6 static route on the default VRF. It focuses on setting the destination prefix and next-hop IP address for forwarding. ```YAML - name: Create IPv6 Static Route with VRF default - Forwarding aoscx_static_route: destination_address_prefix: 3000:300::2/64 type: forward next_hop_ip_address: 1000:100::2 ``` -------------------------------- ### Delete OSPFv3 Router using aoscx_ospfv3_router Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospfv3.md This example demonstrates how to delete an OSPFv3 router configuration. It requires the VRF and instance tag, with the 'state' parameter explicitly set to 'delete'. ```YAML - name: Delete OSPFv3 Router aoscx_ospfv3_router: vrf: default instance_tag: 1 state: delete ``` -------------------------------- ### Configure OSPF Router Redistribution and Passive Interfaces with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospf.md This example shows how to update an existing OSPF router configuration to include redistribution from BGP and static, and to configure passive interfaces. It uses the `aoscx_ospf_router` module with the `update` state. Ensure the VRF and instance tag are correctly specified. ```YAML - name: > Create new OSPF Router, with bgp, and static as OSPF redistribution methods. Also set passive interfaces. aoscx_ospf_router: state: update vrf: default instance_tag: 1 redistribute: - bgp - static passive_interface_default: false passive_interfaces: - 1/1/5 - 1/1/6 ``` -------------------------------- ### Ansible: Retrieve Specific Facts with aoscx_facts Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_facts.md Demonstrates how to use the aoscx_facts module to collect specific subsets of information from an AOS-CX device. This example retrieves 'power_supplies' and 'domain_name' facts. ```yaml - name: Retrieve power supply and domain name info from the device aoscx_facts: gather_subset: - power_supplies - domain_name ``` -------------------------------- ### Configure Static Route with VRF - Blackhole Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_static_route.md This example illustrates the creation of a blackhole static route for a given destination prefix within a specified VRF. Blackhole routes silently discard traffic destined for the specified prefix. ```YAML - name: Create Static Route with VRF - Blackhole aoscx_static_route: vrf_name: vrf3 destination_address_prefix: '2.1.1.0/24' type: blackhole ``` -------------------------------- ### Enable OSPFv2 Authentication with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospf_interface.md This example configures OSPFv2 authentication using SHA1 keys. It specifies the VRF, OSPF ID, Area ID, interface name, authentication type, and a list of authentication keys with their IDs. ```YAML - name: Enable OSPF authentication aoscx_ospf_interface: vrf: default version: v2 ospf_id: 5 area_id: 1.1.1.1 interface_name: 1/1/4 ospfv2_auth_type: sha1 ospfv2_auth_sha_keys: - id: 1 key: sha_key_1 - id: 2 key: sha_key_2 ``` -------------------------------- ### Configure MAC ACL using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_acl.md This example shows how to configure a MAC-based Access Control List (ACL) using the `aoscx_acl` module. It permits traffic based on source and destination MAC addresses. ```YAML - name: Configure MAC ACL aoscx_acl: name: test_mac type: mac acl_entries: 1: action: permit src_mac: 00-CA-FE-CA-FE-01 dst_mac: 00:AC:DC:AC:DC:02 ``` -------------------------------- ### Create IP Helper Address (YAML) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l3_interface.md This example configures an IP helper address (172.1.2.32) on a Layer 3 interface (1/1/3). The `aoscx_l3_interface` module is used, specifying the interface and the `ip_helper_address` parameter. This is useful for forwarding DHCP requests. ```YAML - name: Create IP Helper Address on Interface 1/1/3 aoscx_l3_interface: interface: 1/1/3 ip_helper_address: - 172.1.2.32 ``` -------------------------------- ### Configure Static Route with VRF - Reject Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_static_route.md This example demonstrates how to configure a reject static route. When a reject route is used, packets matching the destination prefix are discarded, and an ICMP unreachable message is sent to the sender. ```YAML - name: Create Static Route with VRF - Reject aoscx_static_route: vrf_name: vrf4 destination_address_prefix: '3.1.1.0/24' type: reject ``` -------------------------------- ### Create L3 Interface with IPv4/IPv6 on VRF (YAML) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l3_interface.md This example creates a Layer 3 interface (1/1/3) and assigns both IPv4 and IPv6 addresses to it within the 'red' VRF. It also sets a description for the interface. The `aoscx_l3_interface` module is used for this configuration. Ensure the interface is enabled prior to this step. ```YAML - name: > Creating new L3 interface 1/1/3 with IPv4 and IPv6 address on VRF red IMPORTANT NOTE: see the above task, it is needed to enable the interface aoscx_l3_interface: interface: 1/1/3 description: Uplink Interface ipv4: - 10.20.1.3/24 ipv6: - 2000:db8::1234/64 vrf: red ``` -------------------------------- ### Execute VSF Renumber Command with Auto-Confirmation Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md This example demonstrates how to execute a VSF renumber command that requires confirmation. By including 'auto-confirm' as the first command in the 'lines' list, the module can automatically confirm the prompt, preventing the task from hanging. This is useful for configuration changes that require user acknowledgment. ```YAML - hosts: all roles: - role: aoscx-ansible-role tasks: - name: VSF Renumber-To with Autoconfirm aoscx_command: lines: - auto-confirm - configure - vsf renumber-to 2 ``` -------------------------------- ### Configure IPv4 Static Route with VRF - Forwarding Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_static_route.md This example demonstrates how to create an IPv4 static route within a specified VRF using the aoscx_static_route module. It requires the destination prefix, and optionally accepts VRF name, route type, distance, and next-hop details. ```YAML - name: Create IPv4 Static Route with VRF - Forwarding aoscx_static_route: vrf_name: vrf2 destination_address_prefix: '1.1.1.0/24' type: forward distance: 1 next_hop_interface: '1/1/2' next_hop_ip_address: '2.2.2.2' ``` -------------------------------- ### Ansible: Retrieve All Facts with aoscx_facts Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_facts.md An example of using the aoscx_facts module to gather all available facts from an Aruba AOS-CX device. The retrieved information is registered into a variable named 'facts_output' for later use in the playbook. ```yaml - name: > Retrieve all information from the device and save into a variable "facts_output". aoscx_facts: register: facts_output ``` -------------------------------- ### Apply IPv4 ACL ROUTED-IN to VLAN using aoscx_vlan_interface (New Method) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_acl_vlan.md This example utilizes the `aoscx_vlan_interface` module to apply an IPv4 ACL in the 'routed-in' direction to VLAN interfaces. It loops through a list of VLAN IDs to configure the ACL. ```YAML - name: Apply ipv4 ACL ROUTED-IN to VLAN (new method) aoscx_vlan_interface: vlan_id: {{item}} acl_name: ipv4_acl acl_type: ipv4 acl_direction: routed-in loop: [2, 4] ``` -------------------------------- ### Configure multi-line banner using AOS-CX Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_config.md This module configures a multi-line banner message on an AOS-CX device. It employs the 'aoscx_config' module, specifying the banner content through 'lines' and defining the start and end delimiters with 'before' and 'after'. ```YAML - name: Configure a multi-line banner aoscx_config: lines: - hello this is a banner_motd - this is banner line 2 banner_motd - this is banner line 3 banner_motd before: "banner motd `" after: "`" ``` -------------------------------- ### Set Interface QoS Rate Limits Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l3_interface.md This example shows how to configure rate limiting for broadcast, multicast, and unknown unicast traffic on a Layer 3 interface using Ansible. The `interface_qos_rate` parameter accepts a dictionary specifying the traffic type and its corresponding speed limit. ```yaml --- - name: Configure Layer 3 Interface QoS hosts: all gather_facts: false tasks: - name: Set interface QoS rate limits aoscx_interface_layer3: interface: "1/1/2" interface_qos_rate: unknown_unicast: "100pps" broadcast: "200pps" multicast: "200pps" state: "update" ``` -------------------------------- ### Create OSPFv3 Router using aoscx_ospfv3_router Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospfv3.md This snippet demonstrates how to create a new OSPFv3 router. It requires the VRF and instance tag. The 'state' parameter defaults to 'present' for creation. ```YAML - name: Create new OSPFv3 Router aoscx_ospfv3_router: vrf: default instance_tag: 1 ``` -------------------------------- ### Execute Commands and Wait for Specific Output Conditions Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md This snippet shows how to execute show commands and then wait for specific conditions to be met in their output before proceeding. It utilizes the 'commands', 'wait_for', and 'match' arguments to define the commands to run, the conditions to check, and whether all or any condition must be satisfied. 'retries' and 'interval' can be set to control the waiting mechanism. ```YAML - name: > Show running-config and show interface mgmt, and pass only if all (both) results match. aoscx_command: commands: - show run - show int mgmt wait_for: - result[0] contains "vlan " - result[1] contains "127.0.0.1" match: all retries: 5 interval: 5 ``` -------------------------------- ### List Available Commands and Save to JSON File Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md This example demonstrates executing the 'list' command to retrieve all available commands on the device and saving this list to a JSON file. It uses the 'commands' argument with the value 'list' and specifies the 'output_file' argument for the destination. The default 'output_file_format' is JSON, so it doesn't need to be explicitly set. ```YAML - name: Show all available commands and output them to a file (as JSON) aoscx_command: commands: - list output_file: /users/Home/config_list.cfg ``` -------------------------------- ### Create L3 Interface with Multiple IPv4 Addresses (YAML) Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l3_interface.md This example creates a Layer 3 interface (1/1/6) and assigns multiple IPv4 addresses to it within the default VRF. The `aoscx_l3_interface` module is used for this task. This configuration is applied to the default VRF unless specified otherwise. ```YAML - name: Creating new L3 interface 1/1/6 with IPv4 addresses on VRF default aoscx_l3_interface: interface: 1/1/6 ipv4: - 10.33.4.15/24 - 10.0.1.1/24 ``` -------------------------------- ### Delete LAG Interface with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example demonstrates how to delete a LAG interface using the `aoscx_lag_interface` module. It requires specifying the `state` as `delete` and the `name` of the LAG interface. ```YAML - name: Delete LAG Interface 128. aoscx_lag_interface: state: delete name: lag128 ``` -------------------------------- ### Delete Interfaces from LAG with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example shows how to remove physical interfaces from a LAG interface. The `state` is set to `delete`, and the `interfaces` parameter specifies the interfaces to be removed. ```YAML - name: Delete 3 interfaces from LAG Interface 1. aoscx_lag_interface: state: delete name: lag1 interfaces: - 1/1/1 - 1/1/2 - 1/1/3 ``` -------------------------------- ### aoscx_queue Module Documentation Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md This section details the parameters and functionality of the aoscx_queue Ansible module for managing QoS Queues. ```APIDOC ## aoscx_queue Module ### Description This module implements creation or deletion of Queues within Schedule Profiles for Aruba AOS CX devices. ### Method This module is typically used with the `ansible.builtin.community.general.aoscx_queue` module, which acts as an interface for device configuration. ### Endpoint N/A (Ansible module) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Module Parameters) - **qos_name** (str) - Required - Schedule Profile configuration name. - **queue_number** (int) - Required - Number to identify a Queue. - **weight** (int) - Optional - Weight value for a queue. Maximum number is hardware dependent. - **algorithm** (str) - Optional - Scheduling behavior of the queue. Choices: [`strict`, `dwrr`, `wfq`]. Defaults to `strict`. - **bandwidth** (int) - Optional - Bandwidth limit in kilobits per second to apply to egress traffic, if not specified, bandwidth is not limited per queue. - **burst** (int) - Optional - Burst size in kilobytes allowed per bandwidth-queue, if not specified the default 32KB will be applied. - **gmb_percent** (int) - Optional - The Guaranteed Minimum Bandwidth as a percentage of line rate between 0 and 100. Mutually exclusive with `no_gmb_percent`. - **no_gmb_percent** (bool) - Optional - Option to remove the Guaranteed Minimum Bandwidth. Mutually exclusive with `gmb_percent`. Defaults to `false`. ### Request Example ```yaml - name: Configure a QoS Queue community.general.aoscx_queue: qos_name: "Profile1" queue_number: 1 weight: 50 algorithm: "dwrr" bandwidth: 100000 burst: 64 gmb_percent: 20 ``` ### Response #### Success Response (200) Module operations typically return standard Ansible result facts, indicating success or failure of the configuration task. #### Response Example ```json { "changed": true, "msg": "QoS Queue configured successfully." } ``` ``` -------------------------------- ### Execute Ping Command with Increased Timeout Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_command.md This example shows how to execute a ping command with a specified number of repetitions and increase the overall command execution timeout using an Ansible variable. The 'commands' argument takes the ping command, and the 'ansible_command_timeout' variable is set in the 'vars' section to override the default timeout. ```YAML - name: Run ping command with increased command timeout vars: - ansible_command_timeout: 60 aoscx_command: commands: - ping 10.80.2.120 vrf mgmt repetitions 100 ``` -------------------------------- ### Manage Queue Profiles with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md These Ansible tasks demonstrate the creation, deletion, and global setting of queue profiles using the `aoscx_queue_profile` and `aoscx_system` modules. It covers creating a new profile, setting it as the global default, and deleting it. ```YAML - name: Create Queue Profile 'STRICT-PROFILE' aoscx_queue_profile: name: STRICT-PROFILE state: create - name: Set Queue Profile 'STRICT-PROFILE' as global aoscx_system: global_queue_profile: STRICT-PROFILE - name: Set default global Queue Profile aoscx_system: use_default_global_queue_profile: true - name: Delete 'STRICT-PROFILE' Queue Profile aoscx_queue_profile: name: STRICT-PROFILE state: delete - name: Create a new Queue Profile called STRICT-PROFILE2 aoscx_queue_profile: name: STRICT-PROFILE2 state: create - name: Set global Queue Profile aoscx_system: global_queue_profile: STRICT-PROFILE2 - name: Use the default global Queue Profile aoscx_system: use_default_global_queue_profile: true ``` -------------------------------- ### Boot AOS-CX Switch Firmware using aoscx_boot_firmware Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_boot_firmware.md This Ansible module boots an AOS-CX switch to a specified firmware partition. It requires the 'partition_name' argument, which can be either 'primary' or 'secondary'. The module is used within Ansible playbooks to manage switch firmware boot configurations. ```yaml - name: Boot to primary aoscx_boot_firmware: partition_name: 'primary' - name: Boot to secondary aoscx_boot_firmware: partition_name: 'secondary' ``` -------------------------------- ### Update MCLAG to Disable LACP Fallback using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example shows how to update an MCLAG interface to disable the LACP fallback mode. It sets `multi_chassis` to `true` and `lacp_fallback` to `false`. ```YAML - name: Update MCLAG, unset LACP fallback mode. aoscx_lag_interface: state: create name: lag256 multi_chassis: true lacp_fallback: false ``` -------------------------------- ### Update QoS Entries Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md Demonstrates updating Quality of Service (QoS) entries using Ansible modules, specifically for COS (Class of Service) and DSCP (Differentiated Services Code Point) configurations. This includes setting color and local priority. ```YAML - name: Update color and local priority for QoS COS with code point 5. aoscx_qos_cos: code_point: 5 color: yellow local_priority: 3 - name: Update color of QoS COS trust type map entry with code point 2 aoscx_qos_cos: code_point: 2 color: yellow - name: Update QoS DSCP trust type 5 aoscx_qos_dscp: code_point: 5 color: yellow local_priority: 3 ``` -------------------------------- ### Configure QoS on Interface 1/1/5 using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md This Ansible task configures QoS settings for a specific interface, including trust mode and queue profile. It requires the `aoscx_interface` module and specifies the interface name, QoS profile, trust mode (DSCP), and queue profile. ```YAML - name: Set Schedule Profile for 1/1/5 interface aoscx_interface: name: 1/1/5 qos: High-Traffic qos_trust_mode: dscp queue_profile: Strict-Profile ``` -------------------------------- ### Update Static MCLAG to Unset LACP Fallback using Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_lag_interface.md This example shows how to update a static MCLAG interface to unset the LACP fallback mode. It sets `multi_chassis`, `static_multi_chassis` to `true` and `lacp_fallback` to `false`. ```YAML - name: Update static MCLAG, unset LACP fallback mode. aoscx_lag_interface: state: update name: lag256 multi_chassis: true static_multi_chassis: true lacp_fallback: false ``` -------------------------------- ### Create, Update, or Delete a Queue Profile Entry Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md Manages Queue Profile Entries on AOS-CX devices. This module is used to create, update, or delete specific entries within a queue profile, defining parameters like local priorities and descriptions. ```YAML - name: Create Queue Profile Entry 1 aoscx_queue_profile_entry: queue_number: 1 description: Low-Queue-Prof entry local_priorities: - 1 - 2 - 3 ``` -------------------------------- ### Configure Port Security Sticky MAC Learning Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_l2_interface.md This snippet demonstrates enabling sticky MAC learning for port security. When enabled, the interface learns and remembers the MAC addresses of devices connected to it. This requires `port_security_enable` to be true. ```YAML port_security_enable: true port_security_sticky_learning: true ``` -------------------------------- ### aoscx_qos Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_qos.md Manages QoS (Quality of Service) Schedule Profiles for future configuration. This module allows for the creation, update, or deletion of these profiles. ```APIDOC ## aoscx_qos ### Description Manages QoS (Quality of Service) Schedule Profiles for future configuration. This module implements creation or deletion of a Schedule Profiles for future configuration through the related [Queue](#aoscx_queue) module. You can find additional information online about how QoS is structured at the [Aruba Portal](https://developer.arubanetworks.com/aruba-aoscx/reference#qos) ### Method Not explicitly defined, but typically POST or PUT for configuration modules. ### Endpoint Not explicitly defined, but applies to the device managed by Ansible. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (str) - Required - Name of the Schedule Profile. - **vsx_sync** (list) - Optional - Controls which attributes should be synchronized between VSX peers. Defaults to `all_attributes_and_dependents`. - **state** (str) - Optional - The action to be taken with the current Schedule Profile. Choices: `create`, `update`, `delete`. Defaults to `create`. ``` -------------------------------- ### Delete OSPF Router Configuration with Ansible Source: https://github.com/aruba/aoscx-ansible-collection/blob/master/docs/aoscx_ospf.md This example demonstrates how to delete an OSPF router configuration using the `aoscx_ospf_router` module with the `delete` state. It requires specifying the VRF and OSPF instance tag of the router to be removed. ```YAML - name: Delete OSPF Router aoscx_ospf_router: state: delete vrf: default instance_tag: 1 ```