Debian Codegraph @

ansible_collections/cisco/iosxr/platform_guide.rst

raw
1 .. _iosxr_platform_options:
2
3 ***************************************
4 IOS-XR Platform Options
5 ***************************************
6
7 The `Cisco IOS-XR collection <https://galaxy.ansible.com/ui/repo/published/cisco/iosxr>`_ supports multiple connections. This page offers details on how each connection works in Ansible and how to use it.
8
9 .. contents::
10 :local:
11
12 Connections available
13 ================================================================================
14
15 .. table::
16 :class: documentation-table
17
18 ==================== ========================================== ============================================================================================================
19 .. CLI NETCONF
20 only for modules ``iosxr_banner``, ``iosxr_interface``, ``iosxr_logging``, ``iosxr_system``, ``iosxr_user``
21 ==================== ========================================== ============================================================================================================
22 Protocol SSH XML over SSH
23
24 Credentials uses SSH keys / SSH-agent if present uses SSH keys / SSH-agent if present
25 accepts ``-u myuser -k`` if using password accepts ``-u myuser -k`` if using password
26
27 Indirect Access by a bastion (jump host) by a bastion (jump host)
28
29 Connection Settings ``ansible_connection:`` ``ansible_connection:``
30 ``ansible.netcommon.network_cli`` ``ansible.netcommon.netconf``
31
32 Enable Mode not supported not supported
33 (Privilege Escalation)
34
35 Returned Data Format Refer to individual module documentation Refer to individual module documentation
36 ==================== ========================================== ============================================================================================================
37
38
39 The ``ansible_connection: local`` has been deprecated. Please use ``ansible_connection: ansible.netcommon.network_cli`` or ``ansible_connection: ansible.netcommon.netconf`` instead.
40
41 Using CLI in Ansible
42 ====================
43
44 Example CLI inventory ``[iosxr:vars]``
45 ----------------------------------------
46
47 .. code-block:: yaml
48
49 [iosxr:vars]
50 ansible_connection=ansible.netcommon.network_cli
51 ansible_network_os=cisco.iosxr.iosxr
52 ansible_user=myuser
53 ansible_password=!vault...
54 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q bastion01"'
55
56 - If you are using SSH keys (including an ssh-agent) you can remove the ``ansible_password`` configuration.
57 - If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration.
58 - 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.
59
60 Example CLI task
61 ----------------
62
63 .. code-block:: yaml
64
65 - name: Retrieve IOS-XR version
66 cisco.iosxr.iosxr_command:
67 commands: show version
68 when: ansible_network_os == 'cisco.iosxr.iosxr'
69
70 Using NETCONF in Ansible
71 ==========================
72
73 Enabling NETCONF
74 ---------------
75
76 Before you can use NETCONF to connect to a switch, you must:
77
78 - install the ``ncclient`` python package on your control node(s) with ``pip install ncclient``
79 - enable NETCONF on the Cisco IOS-XR device(s)
80
81 To enable NETCONF on a new switch with Ansible, use the ``cisco.iosxr.iosxr_netconf`` module through the CLI connection. Set up your platform-level variables just like in the CLI example above, then run a playbook task like this:
82
83 .. code-block:: yaml
84
85 - name: Enable NETCONF
86 connection: ansible.netcommon.network_cli
87 cisco.iosxr.iosxr_netconf:
88 when: ansible_network_os == 'cisco.iosxr.iosxr'
89
90 Once NETCONF is enabled, change your variables to use the NETCONF connection.
91
92 Example NETCONF inventory ``[iosxr:vars]``
93 ------------------------------------------
94
95 .. code-block:: yaml
96
97 [iosxr:vars]
98 ansible_connection=ansible.netcommon.netconf
99 ansible_network_os=cisco.iosxr.iosxr
100 ansible_user=myuser
101 ansible_password=!vault |
102 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q bastion01"'
103
104
105 Example NETCONF task
106 -----------------------
107
108 .. code-block:: yaml
109
110 - name: Configure hostname and domain-name
111 cisco.iosxr.iosxr_system:
112 hostname: iosxr01
113 domain_name: test.example.com
114 domain_search:
115 - ansible.com
116 - redhat.com
117 - cisco.com
118
119
120 Warning
121 --------
122 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.
123
124 Cisco IOS-XR platform support matrix
125 ===================================
126
127 The following platforms and software versions have been certified by Cisco to work with this version of Ansible.
128
129 .. table:: Platform / Software Minimum Requirements
130 :align: center
131
132 =================== ======================
133 Supported Platforms Minimum IOS-XR Version
134 =================== ======================
135 Cisco IOS-XR 7.0.2 and later
136 =================== ======================
137
138
139 Notes
140 -----
141
142 `Setting Timeout Option <https://docs.ansible.com/ansible/latest/network/getting_started/network_connection_options.html#timeout-options>`_