dellemc / dellemc.enterprise_sonic / 2.4.0 / module / sonic_users Manage users and its parameters | "added in version" 1.1.0 of dellemc.enterprise_sonic" Authors: Niraimadaiselvam M (@niraimadaiselvamm) This plugin has a corresponding action plugin.dellemc.enterprise_sonic.sonic_users (2.4.0) — module
Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0
collections: - name: dellemc.enterprise_sonic version: 2.4.0
This module provides configuration management of users parameters on devices running Enterprise SONiC.
# Using deleted # # Before state: # ------------- # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # sysadmin admin # sysoperator operator - name: Delete user dellemc.enterprise_sonic.sonic_users: config: - name: sysoperator state: deleted
# After state: # ------------ # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # sysadmin admin # Using deleted # # Before state: # ------------- # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # sysadmin admin # sysoperator operator - name: Delete all users configurations except admin dellemc.enterprise_sonic.sonic_users: config: state: deleted
# After state: # ------------ # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # Using merged # # Before state: # ------------- # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin - name: Merge users configurations dellemc.enterprise_sonic.sonic_users: config: - name: sysadmin role: admin password: admin update_password: always - name: sysoperator role: operator password: operator update_password: always state: merged
# After state: # ------------ # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # sysadmin admin # sysoperator operator # Using Overridden # # Before state: # ------------- # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # sysadmin admin # sysoperator operator - name: Override users configurations dellemc.enterprise_sonic.sonic_users: config: - name: user1 role: secadmin password: 123abc update_password: always state: overridden
# After state: # ------------ # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # user1 secadmin # Using Replaced # # Before state: # ------------- # # sonic# show users configured # ---------------------------------------------------------------------- # User Role(s) # ---------------------------------------------------------------------- # admin admin # user1 secadmin # user2 operator - name: Replace users configurations dellemc.enterprise_sonic.sonic_users: config: - name: user1 role: operator password: 123abc update_password: always - name: user2 role: netadmin password: 123abc update_password: always state: replaced
state: choices: - merged - deleted - overridden - replaced default: merged description: - Specifies the operation to be performed on the users configured on the device. - In case of merged, the input configuration will be merged with the existing users configuration on the device. - In case of deleted the existing users configuration will be removed from the device. - In case of replaced, the existing specified user configuration will be replaced with provided configuration. - In case of overridden, the existing users configuration will be overridden with the provided configuration. type: str config: description: - Specifies the users related configuration. elements: dict suboptions: name: description: - Specifies the name of the user. required: true type: str password: description: - Specifies the password of the user. type: str role: choices: - admin - operator - netadmin - secadmin description: - Specifies the role of the user. type: str update_password: choices: - always - on_create default: always description: - Specifies the update password flag. - In case of always, password will be updated every time. - In case of on_create, password will be updated only when user is created. type: str type: list
after: description: The resulting configuration model invocation. returned: when changed sample: "The configuration returned will always be in the same format\n of the parameters\ \ above.\n" type: list after(generated): description: The generated configuration model invocation. returned: when C(check_mode) sample: "The configuration returned will always be in the same format\n of the parameters\ \ above.\n" type: list before: description: The configuration prior to the model invocation. returned: always sample: "The configuration returned will always be in the same format\n of the parameters\ \ above.\n" type: list commands: description: The set of commands pushed to the remote device. returned: always sample: - command 1 - command 2 - command 3 type: list