dellemc.enterprise_sonic.sonic_aaa module – Manage AAA configuration on SONiC

Note

This module is part of the dellemc.enterprise_sonic collection (version 3.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic.

To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_aaa.

New in dellemc.enterprise_sonic 1.1.0

Synopsis

  • This module provides configuration management of AAA for devices running SONiC.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

config

dictionary

AAA configuration

For all lists in the module, the list items should be specified in order of desired priority.

List items specified first have the highest priority.

authentication

dictionary

added in dellemc.enterprise_sonic 3.0.0

AAA authentication configuration

auth_method

list / elements=string

Specifies the order of the methods in which to authenticate login

Choices:

  • "ldap"

  • "local"

  • "radius"

  • "tacacs+"

console_auth_local

boolean

Enable/disable local authentication on console

Choices:

  • false

  • true

failthrough

boolean

Enable/disable failthrough

Choices:

  • false

  • true

authorization

dictionary

added in dellemc.enterprise_sonic 3.0.0

AAA authorization configuration

commands_auth_method

list / elements=string

Specifies the order of the methods in which to authorize commands

Choices:

  • "local"

  • "tacacs+"

login_auth_method

list / elements=string

Specifies the order of the methods in which to authorize login

Choices:

  • "ldap"

  • "local"

name_service

dictionary

added in dellemc.enterprise_sonic 3.0.0

AAA name-service configuration

group

list / elements=string

Name-service source for group method

Choices:

  • "ldap"

  • "local"

  • "login"

netgroup

list / elements=string

Name-service source for netgroup method

Choices:

  • "ldap"

  • "local"

passwd

list / elements=string

Name-service source for passwd method

Choices:

  • "ldap"

  • "local"

  • "login"

shadow

list / elements=string

Name-service source for shadow method

Choices:

  • "ldap"

  • "local"

  • "login"

sudoers

list / elements=string

Name-service source for sudoers method

Choices:

  • "ldap"

  • "local"

state

string

The state of the configuration after module completion

Choices:

  • "merged" ← (default)

  • "deleted"

  • "overridden"

  • "replaced"

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies

  • Supports check_mode

Examples

# Using Merged
#
# Before state:
# -------------
#
# sonic# show aaa
# (No AAA configuration present)

- name: Merge AAA configuration
  dellemc.enterprise_sonic.sonic_aaa:
    config:
      authentication:
        auth_method:
          - local
          - ldap
          - radius
          - tacacs+
        console_auth_local: True
        failthrough: True
      authorization:
        commands_auth_method:
          - local
          - tacacs+
        login_auth_method:
          - local
          - ldap
      name_service:
        group:
          - ldap
        netgroup:
          - local
        passwd:
          - login
        shadow:
          - ldap
        sudoers:
          - local
    state: merged

# After state:
# ------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : local, ldap, radius, tacacs+
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local, ldap
# commands     : local, tacacs+
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap
# netgroup-method : local
# passwd-method   : login
# shadow-method   : ldap
# sudoers-method  : local


# Using Replaced
#
# Before state:
# -------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : local, ldap, radius, tacacs+
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local, ldap
# commands     : local, tacacs+
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap
# netgroup-method : local
# passwd-method   : login
# shadow-method   : ldap
# sudoers-method  : local

- name: Replace AAA configuration
  dellemc.enterprise_sonic.sonic_aaa:
    config:
      authentication:
        console_auth_local: True
        failthrough: False
      authorization:
        commands_auth_method:
          - local
      name_service:
        group:
          - ldap
    state: replaced

# After state:
# ------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : False
# login-method :
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap


# Using Overridden
#
# Before state:
# -------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : local, ldap, radius, tacacs+
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local, ldap
# commands     : local, tacacs+
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap
# netgroup-method : local
# passwd-method   : login
# shadow-method   : ldap
# sudoers-method  : local

- name: Override AAA configuration
  dellemc.enterprise_sonic.sonic_aaa:
    config:
      authentication:
        auth_method:
          - tacacs+
        console_auth_local: True
        failthrough: True
    state: overridden

# After state:
# ------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : tacacs+
# console authentication  : local


# Using Deleted
#
# Before state:
# -------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : local, ldap, radius, tacacs+
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local, ldap
# commands     : local, tacacs+
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap
# netgroup-method : local
# passwd-method   : login
# shadow-method   : ldap
# sudoers-method  : local

- name: Delete AAA individual attributes
  dellemc.enterprise_sonic.sonic_aaa:
    config:
      authentication:
        auth_method:
          - local
          - ldap
          - radius
          - tacacs+
        console_auth_local: True
        failthrough: True
      authorization:
        commands_auth_method:
          - local
          - tacacs+
        login_auth_method:
          - local
          - ldap
      name_service:
        group:
          - ldap
        netgroup:
          - local
        passwd:
          - login
        shadow:
          - ldap
        sudoers:
          - local
    state: deleted

# After state:
# ------------
#
# sonic# show aaa
# (No AAA configuration present)


# Using Deleted
#
# Before state:
# -------------
#
# sonic# show aaa
# ---------------------------------------------------------
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough  : True
# login-method : local, ldap, radius, tacacs+
# console authentication  : local
# ---------------------------------------------------------
# AAA Authorization Information
# ---------------------------------------------------------
# login        : local, ldap
# commands     : local, tacacs+
# ---------------------------------------------------------
# AAA Name-Service Information
# ---------------------------------------------------------
# group-method    : ldap
# netgroup-method : local
# passwd-method   : login
# shadow-method   : ldap
# sudoers-method  : local

- name: Delete all AAA configuration
  dellemc.enterprise_sonic.sonic_aaa:
    config: {}
    state: deleted

# After state:
# ------------
#
# sonic# show aaa
# (No AAA configuration present)

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The resulting configuration module invocation.

Returned: when changed

Sample: ["The configuration returned will always be in the same format as the parameters above.\n"]

after(generated)

list / elements=string

The generated configuration module invocation.

Returned: when check_mode

Sample: ["The configuration returned will always be in the same format\n as the parameters above.\n"]

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format as the parameters above.\n"]

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: ["command 1", "command 2", "command 3"]

Authors

  • Shade Talabi (@stalabi1)