cisco.ios.ios_banner (8.0.0) — module

Module to configure multiline banners.

| "added in version" 1.0.0 of cisco.ios"

Authors: Ricardo Carrillo Cruz (@rcarrillocruz)

Install collection

Install with ansible-galaxy collection install cisco.ios:==8.0.0


Add to requirements.yml

  collections:
    - name: cisco.ios
      version: 8.0.0

Description

This will configure both login and motd banners on remote devices running Cisco IOS. 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
  cisco.ios.ios_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
  cisco.ios.ios_banner:
    banner: motd
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure banner from file
  cisco.ios.ios_banner:
    banner: motd
    text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}"  # Use unix formatted text files (LF not CRLF) to avoid idempotency issues.
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure the login banner using delimiter
  cisco.ios.ios_banner:
    banner: login
    multiline_delimiter: x
    text: this is my login banner
    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).
    type: str

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

banner:
    choices:
    - login
    - motd
    - exec
    - incoming
    - slip-ppp
    description:
    - Specifies which banner should be configured on the remote device. In Ansible 2.4
      and earlier only I(login) and I(motd) were supported.
    required: true
    type: str

multiline_delimiter:
    default: '@'
    description:
    - Specify the delimiting character than will be used for configuration.
    type: str

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