community.network.cnos_user module – Manage the collection of local users on Lenovo CNOS devices
Note
This module is part of the community.network collection (version 5.0.2).
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 community.network
.
To use it in a playbook, specify: community.network.cnos_user
.
Synopsis
This module provides declarative management of the local usernames configured on Lenovo CNOS devices. It allows playbooks to manage either individual usernames or the collection of usernames in the current running config. It also supports purging usernames from the configuration that are not explicitly defined.
Aliases: network.cnos.cnos_user
Parameters
Parameter |
Comments |
---|---|
The set of username objects to be configured on the remote Lenovo CNOS device. The list entries can either be the username or a hash of username and properties. This argument is mutually exclusive with the |
|
The password to be configured on the network device. The password needs to be provided in cleartext and it will be encrypted on the device. Please note that this option is not same as |
|
The username to be configured on the remote Lenovo CNOS device. This argument accepts a string value and is mutually exclusive with the |
|
The Choices:
|
|
The |
|
The |
|
The Choices:
|
|
Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to Choices:
|
Examples
- name: Create a new user
community.network.cnos_user:
name: ansible
sshkey: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
state: present
- name: Remove all users except admin
community.network.cnos_user:
purge: true
- name: Set multiple users role
aggregate:
- name: Netop
- name: Netend
role: network-operator
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The list of configuration mode commands to send to the device Returned: always Sample: |
|
The time elapsed to perform all operations Returned: always Sample: |
|
The time the job ended Returned: always Sample: |
|
The time the job started Returned: always Sample: |