| 1 |
.. _community.okd.openshift_inventory: |
| 2 |
|
| 3 |
|
| 4 |
*********************** |
| 5 |
community.okd.openshift |
| 6 |
*********************** |
| 7 |
|
| 8 |
**OpenShift inventory source** |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
.. contents:: |
| 13 |
:local: |
| 14 |
:depth: 1 |
| 15 |
|
| 16 |
DEPRECATED |
| 17 |
---------- |
| 18 |
:Removed in collection release after |
| 19 |
:Why: As discussed in https://github.com/ansible-collections/kubernetes.core/issues/31, we decided to |
| 20 |
remove the openshift inventory plugin in release 5.0.0. |
| 21 |
|
| 22 |
:Alternative: Use :ref:`kubernetes.core.k8s_info <kubernetes.core.k8s_info_module>` and :ref:`ansible.builtin.add_host <ansible.builtin.add_host_module>` instead. |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
Synopsis |
| 27 |
-------- |
| 28 |
- Fetch containers, services and routes for one or more clusters |
| 29 |
- Groups by cluster name, namespace, namespace_services, namespace_pods, namespace_routes, and labels |
| 30 |
- Uses openshift.(yml|yaml) YAML configuration file to set parameter values. |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
Requirements |
| 35 |
------------ |
| 36 |
The below requirements are needed on the local Ansible controller node that executes this inventory. |
| 37 |
|
| 38 |
- python >= 3.6 |
| 39 |
- kubernetes >= 12.0.0 |
| 40 |
- PyYAML >= 3.11 |
| 41 |
|
| 42 |
|
| 43 |
Parameters |
| 44 |
---------- |
| 45 |
|
| 46 |
.. raw:: html |
| 47 |
|
| 48 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 49 |
<tr> |
| 50 |
<th colspan="2">Parameter</th> |
| 51 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 52 |
<th>Configuration</th> |
| 53 |
<th width="100%">Comments</th> |
| 54 |
</tr> |
| 55 |
<tr> |
| 56 |
<td colspan="2"> |
| 57 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 58 |
<b>connections</b> |
| 59 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 60 |
<div style="font-size: small"> |
| 61 |
<span style="color: purple">-</span> |
| 62 |
</div> |
| 63 |
</td> |
| 64 |
<td> |
| 65 |
</td> |
| 66 |
<td> |
| 67 |
</td> |
| 68 |
<td> |
| 69 |
<div>Optional list of cluster connection settings. If no connections are provided, the default <em>~/.kube/config</em> and active context will be used, and objects will be returned for all namespaces the active user is authorized to access.</div> |
| 70 |
</td> |
| 71 |
</tr> |
| 72 |
<tr> |
| 73 |
<td class="elbow-placeholder"></td> |
| 74 |
<td colspan="1"> |
| 75 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 76 |
<b>api_key</b> |
| 77 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 78 |
<div style="font-size: small"> |
| 79 |
<span style="color: purple">-</span> |
| 80 |
</div> |
| 81 |
</td> |
| 82 |
<td> |
| 83 |
</td> |
| 84 |
<td> |
| 85 |
</td> |
| 86 |
<td> |
| 87 |
<div>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div> |
| 88 |
</td> |
| 89 |
</tr> |
| 90 |
<tr> |
| 91 |
<td class="elbow-placeholder"></td> |
| 92 |
<td colspan="1"> |
| 93 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 94 |
<b>ca_cert</b> |
| 95 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 96 |
<div style="font-size: small"> |
| 97 |
<span style="color: purple">-</span> |
| 98 |
</div> |
| 99 |
</td> |
| 100 |
<td> |
| 101 |
</td> |
| 102 |
<td> |
| 103 |
</td> |
| 104 |
<td> |
| 105 |
<div>Path to a CA certificate used to authenticate with the API. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div> |
| 106 |
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td class="elbow-placeholder"></td> |
| 111 |
<td colspan="1"> |
| 112 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 113 |
<b>client_cert</b> |
| 114 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 115 |
<div style="font-size: small"> |
| 116 |
<span style="color: purple">-</span> |
| 117 |
</div> |
| 118 |
</td> |
| 119 |
<td> |
| 120 |
</td> |
| 121 |
<td> |
| 122 |
</td> |
| 123 |
<td> |
| 124 |
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div> |
| 125 |
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div> |
| 126 |
</td> |
| 127 |
</tr> |
| 128 |
<tr> |
| 129 |
<td class="elbow-placeholder"></td> |
| 130 |
<td colspan="1"> |
| 131 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 132 |
<b>client_key</b> |
| 133 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 134 |
<div style="font-size: small"> |
| 135 |
<span style="color: purple">-</span> |
| 136 |
</div> |
| 137 |
</td> |
| 138 |
<td> |
| 139 |
</td> |
| 140 |
<td> |
| 141 |
</td> |
| 142 |
<td> |
| 143 |
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div> |
| 144 |
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div> |
| 145 |
</td> |
| 146 |
</tr> |
| 147 |
<tr> |
| 148 |
<td class="elbow-placeholder"></td> |
| 149 |
<td colspan="1"> |
| 150 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 151 |
<b>context</b> |
| 152 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 153 |
<div style="font-size: small"> |
| 154 |
<span style="color: purple">-</span> |
| 155 |
</div> |
| 156 |
</td> |
| 157 |
<td> |
| 158 |
</td> |
| 159 |
<td> |
| 160 |
</td> |
| 161 |
<td> |
| 162 |
<div>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div> |
| 163 |
</td> |
| 164 |
</tr> |
| 165 |
<tr> |
| 166 |
<td class="elbow-placeholder"></td> |
| 167 |
<td colspan="1"> |
| 168 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 169 |
<b>host</b> |
| 170 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 171 |
<div style="font-size: small"> |
| 172 |
<span style="color: purple">-</span> |
| 173 |
</div> |
| 174 |
</td> |
| 175 |
<td> |
| 176 |
</td> |
| 177 |
<td> |
| 178 |
</td> |
| 179 |
<td> |
| 180 |
<div>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div> |
| 181 |
</td> |
| 182 |
</tr> |
| 183 |
<tr> |
| 184 |
<td class="elbow-placeholder"></td> |
| 185 |
<td colspan="1"> |
| 186 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 187 |
<b>kubeconfig</b> |
| 188 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 189 |
<div style="font-size: small"> |
| 190 |
<span style="color: purple">-</span> |
| 191 |
</div> |
| 192 |
</td> |
| 193 |
<td> |
| 194 |
</td> |
| 195 |
<td> |
| 196 |
</td> |
| 197 |
<td> |
| 198 |
<div>Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div> |
| 199 |
</td> |
| 200 |
</tr> |
| 201 |
<tr> |
| 202 |
<td class="elbow-placeholder"></td> |
| 203 |
<td colspan="1"> |
| 204 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 205 |
<b>name</b> |
| 206 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 207 |
<div style="font-size: small"> |
| 208 |
<span style="color: purple">-</span> |
| 209 |
</div> |
| 210 |
</td> |
| 211 |
<td> |
| 212 |
</td> |
| 213 |
<td> |
| 214 |
</td> |
| 215 |
<td> |
| 216 |
<div>Optional name to assign to the cluster. If not provided, a name is constructed from the server and port.</div> |
| 217 |
</td> |
| 218 |
</tr> |
| 219 |
<tr> |
| 220 |
<td class="elbow-placeholder"></td> |
| 221 |
<td colspan="1"> |
| 222 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 223 |
<b>namespaces</b> |
| 224 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 225 |
<div style="font-size: small"> |
| 226 |
<span style="color: purple">-</span> |
| 227 |
</div> |
| 228 |
</td> |
| 229 |
<td> |
| 230 |
</td> |
| 231 |
<td> |
| 232 |
</td> |
| 233 |
<td> |
| 234 |
<div>List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized to access.</div> |
| 235 |
</td> |
| 236 |
</tr> |
| 237 |
<tr> |
| 238 |
<td class="elbow-placeholder"></td> |
| 239 |
<td colspan="1"> |
| 240 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 241 |
<b>password</b> |
| 242 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 243 |
<div style="font-size: small"> |
| 244 |
<span style="color: purple">-</span> |
| 245 |
</div> |
| 246 |
</td> |
| 247 |
<td> |
| 248 |
</td> |
| 249 |
<td> |
| 250 |
</td> |
| 251 |
<td> |
| 252 |
<div>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div> |
| 253 |
</td> |
| 254 |
</tr> |
| 255 |
<tr> |
| 256 |
<td class="elbow-placeholder"></td> |
| 257 |
<td colspan="1"> |
| 258 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 259 |
<b>username</b> |
| 260 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 261 |
<div style="font-size: small"> |
| 262 |
<span style="color: purple">-</span> |
| 263 |
</div> |
| 264 |
</td> |
| 265 |
<td> |
| 266 |
</td> |
| 267 |
<td> |
| 268 |
</td> |
| 269 |
<td> |
| 270 |
<div>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div> |
| 271 |
</td> |
| 272 |
</tr> |
| 273 |
<tr> |
| 274 |
<td class="elbow-placeholder"></td> |
| 275 |
<td colspan="1"> |
| 276 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 277 |
<b>validate_certs</b> |
| 278 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 279 |
<div style="font-size: small"> |
| 280 |
<span style="color: purple">boolean</span> |
| 281 |
</div> |
| 282 |
</td> |
| 283 |
<td> |
| 284 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 285 |
<li>no</li> |
| 286 |
<li>yes</li> |
| 287 |
</ul> |
| 288 |
</td> |
| 289 |
<td> |
| 290 |
</td> |
| 291 |
<td> |
| 292 |
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div> |
| 293 |
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div> |
| 294 |
</td> |
| 295 |
</tr> |
| 296 |
|
| 297 |
<tr> |
| 298 |
<td colspan="2"> |
| 299 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 300 |
<b>plugin</b> |
| 301 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 302 |
<div style="font-size: small"> |
| 303 |
<span style="color: purple">-</span> |
| 304 |
/ <span style="color: red">required</span> |
| 305 |
</div> |
| 306 |
</td> |
| 307 |
<td> |
| 308 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 309 |
<li>openshift</li> |
| 310 |
<li>community.okd.openshift</li> |
| 311 |
</ul> |
| 312 |
</td> |
| 313 |
<td> |
| 314 |
</td> |
| 315 |
<td> |
| 316 |
<div>token that ensures this is a source file for the 'openshift' plugin.</div> |
| 317 |
</td> |
| 318 |
</tr> |
| 319 |
</table> |
| 320 |
<br/> |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
Examples |
| 326 |
-------- |
| 327 |
|
| 328 |
.. code-block:: yaml |
| 329 |
|
| 330 |
# File must be named openshift.yaml or openshift.yml |
| 331 |
|
| 332 |
- name: Authenticate with token, and return all pods and services for all namespaces |
| 333 |
plugin: community.okd.openshift |
| 334 |
connections: |
| 335 |
- host: https://192.168.64.4:8443 |
| 336 |
api_key: xxxxxxxxxxxxxxxx |
| 337 |
verify_ssl: false |
| 338 |
|
| 339 |
- name: Use default config (~/.kube/config) file and active context, and return objects for a specific namespace |
| 340 |
plugin: community.okd.openshift |
| 341 |
connections: |
| 342 |
- namespaces: |
| 343 |
- testing |
| 344 |
|
| 345 |
- name: Use a custom config file, and a specific context. |
| 346 |
plugin: community.okd.openshift |
| 347 |
connections: |
| 348 |
- kubeconfig: /path/to/config |
| 349 |
context: 'awx/192-168-64-4:8443/developer' |
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
Status |
| 355 |
------ |
| 356 |
|
| 357 |
|
| 358 |
- This inventory will be removed in version 5.0.0. *[deprecated]* |
| 359 |
- For more information see `DEPRECATED`_. |
| 360 |
|
| 361 |
|
| 362 |
Authors |
| 363 |
~~~~~~~ |
| 364 |
|
| 365 |
- Chris Houseknecht (@chouseknecht) |
| 366 |
|
| 367 |
|
| 368 |
.. hint:: |
| 369 |
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. |