community.general.cnos_banner (0.1.1) — module

Manage multiline banners on Lenovo CNOS 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 will configure both login and motd banners on remote devices running Lenovo CNOS. It allows playbooks to add or remote banner text from the active running configuration.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure the login banner
  cnos_banner:
    banner: login
    text: |
      this is my login banner
      that contains a multiline
      string
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove the motd banner
  cnos_banner:
    banner: motd
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure banner from file
  cnos_banner:
    banner:  motd
    text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}"
    state: present

Inputs

    
text:
    description:
    - The banner text that should be present in the remote device running configuration.  This
      argument accepts a multiline string, with no empty lines. Requires I(state=present).

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Specifies whether or not the configuration is present in the current devices active
      running configuration.

banner:
    choices:
    - login
    - motd
    description:
    - Specifies which banner should be configured on the remote device. In Ansible 2.8
      and earlier only I(login) and I(motd) were supported.
    required: true

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.

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - banner login
  - this is my login banner
  - that contains a multiline
  - string
  type: list