ansible.builtin.iosxr_banner (v2.9.13) — module

Manage multiline banners on Cisco IOS XR devices

| "added in version" 2.4 of ansible.builtin"

Authors: Trishna Guha (@trishnaguha), Kedar Kekan (@kedarX)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.13

Description

This module will configure both exec and motd banners on remote device running Cisco IOS XR. It allows playbooks to add or remove banner text from the running configuration.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure the login banner
  iosxr_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
  iosxr_banner:
    banner: motd
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure banner from file
  iosxr_banner:
    banner:  motd
    text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}"
    state: present

Inputs

    
text:
    description:
    - Banner text to be configured. Accepts multiline string, without empty lines. Requires
      I(state=present).

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Existential state of the configuration on the device.

banner:
    choices:
    - login
    - motd
    description:
    - Specifies the type of banner to configure on remote device.
    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(Network Guide, ../network/getting_started/network_differences.html#multiple-communication-protocols).
    - HORIZONTALLINE
    - A dict object containing connection details.
    suboptions:
      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
        type: str
      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.
        type: str
      port:
        default: 22
        description:
        - Specifies the port to use when building the connection to the remote device.
        type: int
      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.
        type: path
      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.
        type: int
      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.
        type: str
    type: dict

Outputs

commands:
  description: The list of configuration mode commands sent to device with transport
    C(cli)
  returned: always (empty list when no commands to send)
  sample:
  - banner login
  - this is my login banner
  - that contains a multiline
  - string
  type: list
xml:
  description: NetConf rpc xml sent to device with transport C(netconf)
  returned: always (empty list when no xml rpc to send)
  sample:
  - <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <banners xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-infra-cfg">
    <banner xc:operation="merge"> <banner-name>motd</banner-name> <banner-text>Ansible
    banner example</banner-text> </banner> </banners> </config>
  type: list
  version_added: 2.5
  version_added_collection: ansible.builtin