community.general.cnos_interface (0.1.1) — module

Manage Interface on Lenovo CNOS network devices

Authors: Anil Kumar Muraleedharan(@amuraleedhar)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

This module provides declarative management of Interfaces on Lenovo CNOS network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure interface
  cnos_interface:
      name: Ethernet1/33
      description: test-interface
      speed: 100
      duplex: half
      mtu: 999
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove interface
  cnos_interface:
    name: loopback3
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: make interface up
  cnos_interface:
    name: Ethernet1/33
    enabled: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: make interface down
  cnos_interface:
    name: Ethernet1/33
    enabled: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check intent arguments
  cnos_interface:
    name: Ethernet1/33
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check neighbors intent arguments
  cnos_interface:
    name: Ethernet1/33
    neighbors:
    - port: eth0
      host: netdev
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Config + intent
  cnos_interface:
    name: Ethernet1/33
    enabled: False
    state: down
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add interface using aggregate
  cnos_interface:
    aggregate:
    - { name: Ethernet1/33, mtu: 256, description: test-interface-1 }
    - { name: Ethernet1/44, mtu: 516, description: test-interface-2 }
    duplex: full
    speed: 100
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete interface using aggregate
  cnos_interface:
    aggregate:
    - name: loopback3
    - name: loopback6
    state: absent

Inputs

    
mtu:
    description:
    - Maximum size of transmit packet.

name:
    description:
    - Name of the Interface.
    required: true

delay:
    default: 20
    description:
    - Time in seconds to wait before checking for the operational state on remote device.
      This wait is applicable for operational state argument which are I(state) with values
      C(up)/C(down), I(tx_rate) and I(rx_rate)

speed:
    description:
    - Interface link speed.

state:
    choices:
    - present
    - absent
    - up
    - down
    default: present
    description:
    - State of the Interface configuration, C(up) means present and operationally up and
      C(down) means present and operationally C(down)

duplex:
    choices:
    - full
    - half
    - auto
    default: auto
    description:
    - Interface link status

enabled:
    default: true
    description:
    - Interface link status.
    type: bool

rx_rate:
    description:
    - Receiver rate in bits per second (bps).
    - This is state check parameter only.
    - Supports conditionals, see L(Conditionals in Networking Modules, ../network/user_guide/network_working_with_command_output.html)

tx_rate:
    description:
    - Transmit rate in bits per second (bps).
    - This is state check parameter only.
    - Supports conditionals, see L(Conditionals in Networking Modules, ../network/user_guide/network_working_with_command_output.html)

provider:
    description:
    - B(Deprecated)
    - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli).'
    - For more information please see the L(CNOS Platform Options guide, ../network/user_guide/platform_cnos.html).
    - HORIZONTALLINE
    - A dict object containing connection details.
    suboptions:
      auth_pass:
        description:
        - Specifies the password to use if required to enter privileged mode on the remote
          device.  If I(authorize) is false, then this argument does nothing. If the value
          is not specified in the task, the value of environment variable C(ANSIBLE_NET_AUTH_PASS)
          will be used instead.
      authorize:
        default: 'no'
        description:
        - Instructs the module to enter privileged mode on the remote device before sending
          any commands.  If not specified, the device will attempt to execute all commands
          in non-privileged mode. If the value is not specified in the task, the value
          of environment variable C(ANSIBLE_NET_AUTHORIZE) will be used instead.
        type: bool
      host:
        description:
        - Specifies the DNS host name or address for connecting to the remote device over
          the specified transport.  The value of host is used as the destination address
          for the transport.
        required: true
      password:
        description:
        - Specifies the password to use to authenticate the connection to the remote device.   This
          value is used to authenticate the SSH session. If the value is not specified
          in the task, the value of environment variable C(ANSIBLE_NET_PASSWORD) will
          be used instead.
      port:
        default: 22
        description:
        - Specifies the port to use when building the connection to the remote device.
      ssh_keyfile:
        description:
        - Specifies the SSH key to use to authenticate the connection to the remote device.   This
          value is the path to the key used to authenticate the SSH session. If the value
          is not specified in the task, the value of environment variable C(ANSIBLE_NET_SSH_KEYFILE)
          will be used instead.
      timeout:
        default: 10
        description:
        - Specifies the timeout in seconds for communicating with the network device for
          either connecting or sending commands.  If the timeout is exceeded before the
          operation is completed, the module will error.
      username:
        description:
        - Configures the username to use to authenticate the connection to the remote
          device.  This value is used to authenticate the SSH session. If the value is
          not specified in the task, the value of environment variable C(ANSIBLE_NET_USERNAME)
          will be used instead.

aggregate:
    description: List of Interfaces definitions.

neighbors:
    description:
    - Check operational state of given interface C(name) for LLDP neighbor.
    - The following suboptions are available.
    suboptions:
      host:
        description:
        - LLDP neighbor host for given interface C(name).
      port:
        description:
        - LLDP neighbor port to which interface C(name) is connected.

description:
    description:
    - Description of Interface.

Outputs

commands:
  description: The list of configuration mode commands to send to the device.
  returned: always, except for the platforms that use Netconf transport to manage
    the device.
  sample:
  - interface Ethernet1/33
  - description test-interface
  - duplex half
  - mtu 512
  type: list