|
1 | 1 | .. ...............................................................................
|
2 |
| -.. © Copyright IBM Corporation 2020 . |
| 2 | +.. © Copyright IBM Corporation 2020,2023 . |
3 | 3 | .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) .
|
4 | 4 | .. ...............................................................................
|
5 | 5 |
|
@@ -173,6 +173,40 @@ The included sample variables file (all.yml) looks like this:
|
173 | 173 |
|
174 | 174 |
|
175 | 175 |
|
| 176 | +Module Defaults |
| 177 | +--------------- |
| 178 | + |
| 179 | +Ansible has a module defaults feature to use the same values during every use of |
| 180 | +a task, rather than repeating the values. Here we can set the host url and |
| 181 | +credentials of the **cmci_get** task to be the same throughout the playbook. |
| 182 | + |
| 183 | +.. code-block:: yaml |
| 184 | + module_defaults: |
| 185 | + ibm.ibm_zos_cics.cmci_get: |
| 186 | + cmci_host: "{{ cmci_host }}" |
| 187 | + cmci_user: "{{ cmci_user }}" |
| 188 | + cmci_password: "{{ cmci_password }}" |
| 189 | +
|
| 190 | +
|
| 191 | +If you wish to use the same values in **all** CMCI tasks, you can assign them |
| 192 | +to the group called **cmci_group**. |
| 193 | + |
| 194 | +.. code-block:: yaml |
| 195 | +
|
| 196 | + module_defaults: |
| 197 | + group/ibm.ibm_zos_cics.cmci_group: |
| 198 | + cmci_host: "my.system.host" |
| 199 | + cmci_port: "system.port.number" |
| 200 | + cmci_user: "my.username" |
| 201 | + cmci_password: "my.password" |
| 202 | +
|
| 203 | +.. note:: |
| 204 | + Group module defaults are only available in ``ansible-core`` 2.12 or later. If |
| 205 | + this syntax is used with ``ansible-core`` 2.11 or earlier, the values are |
| 206 | + perceived as not present, and a 'missing required arguments' error is thrown. |
| 207 | + |
| 208 | + |
| 209 | + |
176 | 210 | Run the playbook
|
177 | 211 | ----------------
|
178 | 212 |
|
|
0 commit comments