Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst

raw
1 .. _cisco.iosxr.iosxr_cliconf:
2
3
4 *****************
5 cisco.iosxr.iosxr
6 *****************
7
8 **Use iosxr cliconf to run command on Cisco IOS XR platform**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This iosxr plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS XR network devices.
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="1">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th>Configuration</th>
35 <th width="100%">Comments</th>
36 </tr>
37 <tr>
38 <td colspan="1">
39 <div class="ansibleOptionAnchor" id="parameter-"></div>
40 <b>commit_comment</b>
41 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
42 <div style="font-size: small">
43 <span style="color: purple">string</span>
44 </div>
45 </td>
46 <td>
47 </td>
48 <td>
49 <div>env:ANSIBLE_IOSXR_COMMIT_COMMENT</div>
50 <div>var: ansible_iosxr_commit_comment</div>
51 </td>
52 <td>
53 <div>Adds comment to commit confirmed..</div>
54 </td>
55 </tr>
56 <tr>
57 <td colspan="1">
58 <div class="ansibleOptionAnchor" id="parameter-"></div>
59 <b>commit_confirmed</b>
60 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
61 <div style="font-size: small">
62 <span style="color: purple">boolean</span>
63 </div>
64 </td>
65 <td>
66 <b>Default:</b><br/><div style="color: blue">"no"</div>
67 </td>
68 <td>
69 <div>env:ANSIBLE_IOSXR_COMMIT_CONFIRMED</div>
70 <div>var: ansible_iosxr_commit_confirmed</div>
71 </td>
72 <td>
73 <div>enable or disable commit confirmed mode</div>
74 </td>
75 </tr>
76 <tr>
77 <td colspan="1">
78 <div class="ansibleOptionAnchor" id="parameter-"></div>
79 <b>commit_confirmed_timeout</b>
80 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
81 <div style="font-size: small">
82 <span style="color: purple">integer</span>
83 </div>
84 </td>
85 <td>
86 </td>
87 <td>
88 <div>env:ANSIBLE_IOSXR_COMMIT_CONFIRMED_TIMEOUT</div>
89 <div>var: ansible_iosxr_commit_confirmed_timeout</div>
90 </td>
91 <td>
92 <div>Commits the configuration on a trial basis for the time specified in seconds or minutes.</div>
93 </td>
94 </tr>
95 <tr>
96 <td colspan="1">
97 <div class="ansibleOptionAnchor" id="parameter-"></div>
98 <b>commit_label</b>
99 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
100 <div style="font-size: small">
101 <span style="color: purple">string</span>
102 </div>
103 </td>
104 <td>
105 </td>
106 <td>
107 <div>env:ANSIBLE_IOSXR_COMMIT_LABEL</div>
108 <div>var: ansible_iosxr_commit_label</div>
109 </td>
110 <td>
111 <div>Adds label to commit confirmed.</div>
112 </td>
113 </tr>
114 <tr>
115 <td colspan="1">
116 <div class="ansibleOptionAnchor" id="parameter-"></div>
117 <b>config_commands</b>
118 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
119 <div style="font-size: small">
120 <span style="color: purple">list</span>
121 / <span style="color: purple">elements=string</span>
122 </div>
123 <div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
124 </td>
125 <td>
126 <b>Default:</b><br/><div style="color: blue">[]</div>
127 </td>
128 <td>
129 <div>var: ansible_iosxr_config_commands</div>
130 </td>
131 <td>
132 <div>Specifies a list of commands that can make configuration changes to the target device.</div>
133 <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>
134 </td>
135 </tr>
136 <tr>
137 <td colspan="1">
138 <div class="ansibleOptionAnchor" id="parameter-"></div>
139 <b>config_mode_exclusive</b>
140 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
141 <div style="font-size: small">
142 <span style="color: purple">boolean</span>
143 </div>
144 </td>
145 <td>
146 <b>Default:</b><br/><div style="color: blue">"no"</div>
147 </td>
148 <td>
149 <div>env:ANSIBLE_IOSXR_CONFIG_MODE_EXCLUSIVE</div>
150 <div>var: ansible_iosxr_config_mode_exclusive</div>
151 </td>
152 <td>
153 <div>enable or disable config mode exclusive</div>
154 </td>
155 </tr>
156 </table>
157 <br/>
158
159
160 Notes
161 -----
162
163 .. note::
164 - 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.
165
166
167
168 Examples
169 --------
170
171 .. code-block:: yaml
172
173 # Use commit confirmed within a task with timeout, label and comment
174
175 - name: Commit confirmed with a task
176 vars:
177 ansible_iosxr_commit_confirmed: True
178 ansible_iosxr_commit_confirmed_timeout: 50
179 ansible_iosxr_commit_label: TestLabel
180 ansible_iosxr_commit_comment: I am a test comment
181 cisco.iosxr.iosxr_logging_global:
182 state: merged
183 config:
184 buffered:
185 severity: errors #alerts #informational
186 correlator:
187 buffer_size: 2024
188
189 # Commands (cliconf specific)
190 # ["commit confirmed 50 label TestLabel comment I am a test comment"]
191
192 # Use commit within a task with label
193
194 - name: Commit label with a task
195 vars:
196 ansible_iosxr_commit_label: lblTest
197 cisco.iosxr.iosxr_hostname:
198 state: merged
199 config:
200 hostname: R1
201
202 # Commands (cliconf specific)
203 # ["commit label lblt1"]
204
205 # Use commit confirm with timeout and confirm the commit
206
207 # NOTE - IOSXR waits for a `commit` when the command
208 # executed is `commit confirmed <timeout>` within the timeout
209 # period for the config to commit successfully, else a rollback
210 # happens.
211
212 - name: Example commit confirmed
213 vars:
214 ansible_iosxr_commit_confirmed: True
215 ansible_iosxr_commit_confirmed_timeout: 60
216 tasks:
217 - name: "Commit confirmed with timeout"
218 cisco.iosxr.iosxr_hostname:
219 state: merged
220 config:
221 hostname: R1
222
223 - name: "Confirm the Commit"
224 cisco.iosxr.iosxr_command:
225 commands:
226 - commit
227
228 # Commands (cliconf specific)
229 # ["commit confirmed 60"]
230
231 # Use exclusive mode with a task
232
233 - name: Configure exclusive mode with a task
234 vars:
235 ansible_iosxr_config_mode_exclusive: True
236 cisco.iosxr.iosxr_interfaces:
237 state: merged
238 config:
239 - name: GigabitEthernet0/0/0/2
240 description: Configured via Ansible
241 - name: GigabitEthernet0/0/0/3
242 description: Configured via Ansible
243
244 # Commands (cliconf specific)
245 # ["configure exclusive"]
246
247 # Use Replace option with commit confirmed
248
249 # NOTE - IOSXR waits for a `commit` when the command
250 # executed is `commit replace confirmed <timeout>` within the timeout
251 # period for the config to commit successfully, else a rollback
252 # happens.
253 # This option is supported by only iosxr_config module
254
255 - name: Example replace config with commit confirmed
256 vars:
257 ansible_iosxr_commit_confirmed: True
258 ansible_iosxr_commit_confirmed_timeout: 60
259 tasks:
260 - name: "Replace config with Commit confirmed"
261 cisco.iosxr.iosxr_config:
262 src: 'replace_running_cfg_iosxr.txt'
263 replace: config
264
265 - name: "Confirm the Commit"
266 cisco.iosxr.iosxr_command:
267 commands:
268 - commit
269
270
271
272
273 Status
274 ------
275
276
277 Authors
278 ~~~~~~~
279
280 - Ansible Networking Team (@ansible-network)
281
282
283 .. hint::
284 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.