�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z m Z d d
l m Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys3
---
module: pn_role
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.8"
short_description: CLI command to create/delete/modify role
description:
- This module can be used to create, delete and modify user roles.
options:
pn_cliswitch:
description:
- Target switch to run the CLI on.
required: false
type: str
state:
description:
- State the action to perform. Use C(present) to create role and
C(absent) to delete role and C(update) to modify role.
required: true
type: str
choices: ['present', 'absent', 'update']
pn_scope:
description:
- local or fabric.
required: false
type: str
choices: ['local', 'fabric']
pn_access:
description:
- type of access.
required: false
type: str
choices: ['read-only', 'read-write']
pn_shell:
description:
- allow shell command.
required: false
type: bool
pn_sudo:
description:
- allow sudo from shell.
required: false
type: bool
pn_running_config:
description:
- display running configuration of switch.
required: false
type: bool
pn_name:
description:
- role name.
required: true
type: str
pn_delete_from_users:
description:
- delete from users.
required: false
type: bool
s�
- name: Role create
pn_role:
pn_cliswitch: 'sw01'
state: 'present'
pn_name: 'foo'
pn_scope: 'local'
pn_access: 'read-only'
- name: Role delete
pn_role:
pn_cliswitch: 'sw01'
state: 'absent'
pn_name: 'foo'
- name: Role modify
pn_role:
pn_cliswitch: 'sw01'
state: 'update'
pn_name: 'foo'
pn_access: 'read-write'
pn_sudo: true
pn_shell: true
s�
command:
description: the CLI command run on the target node.
returned: always
type: str
stdout:
description: set of responses from the role command.
returned: always
type: list
stderr:
description: set of error responses from the role command.
returned: on error
type: list
changed:
description: indicates whether the CLI caused changes on the target.
returned: always
type: bool
( t
AnsibleModule( t pn_clit run_clit booleanArgs( t run_commandsc C` sS | j d } | d 7} t | | � d } | r? | j � } n | | k rO t St S( s�
This method checks for idempotency using the role-show command.
If a role with given name exists, return True else False.
:param module: The Ansible module to fetch input parameters
:param cli: The CLI string
t pn_names&