Debian Codegraph @

ansible_collections/cisco/nxos/docs/cisco.nxos.nxos_user_module.rst

raw
1 .. _cisco.nxos.nxos_user_module:
2
3
4 ********************
5 cisco.nxos.nxos_user
6 ********************
7
8 **Manage the collection of local users on Nexus devices**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides declarative management of the local usernames configured on Cisco Nexus 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.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="2">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="2">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>aggregate</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">list</span>
43 / <span style="color: purple">elements=dictionary</span>
44 </div>
45 </td>
46 <td>
47 </td>
48 <td>
49 <div>The set of username objects to be configured on the remote Cisco Nexus device. The list entries can either be the username or a hash of username and properties. This argument is mutually exclusive with the <code>name</code> argument.</div>
50 <div style="font-size: small; color: darkgreen"><br/>aliases: users, collection</div>
51 </td>
52 </tr>
53 <tr>
54 <td class="elbow-placeholder"></td>
55 <td colspan="1">
56 <div class="ansibleOptionAnchor" id="parameter-"></div>
57 <b>configured_password</b>
58 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
59 <div style="font-size: small">
60 <span style="color: purple">string</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>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.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>hashed_password</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">string</span>
77 </div>
78 </td>
79 <td>
80 </td>
81 <td>
82 <div>The hashed password to be configured on the network device. The password needs to already be encrypted.</div>
83 </td>
84 </tr>
85 <tr>
86 <td class="elbow-placeholder"></td>
87 <td colspan="1">
88 <div class="ansibleOptionAnchor" id="parameter-"></div>
89 <b>name</b>
90 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
91 <div style="font-size: small">
92 <span style="color: purple">string</span>
93 </div>
94 </td>
95 <td>
96 </td>
97 <td>
98 <div>The username to be configured on the remote Cisco Nexus device. This argument accepts a string value and is mutually exclusive with the <code>aggregate</code> argument.</div>
99 </td>
100 </tr>
101 <tr>
102 <td class="elbow-placeholder"></td>
103 <td colspan="1">
104 <div class="ansibleOptionAnchor" id="parameter-"></div>
105 <b>roles</b>
106 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
107 <div style="font-size: small">
108 <span style="color: purple">list</span>
109 / <span style="color: purple">elements=string</span>
110 </div>
111 </td>
112 <td>
113 </td>
114 <td>
115 <div>The <code>role</code> argument configures the role for the username in the device running configuration. The argument accepts a string value defining the role name. This argument does not check if the role has been configured on the device.</div>
116 <div style="font-size: small; color: darkgreen"><br/>aliases: role</div>
117 </td>
118 </tr>
119 <tr>
120 <td class="elbow-placeholder"></td>
121 <td colspan="1">
122 <div class="ansibleOptionAnchor" id="parameter-"></div>
123 <b>sshkey</b>
124 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
125 <div style="font-size: small">
126 <span style="color: purple">string</span>
127 </div>
128 </td>
129 <td>
130 </td>
131 <td>
132 <div>The <code>sshkey</code> argument defines the SSH public key to configure for the username. This argument accepts a valid SSH key value.</div>
133 </td>
134 </tr>
135 <tr>
136 <td class="elbow-placeholder"></td>
137 <td colspan="1">
138 <div class="ansibleOptionAnchor" id="parameter-"></div>
139 <b>state</b>
140 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
141 <div style="font-size: small">
142 <span style="color: purple">string</span>
143 </div>
144 </td>
145 <td>
146 <ul style="margin: 0; padding: 0"><b>Choices:</b>
147 <li>present</li>
148 <li>absent</li>
149 </ul>
150 </td>
151 <td>
152 <div>The <code>state</code> argument configures the state of the username definition as it relates to the device operational configuration. When set to <em>present</em>, the username(s) should be configured in the device active configuration and when set to <em>absent</em> the username(s) should not be in the device active configuration</div>
153 </td>
154 </tr>
155 <tr>
156 <td class="elbow-placeholder"></td>
157 <td colspan="1">
158 <div class="ansibleOptionAnchor" id="parameter-"></div>
159 <b>update_password</b>
160 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
161 <div style="font-size: small">
162 <span style="color: purple">string</span>
163 </div>
164 </td>
165 <td>
166 <ul style="margin: 0; padding: 0"><b>Choices:</b>
167 <li>on_create</li>
168 <li>always</li>
169 </ul>
170 </td>
171 <td>
172 <div>Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to <code>always</code>, the password will always be updated in the device and when set to <code>on_create</code> the password will be updated only if the username is created.</div>
173 </td>
174 </tr>
175
176 <tr>
177 <td colspan="2">
178 <div class="ansibleOptionAnchor" id="parameter-"></div>
179 <b>configured_password</b>
180 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
181 <div style="font-size: small">
182 <span style="color: purple">string</span>
183 </div>
184 </td>
185 <td>
186 </td>
187 <td>
188 <div>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.</div>
189 </td>
190 </tr>
191 <tr>
192 <td colspan="2">
193 <div class="ansibleOptionAnchor" id="parameter-"></div>
194 <b>hashed_password</b>
195 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
196 <div style="font-size: small">
197 <span style="color: purple">string</span>
198 </div>
199 </td>
200 <td>
201 </td>
202 <td>
203 <div>The hashed password to be configured on the network device. The password needs to already be encrypted.</div>
204 </td>
205 </tr>
206 <tr>
207 <td colspan="2">
208 <div class="ansibleOptionAnchor" id="parameter-"></div>
209 <b>name</b>
210 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
211 <div style="font-size: small">
212 <span style="color: purple">string</span>
213 </div>
214 </td>
215 <td>
216 </td>
217 <td>
218 <div>The username to be configured on the remote Cisco Nexus device. This argument accepts a string value and is mutually exclusive with the <code>aggregate</code> argument.</div>
219 </td>
220 </tr>
221 <tr>
222 <td colspan="2">
223 <div class="ansibleOptionAnchor" id="parameter-"></div>
224 <b>purge</b>
225 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
226 <div style="font-size: small">
227 <span style="color: purple">boolean</span>
228 </div>
229 </td>
230 <td>
231 <ul style="margin: 0; padding: 0"><b>Choices:</b>
232 <li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
233 <li>yes</li>
234 </ul>
235 </td>
236 <td>
237 <div>The <code>purge</code> argument instructs the module to consider the resource definition absolute. It will remove any previously configured usernames on the device with the exception of the `admin` user which cannot be deleted per nxos constraints.</div>
238 </td>
239 </tr>
240 <tr>
241 <td colspan="2">
242 <div class="ansibleOptionAnchor" id="parameter-"></div>
243 <b>roles</b>
244 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
245 <div style="font-size: small">
246 <span style="color: purple">list</span>
247 / <span style="color: purple">elements=string</span>
248 </div>
249 </td>
250 <td>
251 </td>
252 <td>
253 <div>The <code>role</code> argument configures the role for the username in the device running configuration. The argument accepts a string value defining the role name. This argument does not check if the role has been configured on the device.</div>
254 <div style="font-size: small; color: darkgreen"><br/>aliases: role</div>
255 </td>
256 </tr>
257 <tr>
258 <td colspan="2">
259 <div class="ansibleOptionAnchor" id="parameter-"></div>
260 <b>sshkey</b>
261 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
262 <div style="font-size: small">
263 <span style="color: purple">string</span>
264 </div>
265 </td>
266 <td>
267 </td>
268 <td>
269 <div>The <code>sshkey</code> argument defines the SSH public key to configure for the username. This argument accepts a valid SSH key value.</div>
270 </td>
271 </tr>
272 <tr>
273 <td colspan="2">
274 <div class="ansibleOptionAnchor" id="parameter-"></div>
275 <b>state</b>
276 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
277 <div style="font-size: small">
278 <span style="color: purple">string</span>
279 </div>
280 </td>
281 <td>
282 <ul style="margin: 0; padding: 0"><b>Choices:</b>
283 <li><div style="color: blue"><b>present</b>&nbsp;&larr;</div></li>
284 <li>absent</li>
285 </ul>
286 </td>
287 <td>
288 <div>The <code>state</code> argument configures the state of the username definition as it relates to the device operational configuration. When set to <em>present</em>, the username(s) should be configured in the device active configuration and when set to <em>absent</em> the username(s) should not be in the device active configuration</div>
289 </td>
290 </tr>
291 <tr>
292 <td colspan="2">
293 <div class="ansibleOptionAnchor" id="parameter-"></div>
294 <b>update_password</b>
295 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
296 <div style="font-size: small">
297 <span style="color: purple">string</span>
298 </div>
299 </td>
300 <td>
301 <ul style="margin: 0; padding: 0"><b>Choices:</b>
302 <li>on_create</li>
303 <li><div style="color: blue"><b>always</b>&nbsp;&larr;</div></li>
304 </ul>
305 </td>
306 <td>
307 <div>Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to <code>always</code>, the password will always be updated in the device and when set to <code>on_create</code> the password will be updated only if the username is created.</div>
308 </td>
309 </tr>
310 </table>
311 <br/>
312
313
314 Notes
315 -----
316
317 .. note::
318 - Limited Support for Cisco MDS
319 - For information on using CLI and NX-API see the :ref:`NXOS Platform Options guide <nxos_platform_options>`
320 - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>`
321 - For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_.
322
323
324
325 Examples
326 --------
327
328 .. code-block:: yaml
329
330 - name: create a new user
331 cisco.nxos.nxos_user:
332 name: ansible
333 sshkey: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
334 state: present
335
336 - name: remove all users except admin
337 cisco.nxos.nxos_user:
338 purge: true
339
340 - name: set multiple users role
341 cisco.nxos.nxos_user:
342 aggregate:
343 - name: netop
344 - name: netend
345 role: network-operator
346 state: present
347
348
349
350 Return Values
351 -------------
352 Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
353
354 .. raw:: html
355
356 <table border=0 cellpadding=0 class="documentation-table">
357 <tr>
358 <th colspan="1">Key</th>
359 <th>Returned</th>
360 <th width="100%">Description</th>
361 </tr>
362 <tr>
363 <td colspan="1">
364 <div class="ansibleOptionAnchor" id="return-"></div>
365 <b>commands</b>
366 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
367 <div style="font-size: small">
368 <span style="color: purple">list</span>
369 </div>
370 </td>
371 <td>always</td>
372 <td>
373 <div>The list of configuration mode commands to send to the device</div>
374 <br/>
375 <div style="font-size: smaller"><b>Sample:</b></div>
376 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;name ansible&#x27;, &#x27;name ansible password password&#x27;]</div>
377 </td>
378 </tr>
379 </table>
380 <br/><br/>
381
382
383 Status
384 ------
385
386
387 Authors
388 ~~~~~~~
389
390 - Peter Sprygada (@privateip)