| 1 |
.. _dellemc.enterprise_sonic.sonic_ssh_module: |
| 2 |
|
| 3 |
|
| 4 |
********************************** |
| 5 |
dellemc.enterprise_sonic.sonic_ssh |
| 6 |
********************************** |
| 7 |
|
| 8 |
**Manage SSH configurations on SONiC** |
| 9 |
|
| 10 |
|
| 11 |
Version added: 3.0.0 |
| 12 |
|
| 13 |
.. contents:: |
| 14 |
:local: |
| 15 |
:depth: 1 |
| 16 |
|
| 17 |
|
| 18 |
Synopsis |
| 19 |
-------- |
| 20 |
- This module provides SSH configuration management to specify the algorithms used for SSH connection in devices running SONiC. |
| 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="3">Parameter</th> |
| 33 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 34 |
<th width="100%">Comments</th> |
| 35 |
</tr> |
| 36 |
<tr> |
| 37 |
<td colspan="3"> |
| 38 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 39 |
<b>config</b> |
| 40 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 41 |
<div style="font-size: small"> |
| 42 |
<span style="color: purple">dictionary</span> |
| 43 |
</div> |
| 44 |
</td> |
| 45 |
<td> |
| 46 |
</td> |
| 47 |
<td> |
| 48 |
<div>SSH clients and servers use the following configurations for SSH connections.</div> |
| 49 |
</td> |
| 50 |
</tr> |
| 51 |
<tr> |
| 52 |
<td class="elbow-placeholder"></td> |
| 53 |
<td colspan="2"> |
| 54 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 55 |
<b>client</b> |
| 56 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 57 |
<div style="font-size: small"> |
| 58 |
<span style="color: purple">dictionary</span> |
| 59 |
</div> |
| 60 |
</td> |
| 61 |
<td> |
| 62 |
</td> |
| 63 |
<td> |
| 64 |
<div>SSH client configuration</div> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
<tr> |
| 68 |
<td class="elbow-placeholder"></td> |
| 69 |
<td class="elbow-placeholder"></td> |
| 70 |
<td colspan="1"> |
| 71 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 72 |
<b>cipher</b> |
| 73 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 74 |
<div style="font-size: small"> |
| 75 |
<span style="color: purple">string</span> |
| 76 |
</div> |
| 77 |
</td> |
| 78 |
<td> |
| 79 |
</td> |
| 80 |
<td> |
| 81 |
<div>Cipher algorithm used in SSH connection for encryption. When configured, this value is used by SSH clients which communicate with the server.</div> |
| 82 |
<div>Specify as a comma separated list.</div> |
| 83 |
<div>Options are aes128-ctr, aes192-ctr, aes256-ctr</div> |
| 84 |
<div>[email protected], [email protected]</div> |
| 85 |
<div>and [email protected]</div> |
| 86 |
</td> |
| 87 |
</tr> |
| 88 |
<tr> |
| 89 |
<td class="elbow-placeholder"></td> |
| 90 |
<td class="elbow-placeholder"></td> |
| 91 |
<td colspan="1"> |
| 92 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 93 |
<b>kex</b> |
| 94 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 95 |
<div style="font-size: small"> |
| 96 |
<span style="color: purple">string</span> |
| 97 |
</div> |
| 98 |
</td> |
| 99 |
<td> |
| 100 |
</td> |
| 101 |
<td> |
| 102 |
<div>KEX algorithm used in SSH connection for key exchange. When configured, this value is used by SSH clients which communicate with the server.</div> |
| 103 |
<div>Specify as a comma separated list.</div> |
| 104 |
<div>Options are curve25519-sha256, [email protected]</div> |
| 105 |
<div>ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521,</div> |
| 106 |
<div>diffie-hellman-group-exchange-sha256,</div> |
| 107 |
<div>diffie-hellman-group16-sha512,</div> |
| 108 |
<div>diffie-hellman-group18-sha512 and</div> |
| 109 |
<div>diffie-hellman-group14-sha256</div> |
| 110 |
</td> |
| 111 |
</tr> |
| 112 |
<tr> |
| 113 |
<td class="elbow-placeholder"></td> |
| 114 |
<td class="elbow-placeholder"></td> |
| 115 |
<td colspan="1"> |
| 116 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 117 |
<b>mac</b> |
| 118 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 119 |
<div style="font-size: small"> |
| 120 |
<span style="color: purple">string</span> |
| 121 |
</div> |
| 122 |
</td> |
| 123 |
<td> |
| 124 |
</td> |
| 125 |
<td> |
| 126 |
<div>MAC algorithm used in SSH connection for generating and verifying Message Authentication Codes. When configured, this value is used by SSH clients which communicate with the server.</div> |
| 127 |
<div>Specify as a comma separated list.</div> |
| 128 |
<div>Options are [email protected],</div> |
| 129 |
<div>[email protected],</div> |
| 130 |
<div>[email protected], [email protected],</div> |
| 131 |
<div>hmac-sha2-256 and hmac-sha2-512</div> |
| 132 |
</td> |
| 133 |
</tr> |
| 134 |
|
| 135 |
|
| 136 |
<tr> |
| 137 |
<td colspan="3"> |
| 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><div style="color: blue"><b>merged</b> ←</div></li> |
| 148 |
<li>deleted</li> |
| 149 |
<li>replaced</li> |
| 150 |
<li>overridden</li> |
| 151 |
</ul> |
| 152 |
</td> |
| 153 |
<td> |
| 154 |
<div>The state specifies the type of configuration update to be performed on the device.</div> |
| 155 |
<div>If the state is "merged", merge specified attributes with existing configured attributes.</div> |
| 156 |
<div>For "deleted", delete the specified attributes from existing configuration.</div> |
| 157 |
<div>For "replaced", replace on-device SSH configuration with the specified configuration.</div> |
| 158 |
<div>For "overridden", override on-device SSH configurations with the specified configuration.</div> |
| 159 |
</td> |
| 160 |
</tr> |
| 161 |
</table> |
| 162 |
<br/> |
| 163 |
|
| 164 |
|
| 165 |
Notes |
| 166 |
----- |
| 167 |
|
| 168 |
.. note:: |
| 169 |
- Tested against Enterprise SONiC Distribution by Dell Technologies. |
| 170 |
- Supports ``check_mode``. |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
Examples |
| 175 |
-------- |
| 176 |
|
| 177 |
.. code-block:: yaml |
| 178 |
|
| 179 |
# Using "deleted" state |
| 180 |
# |
| 181 |
# Before state: |
| 182 |
# ------------- |
| 183 |
# |
| 184 |
# sonic# show running-configuration | grep "ip ssh client" |
| 185 |
# ip ssh client ciphers aes192-ctr,[email protected] |
| 186 |
# ip ssh client macs [email protected],[email protected] |
| 187 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 188 |
# sonic# |
| 189 |
|
| 190 |
- name: Delete specified SSH configurations |
| 191 |
dellemc.enterprise_sonic.sonic_ssh: |
| 192 |
config: |
| 193 |
client: |
| 194 |
cipher: 'aes192-ctr,[email protected]' |
| 195 |
mac: '[email protected],[email protected]' |
| 196 |
state: deleted |
| 197 |
|
| 198 |
# After state: |
| 199 |
# ------------ |
| 200 |
# |
| 201 |
# sonic# show running-configuration | grep "ip ssh client" |
| 202 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 203 |
# sonic# |
| 204 |
|
| 205 |
|
| 206 |
# Using "deleted" state |
| 207 |
# |
| 208 |
# Before state: |
| 209 |
# ------------- |
| 210 |
# |
| 211 |
# sonic# show running-configuration | grep "ip ssh client" |
| 212 |
# ip ssh client ciphers aes192-ctr,[email protected] |
| 213 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 214 |
# ip ssh client macs [email protected],[email protected] |
| 215 |
# sonic# |
| 216 |
|
| 217 |
- name: Delete all SSH configurations |
| 218 |
dellemc.enterprise_sonic.sonic_ssh: |
| 219 |
config: |
| 220 |
state: deleted |
| 221 |
|
| 222 |
# After state: |
| 223 |
# ------------ |
| 224 |
# |
| 225 |
# sonic# show running-configuration | grep "ip ssh client" |
| 226 |
# (No "ip ssh client" configuration present) |
| 227 |
# sonic# |
| 228 |
|
| 229 |
|
| 230 |
# Using "merged" state |
| 231 |
# |
| 232 |
# Before state: |
| 233 |
# ------------- |
| 234 |
# |
| 235 |
# sonic# show running-configuration | grep "ip ssh client" |
| 236 |
# sonic |
| 237 |
# (No "ip ssh client" configuration present) |
| 238 |
|
| 239 |
- name: Modify SSH configurations |
| 240 |
dellemc.enterprise_sonic.sonic_ssh: |
| 241 |
config: |
| 242 |
client: |
| 243 |
cipher: 'aes192-ctr,[email protected]' |
| 244 |
mac: '[email protected],[email protected]' |
| 245 |
kex: 'curve25519-sha256,diffie-hellman-group16-sha512' |
| 246 |
state: merged |
| 247 |
|
| 248 |
# After state: |
| 249 |
# ------------ |
| 250 |
# |
| 251 |
# sonic# show running-configuration | grep "ip ssh client" |
| 252 |
# ip ssh client ciphers aes192-ctr,[email protected] |
| 253 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 254 |
# ip ssh client macs [email protected],[email protected] |
| 255 |
# sonic# |
| 256 |
|
| 257 |
|
| 258 |
# Using "replaced" state |
| 259 |
# |
| 260 |
# Before state: |
| 261 |
# ------------- |
| 262 |
# |
| 263 |
# sonic# show running-configuration | grep "ip ssh client" |
| 264 |
# ip ssh client ciphers aes192-ctr,[email protected] |
| 265 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 266 |
# ip ssh client macs [email protected],[email protected] |
| 267 |
# sonic# |
| 268 |
|
| 269 |
- name: Modify SSH configurations |
| 270 |
dellemc.enterprise_sonic.sonic_ssh: |
| 271 |
config: |
| 272 |
client: |
| 273 |
cipher: 'aes256-ctr' |
| 274 |
kex: 'curve25519-sha256,diffie-hellman-group16-sha512' |
| 275 |
state: replaced |
| 276 |
|
| 277 |
# After state: |
| 278 |
# ------------ |
| 279 |
# |
| 280 |
# sonic# show running-configuration | grep "ip ssh client" |
| 281 |
# ip ssh client ciphers aes256-ctr |
| 282 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 283 |
# sonic# |
| 284 |
|
| 285 |
|
| 286 |
# Using "overridden" state |
| 287 |
# |
| 288 |
# Before state: |
| 289 |
# ------------- |
| 290 |
# |
| 291 |
# sonic# show running-configuration | grep "ip ssh client" |
| 292 |
# ip ssh client ciphers aes192-ctr,[email protected] |
| 293 |
# ip ssh client kexalgorithms curve25519-sha256,diffie-hellman-group16-sha512 |
| 294 |
# ip ssh client macs [email protected],[email protected] |
| 295 |
# sonic# |
| 296 |
|
| 297 |
- name: Modify SSH configurations |
| 298 |
dellemc.enterprise_sonic.sonic_ssh: |
| 299 |
config: |
| 300 |
client: |
| 301 |
cipher: 'aes256-ctr' |
| 302 |
mac: '[email protected],[email protected]' |
| 303 |
state: overridden |
| 304 |
|
| 305 |
# After state: |
| 306 |
# ------------ |
| 307 |
# |
| 308 |
# sonic# show running-configuration | grep "ip ssh client" |
| 309 |
# ip ssh client ciphers aes256-ctr |
| 310 |
# ip ssh client macs [email protected],[email protected] |
| 311 |
# sonic# |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
Return Values |
| 316 |
------------- |
| 317 |
Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: |
| 318 |
|
| 319 |
.. raw:: html |
| 320 |
|
| 321 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 322 |
<tr> |
| 323 |
<th colspan="1">Key</th> |
| 324 |
<th>Returned</th> |
| 325 |
<th width="100%">Description</th> |
| 326 |
</tr> |
| 327 |
<tr> |
| 328 |
<td colspan="1"> |
| 329 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 330 |
<b>after</b> |
| 331 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 332 |
<div style="font-size: small"> |
| 333 |
<span style="color: purple">dictionary</span> |
| 334 |
</div> |
| 335 |
</td> |
| 336 |
<td>when changed</td> |
| 337 |
<td> |
| 338 |
<div>The resulting configuration model invocation.</div> |
| 339 |
<br/> |
| 340 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 341 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format |
| 342 |
as the parameters above.</div> |
| 343 |
</td> |
| 344 |
</tr> |
| 345 |
<tr> |
| 346 |
<td colspan="1"> |
| 347 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 348 |
<b>after_generated</b> |
| 349 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 350 |
<div style="font-size: small"> |
| 351 |
<span style="color: purple">dictionary</span> |
| 352 |
</div> |
| 353 |
</td> |
| 354 |
<td>when <code>check_mode</code></td> |
| 355 |
<td> |
| 356 |
<div>The generated configuration from module invocation.</div> |
| 357 |
<br/> |
| 358 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 359 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format |
| 360 |
as the parameters above.</div> |
| 361 |
</td> |
| 362 |
</tr> |
| 363 |
<tr> |
| 364 |
<td colspan="1"> |
| 365 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 366 |
<b>before</b> |
| 367 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 368 |
<div style="font-size: small"> |
| 369 |
<span style="color: purple">dictionary</span> |
| 370 |
</div> |
| 371 |
</td> |
| 372 |
<td>always</td> |
| 373 |
<td> |
| 374 |
<div>The configuration prior to the model invocation.</div> |
| 375 |
<br/> |
| 376 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 377 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format |
| 378 |
as the parameters above.</div> |
| 379 |
</td> |
| 380 |
</tr> |
| 381 |
<tr> |
| 382 |
<td colspan="1"> |
| 383 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 384 |
<b>commands</b> |
| 385 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 386 |
<div style="font-size: small"> |
| 387 |
<span style="color: purple">list</span> |
| 388 |
</div> |
| 389 |
</td> |
| 390 |
<td>always</td> |
| 391 |
<td> |
| 392 |
<div>The set of commands pushed to the remote device.</div> |
| 393 |
<br/> |
| 394 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 395 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['command 1', 'command 2', 'command 3']</div> |
| 396 |
</td> |
| 397 |
</tr> |
| 398 |
</table> |
| 399 |
<br/><br/> |
| 400 |
|
| 401 |
|
| 402 |
Status |
| 403 |
------ |
| 404 |
|
| 405 |
|
| 406 |
Authors |
| 407 |
~~~~~~~ |
| 408 |
|
| 409 |
- Balasubramaniam Koundappa(@balasubramaniam-k) |