seiko.smartcs.smartcs_config (1.5.0) — module

Manage configuratin sections of SmartCS

| "added in version" 1.3.0 of seiko.smartcs"

Authors: Seiko Solutions Inc. (@naka-shin1)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install seiko.smartcs:==1.5.0


Add to requirements.yml

  collections:
    - name: seiko.smartcs
      version: 1.5.0

Description

This module provides configuration of SmartCS. If there is a difference between running configration and a command specfied by the lines option, execute configration command.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configuration tty 1 settings
  seiko.smartcs.smartcs_config:
    lines:
    - pord tty 1 label SWITCH_1
    - set tty 1 baud 38400
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configuration tty 20 settings and write
  seiko.smartcs.smartcs_config:
    lines:
    - set pord tty 20 label ROUTER
    - set tty 20 baud 19200
    save_when: modified
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configuration host name and get backup file
  seiko.smartcs.smartcs_config:
    lines:
    - set hostname SmartCS_TEST1
    save_when: always
    backup: yes

Inputs

    
src:
    description:
    - Specifies the source path to the file that contains the configuration to load.  The
      path to the source file can either be the full path on the Ansible control host
      or a relative path from the playbook or role root directory.
    type: str

lines:
    aliases:
    - commands
    description:
    - The ordered set of commands that should be configured in the section. The commands
      must be the exact same commands as found in the device running-config.
    elements: str
    type: list

match:
    choices:
    - line
    - none
    default: line
    description:
    - Instructs the module on the way to perform the matching of the set of commands against
      the current device config.  If match is set to I(line), commands are matched line
      by line. if match is set to I(none), the module will not attempt to compare the
      source configuration with the running configuration on the remote device.
    type: str

backup:
    default: false
    description:
    - This argument will cause the module to create a full backup of the current C(running-config)
      from the remote device before any changes are made. If the C(backup_options) value
      is not given, the backup file is written to the C(backup) folder in the playbook
      root directory or role root directory, if playbook is part of an ansible role. If
      the directory does not exist, it is created.
    type: bool

provider:
    description:
    - B(Deprecated)
    - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli).'
    - 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.
        type: str
      authorize:
        default: false
        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.
        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:
        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:
        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

save_when:
    choices:
    - always
    - never
    - modified
    - changed
    default: never
    description:
    - When changes are made to the device running-configuration, the changes are not copied
      to non-volatile storage by default.  Using this argument will change that before.  If
      the argument is set to I(always), then the running-configratoin will always be copied
      to the startup-configration and the I(modified) flag will always be set to True.  If
      the argument is set to I(modified), then the running-configration will only be copied
      to the startup-configration if it has changed since the last save to startup-configration.  If
      the argument is set to I(never), the running-configration will never be copied to
      the startup-configration.  If the argument is set to I(changed), then the running-configration
      will only be copied to the startup-configration if the task has made a change.
    type: str

Outputs

backup_path:
  description: The full path to the backup file
  returned: when backup is yes
  sample: /playbooks/ansible/backup/smartcs_config.2019-03-16@16:00:16
  type: str
commands:
  description: The set of commands that will be pushed to the remote device
  returned: always
  sample:
  - set hostname NS-2250-48
  - set tty 1 baud 19200
  type: list
updates:
  description: The set of commands that will be pushed to the remote device
  returned: always
  sample:
  - set hostname NS-2250-48
  - set tty 1 baud 19200
  type: list