### Installing Ansible Collection Requirements Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This command uses `ansible-galaxy` to install all Ansible collections and roles listed in the `requirements.yml` file, ensuring all dependencies for the AOS-Switch Ansible Collection are met. ```ansible-cli ansible-galaxy install -r requirements.yml ``` -------------------------------- ### Installing AOS-Switch Ansible Collection via Galaxy Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This command installs the `arubanetworks.aos_switch` collection directly from Ansible Galaxy, making its modules and plugins available for use in Ansible playbooks. ```ansible-cli ansible-galaxy collection install arubanetworks.aos_switch ``` -------------------------------- ### Creating VLAN 300 with AOS-Switch Ansible Collection (REST API) Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This Ansible playbook demonstrates how to create VLAN 300 on an AOS-Switch device using the `arubaoss_vlan` module. It specifies the VLAN ID, name, and action (`create`), connecting via the REST API as implied by the inventory setup. ```yaml --- - hosts: all collections: - arubanetworks.aos_switch tasks: - name: Create VLAN 300 arubaoss_vlan: vlan_id: 300 name: "vlan300" config: "create" command: config_vlan ``` -------------------------------- ### Configuring Ansible Inventory for AOS-Switch REST API Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This snippet demonstrates how to set up an Ansible inventory file (`inventory.yml`) for connecting to an AOS-Switch device. It configures the host `aosswitch_1` with its IP, admin credentials, and specifies `ansible_connection: local` for REST API communication and `ansible_network_os: arubanetworks.aos_switch.arubaoss`. ```yaml all: hosts: aosswitch_1: ansible_host: 10.0.0.1 ansible_user: admin ansible_password: password ansible_connection: local # REST API connection method ansible_network_os: arubanetworks.aos_switch.arubaoss # Do not change ``` -------------------------------- ### Enabling REST Interface on AOS-Switch Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md These commands enable the web management SSL and the REST interface on an AOS-Switch device, which are prerequisites for using the Ansible collection's REST API modules. ```cli switch(config)# web-management ssl switch(config)# rest-interface ``` -------------------------------- ### Ansible Inventory for Mixed REST API and SSH/CLI Connections Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This inventory configuration sets up a host (`switch1`) with `ansible_connection: local` for REST API communication as the default. This allows individual plays in a playbook to override the connection type for SSH/CLI modules while maintaining a base REST API connection. ```yaml all: hosts: switch1: ansible_host: 10.0.0.1 ansible_user: admin ansible_password: password ansible_connection: local # REST API connection method ansible_network_os: arubanetworks.aos_switch.arubaoss # Do not change ``` -------------------------------- ### Ansible Playbook for Mixed REST API and SSH/CLI Operations Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This playbook demonstrates how to perform both REST API and SSH/CLI operations on an AOS-Switch within a single playbook. It uses separate plays, explicitly setting `ansible_connection: local` for REST API tasks and `ansible_connection: network_cli` for SSH/CLI tasks, as mixing connection types within a single play is not supported. ```yaml - hosts: all collections: - arubanetworks.aos_switch tasks: - name: Create VLAN 300 arubaoss_vlan: vlan_id: 300 name: "vlan300" config: "create" command: config_vlan - hosts: all collections: - arubanetworks.aos_switch vars: ansible_connection: network_cli tasks: - name: Execute show run on the switch arubaoss_command: commands: ['show run'] ``` -------------------------------- ### Enabling SSH Access on AOS-Switch Device CLI Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This command is executed directly on the AOS-Switch device's command-line interface to enable SSH access. SSH is a prerequisite for using Ansible's SSH/CLI modules (`arubaoss_config`, `arubaoss_command`) to manage the switch. ```cli switch(config)# ip ssh ``` -------------------------------- ### Configuring NETWORK_GROUP_MODULES in ansible.cfg Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This configuration snippet shows how to permanently set the `NETWORK_GROUP_MODULES` value to `arubaoss` within the `[defaults]` section of the `ansible.cfg` file. This allows Ansible to consistently recognize the AOS-Switch network OS without needing to set an environment variable for each command. ```ini [defaults] NETWORK_GROUP_MODULES=arubaoss ``` -------------------------------- ### Configuring RADIUS/TACACS Authentication for REST on AOS-Switch Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md These commands configure AAA authentication for the REST interface, allowing login and enable access via RADIUS or local authentication methods, essential when using RADIUS or TACACS for switch management. ```cli switch(config)# aaa authentication rest login radius local switch(config)# aaa authentication rest enable radius local ``` -------------------------------- ### Setting ANSIBLE_NETWORK_GROUP_MODULES via Command Line Source: https://github.com/aruba/aos-switch-ansible-collection/blob/master/README.md This shell command illustrates how to temporarily set the `ANSIBLE_NETWORK_GROUP_MODULES` environment variable to `arubaoss` when executing an Ansible playbook. This ensures Ansible recognizes the AOS-Switch network operating system for the current command execution. ```shell $ ANSIBLE_NETWORK_GROUP_MODULES=arubaoss ansible-playbook sample_playbook.yml -i inventory.yml ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.