| 1 |
.. _ios_platform_options: |
| 2 |
|
| 3 |
*************************************** |
| 4 |
IOS Platform Options |
| 5 |
*************************************** |
| 6 |
|
| 7 |
The `Cisco IOS <https://galaxy.ansible.com/ui/repo/published/cisco/ios>`_ collection supports Enable Mode (Privilege Escalation). This page offers details on how to use Enable Mode on IOS in Ansible. |
| 8 |
|
| 9 |
.. contents:: |
| 10 |
:local: |
| 11 |
|
| 12 |
Connections available |
| 13 |
================================================================================ |
| 14 |
|
| 15 |
.. table:: |
| 16 |
:class: documentation-table |
| 17 |
|
| 18 |
==================== ========================================== |
| 19 |
.. CLI |
| 20 |
==================== ========================================== |
| 21 |
Protocol SSH |
| 22 |
|
| 23 |
Credentials uses SSH keys / SSH-agent if present |
| 24 |
|
| 25 |
accepts ``-u myuser -k`` if using password |
| 26 |
|
| 27 |
Indirect Access by a bastion (jump host) |
| 28 |
|
| 29 |
Connection Settings ``ansible_connection: ansible.netcommon.network_cli`` |
| 30 |
|
| 31 |
Enable_mode supported: use ``ansible_become: true`` with |
| 32 |
``ansible_become_method: enable`` and ``ansible_become_password:`` |
| 33 |
|
| 34 |
Returned Data Format ``stdout[0].`` |
| 35 |
==================== ========================================== |
| 36 |
|
| 37 |
The ``ansible_connection: local`` has been deprecated. Please use ``ansible_connection: ansible.netcommon.network_cli`` instead. |
| 38 |
|
| 39 |
Using CLI in Ansible |
| 40 |
==================== |
| 41 |
|
| 42 |
Example CLI ``group_vars/ios.yml`` |
| 43 |
---------------------------------- |
| 44 |
|
| 45 |
.. code-block:: yaml |
| 46 |
|
| 47 |
ansible_connection: ansible.netcommon.network_cli |
| 48 |
ansible_network_os: cisco.ios.ios |
| 49 |
ansible_user: myuser |
| 50 |
ansible_password: !vault... |
| 51 |
ansible_become: true |
| 52 |
ansible_become_method: enable |
| 53 |
ansible_become_password: !vault... |
| 54 |
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"' |
| 55 |
|
| 56 |
|
| 57 |
- If you are using SSH keys (including an ssh-agent) you can remove the ``ansible_password`` configuration. |
| 58 |
- If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration. |
| 59 |
- If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the ``ProxyCommand`` directive. To prevent secrets from leaking out (for example in ``ps`` output), SSH does not support providing passwords through environment variables. |
| 60 |
|
| 61 |
Example CLI task |
| 62 |
---------------- |
| 63 |
|
| 64 |
.. code-block:: yaml |
| 65 |
|
| 66 |
- name: Backup current switch config (ios) |
| 67 |
cisco.ios.ios_config: |
| 68 |
backup: yes |
| 69 |
register: backup_ios_location |
| 70 |
when: ansible_network_os == 'cisco.ios.ios' |
| 71 |
|
| 72 |
Warning |
| 73 |
-------- |
| 74 |
Never store passwords in plain text. We recommend using SSH keys to authenticate SSH connections. Ansible supports ssh-agent to manage your SSH keys. If you must use passwords to authenticate SSH connections, we recommend encrypting them with Ansible Vault. |
| 75 |
|
| 76 |
Cisco IOS-XE platform support matrix |
| 77 |
=================================== |
| 78 |
|
| 79 |
The following platforms and software versions have been certified by Cisco to work with this version of Ansible. |
| 80 |
|
| 81 |
.. table:: Platform / Software Minimum Requirements |
| 82 |
:align: center |
| 83 |
|
| 84 |
=================== ===================== |
| 85 |
Supported Platforms Minimum IOS-XE Version |
| 86 |
=================== ===================== |
| 87 |
Cisco IOS-XE 9000 17.03.2 and later |
| 88 |
Cisco IOS-XE 8000 17.03.6 and later |
| 89 |
=================== ===================== |
| 90 |
|
| 91 |
Notes |
| 92 |
----- |
| 93 |
|
| 94 |
`Setting Timeout Option <https://docs.ansible.com/ansible/latest/network/getting_started/network_connection_options.html#timeout-options>`_ |