summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst
blob: 27d2f1dc747aefca4d483022bb9c0e978c653fe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
.. _cisco.iosxr.iosxr_cliconf:


*****************
cisco.iosxr.iosxr
*****************

**Use iosxr cliconf to run command on Cisco IOS XR platform**


Version added: 1.0.0

.. contents::
   :local:
   :depth: 1


Synopsis
--------
- This iosxr plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS XR network devices.




Parameters
----------

.. raw:: html

    <table  border=0 cellpadding=0 class="documentation-table">
        <tr>
            <th colspan="1">Parameter</th>
            <th>Choices/<font color="blue">Defaults</font></th>
                <th>Configuration</th>
            <th width="100%">Comments</th>
        </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>commit_comment</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                    </div>
                </td>
                <td>
                </td>
                    <td>
                                <div>env:ANSIBLE_IOSXR_COMMIT_COMMENT</div>
                                <div>var: ansible_iosxr_commit_comment</div>
                    </td>
                <td>
                        <div>Adds comment to commit confirmed..</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>commit_confirmed</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">boolean</span>
                    </div>
                </td>
                <td>
                        <b>Default:</b><br/><div style="color: blue">"no"</div>
                </td>
                    <td>
                                <div>env:ANSIBLE_IOSXR_COMMIT_CONFIRMED</div>
                                <div>var: ansible_iosxr_commit_confirmed</div>
                    </td>
                <td>
                        <div>enable or disable commit confirmed mode</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>commit_confirmed_timeout</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">integer</span>
                    </div>
                </td>
                <td>
                </td>
                    <td>
                                <div>env:ANSIBLE_IOSXR_COMMIT_CONFIRMED_TIMEOUT</div>
                                <div>var: ansible_iosxr_commit_confirmed_timeout</div>
                    </td>
                <td>
                        <div>Commits the configuration on a trial basis for the time specified in seconds or minutes.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>commit_label</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">string</span>
                    </div>
                </td>
                <td>
                </td>
                    <td>
                                <div>env:ANSIBLE_IOSXR_COMMIT_LABEL</div>
                                <div>var: ansible_iosxr_commit_label</div>
                    </td>
                <td>
                        <div>Adds label to commit confirmed.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>config_commands</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">list</span>
                         / <span style="color: purple">elements=string</span>
                    </div>
                    <div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
                </td>
                <td>
                        <b>Default:</b><br/><div style="color: blue">[]</div>
                </td>
                    <td>
                                <div>var: ansible_iosxr_config_commands</div>
                    </td>
                <td>
                        <div>Specifies a list of commands that can make configuration changes to the target device.</div>
                        <div>When `ansible_network_single_user_mode` is enabled, if a command sent to the device is present in this list, the existing cache is invalidated.</div>
                </td>
            </tr>
            <tr>
                <td colspan="1">
                    <div class="ansibleOptionAnchor" id="parameter-"></div>
                    <b>config_mode_exclusive</b>
                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
                    <div style="font-size: small">
                        <span style="color: purple">boolean</span>
                    </div>
                </td>
                <td>
                        <b>Default:</b><br/><div style="color: blue">"no"</div>
                </td>
                    <td>
                                <div>env:ANSIBLE_IOSXR_CONFIG_MODE_EXCLUSIVE</div>
                                <div>var: ansible_iosxr_config_mode_exclusive</div>
                    </td>
                <td>
                        <div>enable or disable config mode exclusive</div>
                </td>
            </tr>
    </table>
    <br/>


Notes
-----

.. note::
   - IOSXR commit confirmed command varies with IOSXR version releases, commit_comment and commit_label may or may not be valid together as per the device version.



Examples
--------

.. code-block:: yaml

    # Use commit confirmed within a task with timeout, label and comment

    - name: Commit confirmed with a task
      vars:
        ansible_iosxr_commit_confirmed: True
        ansible_iosxr_commit_confirmed_timeout: 50
        ansible_iosxr_commit_label: TestLabel
        ansible_iosxr_commit_comment: I am a test comment
      cisco.iosxr.iosxr_logging_global:
        state: merged
        config:
          buffered:
            severity: errors #alerts #informational
          correlator:
            buffer_size: 2024

    # Commands (cliconf specific)
    # ["commit confirmed 50 label TestLabel comment I am a test comment"]

    # Use commit within a task with label

    - name: Commit label with a task
      vars:
        ansible_iosxr_commit_label: lblTest
      cisco.iosxr.iosxr_hostname:
        state: merged
        config:
          hostname: R1

    # Commands (cliconf specific)
    # ["commit label lblt1"]

    # Use commit confirm with timeout and confirm the commit

    # NOTE - IOSXR waits for a `commit` when the command
    # executed is `commit confirmed <timeout>` within the timeout
    # period for the config to commit successfully, else a rollback
    # happens.

    - name: Example commit confirmed
      vars:
        ansible_iosxr_commit_confirmed: True
        ansible_iosxr_commit_confirmed_timeout: 60
      tasks:
        - name: "Commit confirmed with timeout"
          cisco.iosxr.iosxr_hostname:
            state: merged
            config:
              hostname: R1

        - name: "Confirm the Commit"
          cisco.iosxr.iosxr_command:
            commands:
              - commit

    # Commands (cliconf specific)
    # ["commit confirmed 60"]

    # Use exclusive mode with a task

    - name: Configure exclusive mode with a task
      vars:
        ansible_iosxr_config_mode_exclusive: True
      cisco.iosxr.iosxr_interfaces:
        state: merged
        config:
          - name: GigabitEthernet0/0/0/2
            description: Configured via Ansible
          - name: GigabitEthernet0/0/0/3
            description: Configured via Ansible

    # Commands (cliconf specific)
    # ["configure exclusive"]

    # Use Replace option with commit confirmed

    # NOTE - IOSXR waits for a `commit` when the command
    # executed is `commit replace confirmed <timeout>` within the timeout
    # period for the config to commit successfully, else a rollback
    # happens.
    # This option is supported by only iosxr_config module

    - name: Example replace config with commit confirmed
      vars:
        ansible_iosxr_commit_confirmed: True
        ansible_iosxr_commit_confirmed_timeout: 60
      tasks:
        - name: "Replace config with Commit confirmed"
          cisco.iosxr.iosxr_config:
            src: 'replace_running_cfg_iosxr.txt'
            replace: config

        - name: "Confirm the Commit"
          cisco.iosxr.iosxr_command:
            commands:
              - commit




Status
------


Authors
~~~~~~~

- Ansible Networking Team (@ansible-network)


.. hint::
    Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.