mirror of
https://github.com/openshift/community.okd.git
synced 2026-11-22 07:00:26 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69a9541f4b | ||
|
|
0b827432a8 | ||
|
|
f94eabffa1 | ||
|
|
499863fa27 | ||
|
|
5834e32c73 | ||
|
|
5aa63e1b07 | ||
|
|
d7f8aa537a | ||
|
|
1691951788 | ||
|
|
ed9fb196f9 | ||
|
|
1819975498 | ||
|
|
01c257ce76 | ||
|
|
5545c0f9ae | ||
|
|
15fff541b1 | ||
|
|
cfbbbb3be1 | ||
|
|
ab83a185f5 | ||
|
|
e69c88ae30 |
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
profile: production
|
||||||
|
exclude_paths:
|
||||||
|
- molecule
|
||||||
|
- tests/sanity
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Changelog
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: Linters
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
jobs:
|
||||||
|
linters:
|
||||||
|
uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
|
||||||
|
ansible-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
|
||||||
|
|
||||||
|
- name: Run ansible-lint
|
||||||
|
uses: ansible/ansible-lint@v6.21.0
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Sanity tests
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sanity:
|
||||||
|
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
|
||||||
|
with:
|
||||||
|
collection_pre_install: '-r source/tests/sanity/requirements.yml'
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Unit tests
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-source:
|
||||||
|
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
|
||||||
@@ -5,6 +5,44 @@ OKD Collection Release Notes
|
|||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
|
||||||
|
v2.3.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- openshift_adm_groups_sync - initialize OpenshiftGroupSync attributes early to avoid Attribute error (https://github.com/openshift/community.okd/issues/155).
|
||||||
|
- openshift_auth - Review the way the discard process is working, add openshift algorithm to convert token to resource object name (https://github.com/openshift/community.okd/issues/176).
|
||||||
|
|
||||||
|
New Modules
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- openshift_adm_prune_builds - Prune old completed and failed builds
|
||||||
|
- openshift_build - Start a new build or Cancel running, pending, or new builds.
|
||||||
|
|
||||||
|
v2.2.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- add action groups to runtime.yml (https://github.com/openshift/community.okd/issues/41).
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- fix ocp auth failing against cluster api url with trailing slash (https://github.com/openshift/community.okd/issues/139)
|
||||||
|
|
||||||
|
New Modules
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- openshift_adm_migrate_template_instances - Update TemplateInstances to point to the latest group-version-kinds
|
||||||
|
- openshift_adm_prune_auth - Removes references to the specified roles, clusterroles, users, and groups
|
||||||
|
- openshift_adm_prune_deployments - Remove old completed and failed deployment configs
|
||||||
|
- openshift_adm_prune_images - Remove unreferenced images
|
||||||
|
- openshift_import_image - Import the latest image information from a tag in a container image registry.
|
||||||
|
- openshift_registry_info - Display information about the integrated registry.
|
||||||
|
|
||||||
v2.1.0
|
v2.1.0
|
||||||
======
|
======
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.PHONY: molecule
|
.PHONY: molecule
|
||||||
|
|
||||||
# Also needs to be updated in galaxy.yml
|
# Also needs to be updated in galaxy.yml
|
||||||
VERSION = 2.1.0
|
VERSION = 2.3.0
|
||||||
|
|
||||||
SANITY_TEST_ARGS ?= --docker --color
|
SANITY_TEST_ARGS ?= --docker --color
|
||||||
UNITS_TEST_ARGS ?= --docker --color
|
UNITS_TEST_ARGS ?= --docker --color
|
||||||
|
|||||||
@@ -12,11 +12,21 @@ The collection includes a variety of Ansible content to help automate the manage
|
|||||||
|
|
||||||
This collection has been tested against following Ansible versions: **>=2.9.17**.
|
This collection has been tested against following Ansible versions: **>=2.9.17**.
|
||||||
|
|
||||||
|
For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
|
||||||
|
fully qualified collection name (for example, `cisco.ios.ios`).
|
||||||
Plugins and modules within a collection may be tested with only specific Ansible versions.
|
Plugins and modules within a collection may be tested with only specific Ansible versions.
|
||||||
A collection may contain metadata that identifies these versions.
|
A collection may contain metadata that identifies these versions.
|
||||||
PEP440 is the schema used to describe the versions of Ansible.
|
PEP440 is the schema used to describe the versions of Ansible.
|
||||||
<!--end requires_ansible-->
|
<!--end requires_ansible-->
|
||||||
|
|
||||||
|
## Python Support
|
||||||
|
|
||||||
|
* Collection supports 3.6+
|
||||||
|
|
||||||
|
## Kubernetes Version Support
|
||||||
|
|
||||||
|
This collection supports Kubernetes versions >=1.19.
|
||||||
|
|
||||||
## Included content
|
## Included content
|
||||||
|
|
||||||
Click on the name of a plugin or module to view that content's documentation:
|
Click on the name of a plugin or module to view that content's documentation:
|
||||||
@@ -25,20 +35,29 @@ Click on the name of a plugin or module to view that content's documentation:
|
|||||||
### Connection plugins
|
### Connection plugins
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[community.okd.oc](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.oc_connection.rst)|Execute tasks in pods running on OpenShift.
|
[community.okd.oc](https://github.com/openshift/community.okd/blob/main/docs/community.okd.oc_connection.rst)|Execute tasks in pods running on OpenShift.
|
||||||
|
|
||||||
### Inventory plugins
|
### Inventory plugins
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[community.okd.openshift](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.openshift_inventory.rst)|OpenShift inventory source
|
[community.okd.openshift](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_inventory.rst)|OpenShift inventory source
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[community.okd.k8s](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.k8s_module.rst)|Manage OpenShift objects
|
[community.okd.k8s](https://github.com/openshift/community.okd/blob/main/docs/community.okd.k8s_module.rst)|Manage OpenShift objects
|
||||||
[community.okd.openshift_auth](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.openshift_auth_module.rst)|Authenticate to OpenShift clusters which require an explicit login step
|
[community.okd.openshift_adm_groups_sync](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_groups_sync_module.rst)|Sync OpenShift Groups with records from an external provider.
|
||||||
[community.okd.openshift_process](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.openshift_process_module.rst)|Process an OpenShift template.openshift.io/v1 Template
|
[community.okd.openshift_adm_migrate_template_instances](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_migrate_template_instances_module.rst)|Update TemplateInstances to point to the latest group-version-kinds
|
||||||
[community.okd.openshift_route](https://github.com/ansible-collections/community.okd/blob/main/docs/community.okd.openshift_route_module.rst)|Expose a Service as an OpenShift Route.
|
[community.okd.openshift_adm_prune_auth](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_prune_auth_module.rst)|Removes references to the specified roles, clusterroles, users, and groups
|
||||||
|
[community.okd.openshift_adm_prune_builds](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_prune_builds_module.rst)|Prune old completed and failed builds
|
||||||
|
[community.okd.openshift_adm_prune_deployments](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_prune_deployments_module.rst)|Remove old completed and failed deployment configs
|
||||||
|
[community.okd.openshift_adm_prune_images](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_adm_prune_images_module.rst)|Remove unreferenced images
|
||||||
|
[community.okd.openshift_auth](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_auth_module.rst)|Authenticate to OpenShift clusters which require an explicit login step
|
||||||
|
[community.okd.openshift_build](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_build_module.rst)|Start a new build or Cancel running, pending, or new builds.
|
||||||
|
[community.okd.openshift_import_image](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_import_image_module.rst)|Import the latest image information from a tag in a container image registry.
|
||||||
|
[community.okd.openshift_process](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_process_module.rst)|Process an OpenShift template.openshift.io/v1 Template
|
||||||
|
[community.okd.openshift_registry_info](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_registry_info_module.rst)|Display information about the integrated registry.
|
||||||
|
[community.okd.openshift_route](https://github.com/openshift/community.okd/blob/main/docs/community.okd.openshift_route_module.rst)|Expose a Service as an OpenShift Route.
|
||||||
|
|
||||||
<!--end collection content-->
|
<!--end collection content-->
|
||||||
|
|
||||||
@@ -58,7 +77,7 @@ You can also include it in a `requirements.yml` file and install it via `ansible
|
|||||||
---
|
---
|
||||||
collections:
|
collections:
|
||||||
- name: community.okd
|
- name: community.okd
|
||||||
version: 2.1.0
|
version: 2.3.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installing the Kubernetes Python Library
|
### Installing the Kubernetes Python Library
|
||||||
@@ -146,6 +165,7 @@ Releases are automatically built and pushed to Ansible Galaxy for any new tag. B
|
|||||||
b. This README's `requirements.yml` example
|
b. This README's `requirements.yml` example
|
||||||
c. The `DOWNSTREAM_VERSION` in `ci/downstream.sh`
|
c. The `DOWNSTREAM_VERSION` in `ci/downstream.sh`
|
||||||
d. The `VERSION` in `Makefile`
|
d. The `VERSION` in `Makefile`
|
||||||
|
e. The version in `requirements.yml`
|
||||||
1. Update the CHANGELOG:
|
1. Update the CHANGELOG:
|
||||||
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
|
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
|
||||||
1. Make sure there are fragments for all known changes in `changelogs/fragments`.
|
1. Make sure there are fragments for all known changes in `changelogs/fragments`.
|
||||||
|
|||||||
@@ -149,3 +149,53 @@ releases:
|
|||||||
- 102-support-turbo-mode.yaml
|
- 102-support-turbo-mode.yaml
|
||||||
- 99-openshift_route-add-support-for-annotations.yml
|
- 99-openshift_route-add-support-for-annotations.yml
|
||||||
release_date: '2021-10-20'
|
release_date: '2021-10-20'
|
||||||
|
2.2.0:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- fix ocp auth failing against cluster api url with trailing slash (https://github.com/openshift/community.okd/issues/139)
|
||||||
|
minor_changes:
|
||||||
|
- add action groups to runtime.yml (https://github.com/openshift/community.okd/issues/41).
|
||||||
|
fragments:
|
||||||
|
- 152-add-action-groups.yml
|
||||||
|
- auth-against-api-with-trailing-slash.yaml
|
||||||
|
modules:
|
||||||
|
- description: Update TemplateInstances to point to the latest group-version-kinds
|
||||||
|
name: openshift_adm_migrate_template_instances
|
||||||
|
namespace: ''
|
||||||
|
- description: Removes references to the specified roles, clusterroles, users,
|
||||||
|
and groups
|
||||||
|
name: openshift_adm_prune_auth
|
||||||
|
namespace: ''
|
||||||
|
- description: Remove old completed and failed deployment configs
|
||||||
|
name: openshift_adm_prune_deployments
|
||||||
|
namespace: ''
|
||||||
|
- description: Remove unreferenced images
|
||||||
|
name: openshift_adm_prune_images
|
||||||
|
namespace: ''
|
||||||
|
- description: Import the latest image information from a tag in a container image
|
||||||
|
registry.
|
||||||
|
name: openshift_import_image
|
||||||
|
namespace: ''
|
||||||
|
- description: Display information about the integrated registry.
|
||||||
|
name: openshift_registry_info
|
||||||
|
namespace: ''
|
||||||
|
release_date: '2022-05-05'
|
||||||
|
2.3.0:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- openshift_adm_groups_sync - initialize OpenshiftGroupSync attributes early
|
||||||
|
to avoid Attribute error (https://github.com/openshift/community.okd/issues/155).
|
||||||
|
- openshift_auth - Review the way the discard process is working, add openshift
|
||||||
|
algorithm to convert token to resource object name (https://github.com/openshift/community.okd/issues/176).
|
||||||
|
fragments:
|
||||||
|
- 165-initialize-attributes-early.yml
|
||||||
|
- 178-openshift_auth-fix-revoke-token.yml
|
||||||
|
- 180-default-values-doc.yml
|
||||||
|
modules:
|
||||||
|
- description: Prune old completed and failed builds
|
||||||
|
name: openshift_adm_prune_builds
|
||||||
|
namespace: ''
|
||||||
|
- description: Start a new build or Cancel running, pending, or new builds.
|
||||||
|
name: openshift_build
|
||||||
|
namespace: ''
|
||||||
|
release_date: '2023-02-03'
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
minor_changes:
|
|
||||||
- add action groups to runtime.yml (https://github.com/openshift/community.okd/issues/41).
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
bugfixes:
|
|
||||||
- fix ocp auth failing against cluster api url with trailing slash (https://github.com/openshift/community.okd/issues/139)
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- Fix sanity validate-modules and yamllint failures.
|
||||||
|
- Add GH workflows.
|
||||||
+6
-5
@@ -4,16 +4,17 @@ ENV OPERATOR=/usr/local/bin/ansible-operator \
|
|||||||
USER_UID=1001 \
|
USER_UID=1001 \
|
||||||
USER_NAME=ansible-operator\
|
USER_NAME=ansible-operator\
|
||||||
HOME=/opt/ansible \
|
HOME=/opt/ansible \
|
||||||
ANSIBLE_LOCAL_TMP=/opt/ansible/tmp
|
ANSIBLE_LOCAL_TMP=/opt/ansible/tmp \
|
||||||
|
DOWNSTREAM_BUILD_PYTHON=python3.9
|
||||||
|
|
||||||
RUN yum install -y \
|
RUN yum install -y \
|
||||||
glibc-langpack-en \
|
glibc-langpack-en \
|
||||||
git \
|
git \
|
||||||
make \
|
make \
|
||||||
python3 \
|
python39 \
|
||||||
python3-devel \
|
python39-devel \
|
||||||
python3-pip \
|
python39-pip \
|
||||||
python3-setuptools \
|
python39-setuptools \
|
||||||
gcc \
|
gcc \
|
||||||
openldap-devel \
|
openldap-devel \
|
||||||
&& pip3 install --no-cache-dir --upgrade setuptools pip \
|
&& pip3 install --no-cache-dir --upgrade setuptools pip \
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
# - All functions are prefixed with f_ so it's obvious where they come
|
# - All functions are prefixed with f_ so it's obvious where they come
|
||||||
# from when in use throughout the script
|
# from when in use throughout the script
|
||||||
|
|
||||||
DOWNSTREAM_VERSION="2.1.0"
|
DOWNSTREAM_VERSION="2.3.0"
|
||||||
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
|
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
|
||||||
INSTALL_DOWNSTREAM_COLLECTION_PATH="${INSTALL_DOWNSTREAM_COLLECTION_PATH:-}"
|
INSTALL_DOWNSTREAM_COLLECTION_PATH="${INSTALL_DOWNSTREAM_COLLECTION_PATH:-}"
|
||||||
_build_dir=""
|
_build_dir=""
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function check_failure {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime="15 minute"
|
runtime="30 minute"
|
||||||
endtime=$(date -ud "$runtime" +%s)
|
endtime=$(date -ud "$runtime" +%s)
|
||||||
|
|
||||||
echo "Waiting for test job to complete"
|
echo "Waiting for test job to complete"
|
||||||
|
|||||||
@@ -375,13 +375,14 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -602,7 +603,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
||||||
<div>Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to <em>resource_definition</em>. See Examples below.</div>
|
<div>Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to <em>resource_definition</em>. See Examples below.</div>
|
||||||
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>k8s</span> module.</div>
|
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>kubernetes.core.k8s</span> module.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,525 @@
|
|||||||
|
.. _community.okd.openshift_adm_groups_sync_module:
|
||||||
|
|
||||||
|
|
||||||
|
***************************************
|
||||||
|
community.okd.openshift_adm_groups_sync
|
||||||
|
***************************************
|
||||||
|
|
||||||
|
**Sync OpenShift Groups with records from an external provider.**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.1.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- In order to sync/prune OpenShift Group records with those from an external provider, determine which Groups you wish to sync and where their records live.
|
||||||
|
- Analogous to `oc adm prune groups` and `oc adm group sync`.
|
||||||
|
- LDAP sync configuration file syntax can be found here https://docs.openshift.com/container-platform/4.9/authentication/ldap-syncing.html.
|
||||||
|
- The bindPassword attribute of the LDAP sync configuration is expected to be a string, please use ansible-vault encryption to secure this information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
- python-ldap
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>allow_groups</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>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Allowed groups, could be openshift group name or LDAP group dn value.</div>
|
||||||
|
<div>When parameter <code>type</code> is set to <em>ldap</em> this should contains only LDAP group definition like <em>cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat</em>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>deny_groups</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>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Denied groups, could be openshift group name or LDAP group dn value.</div>
|
||||||
|
<div>When parameter <code>type</code> is set to <em>ldap</em> this should contains only LDAP group definition like <em>cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat</em>.</div>
|
||||||
|
<div>The elements specified in this list will override the ones specified in <code>allow_groups</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>state</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>absent</li>
|
||||||
|
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Determines if the group should be sync when set to <code>present</code> or pruned when set to <code>absent</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>sync_config</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Provide a valid YAML definition of an LDAP sync configuration.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: config, src</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>type</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>ldap</b> ←</div></li>
|
||||||
|
<li>openshift</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>which groups allow and deny list entries refer to.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# Prune all orphaned groups
|
||||||
|
- name: Prune all orphan groups
|
||||||
|
openshift_adm_groups_sync:
|
||||||
|
state: absent
|
||||||
|
src: "{{ lookup('file', '/path/to/ldap-sync-config.yaml') | from_yaml }}"
|
||||||
|
|
||||||
|
# Prune all orphaned groups from a list of specific groups specified in allow_groups
|
||||||
|
- name: Prune all orphan groups from a list of specific groups specified in allow_groups
|
||||||
|
openshift_adm_groups_sync:
|
||||||
|
state: absent
|
||||||
|
src: "{{ lookup('file', '/path/to/ldap-sync-config.yaml') | from_yaml }}"
|
||||||
|
allow_groups:
|
||||||
|
- cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat
|
||||||
|
- cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat
|
||||||
|
|
||||||
|
# Sync all groups from an LDAP server
|
||||||
|
- name: Sync all groups from an LDAP server
|
||||||
|
openshift_adm_groups_sync:
|
||||||
|
src:
|
||||||
|
kind: LDAPSyncConfig
|
||||||
|
apiVersion: v1
|
||||||
|
url: ldap://localhost:1390
|
||||||
|
insecure: true
|
||||||
|
bindDN: cn=admin,dc=example,dc=org
|
||||||
|
bindPassword: adminpassword
|
||||||
|
rfc2307:
|
||||||
|
groupsQuery:
|
||||||
|
baseDN: "cn=admins,ou=groups,dc=example,dc=org"
|
||||||
|
scope: sub
|
||||||
|
derefAliases: never
|
||||||
|
filter: (objectClass=*)
|
||||||
|
pageSize: 0
|
||||||
|
groupUIDAttribute: dn
|
||||||
|
groupNameAttributes: [ cn ]
|
||||||
|
groupMembershipAttributes: [ member ]
|
||||||
|
usersQuery:
|
||||||
|
baseDN: "ou=users,dc=example,dc=org"
|
||||||
|
scope: sub
|
||||||
|
derefAliases: never
|
||||||
|
pageSize: 0
|
||||||
|
userUIDAttribute: dn
|
||||||
|
userNameAttributes: [ mail ]
|
||||||
|
tolerateMemberNotFoundErrors: true
|
||||||
|
tolerateMemberOutOfScopeErrors: true
|
||||||
|
|
||||||
|
# Sync all groups except the ones from the deny_groups from an LDAP server
|
||||||
|
- name: Sync all groups from an LDAP server using deny_groups
|
||||||
|
openshift_adm_groups_sync:
|
||||||
|
src: "{{ lookup('file', '/path/to/ldap-sync-config.yaml') | from_yaml }}"
|
||||||
|
deny_groups:
|
||||||
|
- cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat
|
||||||
|
- cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat
|
||||||
|
|
||||||
|
# Sync all OpenShift Groups that have been synced previously with an LDAP server
|
||||||
|
- name: Sync all OpenShift Groups that have been synced previously with an LDAP server
|
||||||
|
openshift_adm_groups_sync:
|
||||||
|
src: "{{ lookup('file', '/path/to/ldap-sync-config.yaml') | from_yaml }}"
|
||||||
|
type: openshift
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="1">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>builds</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The groups that were created, updated or deleted</div>
|
||||||
|
<br/>
|
||||||
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||||
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[{'apiVersion': 'user.openshift.io/v1', 'kind': 'Group', 'metadata': {'annotations': {'openshift.io/ldap.sync-time': '2021-12-17T12:20:28.125282', 'openshift.io/ldap.uid': 'cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat', 'openshift.io/ldap.url': 'localhost:1390'}, 'creationTimestamp': '2021-12-17T11:09:49Z', 'labels': {'openshift.io/ldap.host': 'localhost'}, 'managedFields': [{'apiVersion': 'user.openshift.io/v1', 'fieldsType': 'FieldsV1', 'fieldsV1': {'f:metadata': {'f:annotations': {'.': {}, 'f:openshift.io/ldap.sync-time': {}, 'f:openshift.io/ldap.uid': {}, 'f:openshift.io/ldap.url': {}}, 'f:labels': {'.': {}, 'f:openshift.io/ldap.host': {}}}, 'f:users': {}}, 'manager': 'OpenAPI-Generator', 'operation': 'Update', 'time': '2021-12-17T11:09:49Z'}], 'name': 'developers', 'resourceVersion': '2014696', 'uid': '8dc211cb-1544-41e1-96b1-efffeed2d7d7'}, 'users': ['jordanbulls@ansible.org']}]</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -0,0 +1,532 @@
|
|||||||
|
.. _community.okd.openshift_adm_migrate_template_instances_module:
|
||||||
|
|
||||||
|
|
||||||
|
******************************************************
|
||||||
|
community.okd.openshift_adm_migrate_template_instances
|
||||||
|
******************************************************
|
||||||
|
|
||||||
|
**Update TemplateInstances to point to the latest group-version-kinds**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.2.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- Update TemplateInstances to point to the latest group-version-kinds.
|
||||||
|
- Analogous to ``oc adm migrate template-instances``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</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>The namespace that the template can be found in.</div>
|
||||||
|
<div>If no namespace if specified, migrate objects in all namespaces.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether to wait for certain resource kinds to end up in the desired state.</div>
|
||||||
|
<div>By default the module exits once Kubernetes has received the request.</div>
|
||||||
|
<div>Implemented for <code>state=present</code> for <code>Deployment</code>, <code>DaemonSet</code> and <code>Pod</code>, and for <code>state=absent</code> for all resource kinds.</div>
|
||||||
|
<div>For resource kinds without an implementation, <code>wait</code> returns immediately unless <code>wait_condition</code> is set.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait_condition</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Specifies a custom condition on the status to wait for.</div>
|
||||||
|
<div>Ignored if <code>wait</code> is not set or is set to False.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>reason</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>The value of the reason field in your desired condition</div>
|
||||||
|
<div>For example, if a <code>Deployment</code> is paused, The <code>Progressing</code> <code>type</code> will have the <code>DeploymentPaused</code> reason.</div>
|
||||||
|
<div>The possible reasons in a condition are specific to each resource type in Kubernetes.</div>
|
||||||
|
<div>See the API documentation of the status field for a given resource to see possible choices.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>status</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>True</b> ←</div></li>
|
||||||
|
<li>False</li>
|
||||||
|
<li>Unknown</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The value of the status field in your desired condition.</div>
|
||||||
|
<div>For example, if a <code>Deployment</code> is paused, the <code>Progressing</code> <code>type</code> will have the <code>Unknown</code> status.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>type</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>The type of condition to wait for.</div>
|
||||||
|
<div>For example, the <code>Pod</code> resource will set the <code>Ready</code> condition (among others).</div>
|
||||||
|
<div>Required if you are specifying a <code>wait_condition</code>.</div>
|
||||||
|
<div>If left empty, the <code>wait_condition</code> field will be ignored.</div>
|
||||||
|
<div>The possible types for a condition are specific to each resource type in Kubernetes.</div>
|
||||||
|
<div>See the API documentation of the status field for a given resource to see possible choices.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait_sleep</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>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">5</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Number of seconds to sleep between checks.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait_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>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">120</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>How long in seconds to wait for the resource to end up in the desired state.</div>
|
||||||
|
<div>Ignored if <code>wait</code> is not set.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
- name: Migrate TemplateInstances in namespace=test
|
||||||
|
community.okd.openshift_adm_migrate_template_instances:
|
||||||
|
namespace: test
|
||||||
|
register: _result
|
||||||
|
|
||||||
|
- name: Migrate TemplateInstances in all namespaces
|
||||||
|
community.okd.openshift_adm_migrate_template_instances:
|
||||||
|
register: _result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="1">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>result</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>List with all TemplateInstances that have been migrated.</div>
|
||||||
|
<br/>
|
||||||
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||||
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[{'apiVersion': 'template.openshift.io/v1', 'kind': 'TemplateInstance', 'metadata': {'creationTimestamp': '2021-11-10T11:12:09Z', 'finalizers': ['template.openshift.io/finalizer'], 'managedFields': [{'apiVersion': 'template.openshift.io/v1', 'fieldsType': 'FieldsV1', 'fieldsV1': {'f:spec': {'f:template': {'f:metadata': {'f:name': {}}, 'f:objects': {}, 'f:parameters': {}}}}, 'manager': 'kubectl-create', 'operation': 'Update', 'time': '2021-11-10T11:12:09Z'}, {'apiVersion': 'template.openshift.io/v1', 'fieldsType': 'FieldsV1', 'fieldsV1': {'f:metadata': {'f:finalizers': {'.': {}, 'v:"template.openshift.io/finalizer"': {}}}, 'f:status': {'f:conditions': {}}}, 'manager': 'openshift-controller-manager', 'operation': 'Update', 'time': '2021-11-10T11:12:09Z'}, {'apiVersion': 'template.openshift.io/v1', 'fieldsType': 'FieldsV1', 'fieldsV1': {'f:status': {'f:objects': {}}}, 'manager': 'OpenAPI-Generator', 'operation': 'Update', 'time': '2021-11-10T11:12:33Z'}], 'name': 'demo', 'namespace': 'test', 'resourceVersion': '545370', 'uid': '09b795d7-7f07-4d94-bf0f-2150ee66f88d'}, 'spec': {'requester': {'groups': ['system:masters', 'system:authenticated'], 'username': 'system:admin'}, 'template': {'metadata': {'creationTimestamp': None, 'name': 'template'}, 'objects': [{'apiVersion': 'v1', 'kind': 'Secret', 'metadata': {'labels': {'foo': 'bar'}, 'name': 'secret'}}, {'apiVersion': 'apps/v1', 'kind': 'Deployment', 'metadata': {'name': 'deployment'}, 'spec': {'replicas': 0, 'selector': {'matchLabels': {'key': 'value'}}, 'template': {'metadata': {'labels': {'key': 'value'}}, 'spec': {'containers': [{'image': 'k8s.gcr.io/e2e-test-images/agnhost:2.32', 'name': 'hello-openshift'}]}}}}, {'apiVersion': 'v1', 'kind': 'Route', 'metadata': {'name': 'route'}, 'spec': {'to': {'name': 'foo'}}}], 'parameters': [{'name': 'NAME', 'value': '${NAME}'}]}}, 'status': {'conditions': [{'lastTransitionTime': '2021-11-10T11:12:09Z', 'message': '', 'reason': 'Created', 'status': 'True', 'type': 'Ready'}], 'objects': [{'ref': {'apiVersion': 'v1', 'kind': 'Secret', 'name': 'secret', 'namespace': 'test', 'uid': '33fad364-6d47-4f9c-9e51-92cba5602a57'}}, {'ref': {'apiVersion': 'apps/v1', 'kind': 'Deployment', 'name': 'deployment', 'namespace': 'test', 'uid': '3b527f88-42a1-4811-9e2f-baad4e4d8807'}}, {'ref': {'apiVersion': 'route.openshift.io/v1.Route', 'kind': 'Route', 'name': 'route', 'namespace': 'test', 'uid': '5b5411de-8769-4e27-ba52-6781630e4008'}}]}}, '...']</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Alina Buzachis (@alinabuzachis)
|
||||||
@@ -0,0 +1,514 @@
|
|||||||
|
.. _community.okd.openshift_adm_prune_auth_module:
|
||||||
|
|
||||||
|
|
||||||
|
**************************************
|
||||||
|
community.okd.openshift_adm_prune_auth
|
||||||
|
**************************************
|
||||||
|
|
||||||
|
**Removes references to the specified roles, clusterroles, users, and groups**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.2.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- This module allow administrators to remove references to the specified roles, clusterroles, users, and groups.
|
||||||
|
- Analogous to ``oc adm prune auth``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>label_selectors</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>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Selector (label query) to filter on.</div>
|
||||||
|
<div>Mutually exclusive with option <em>name</em>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>name</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>Use to specify an object name to remove.</div>
|
||||||
|
<div>Mutually exclusive with option <em>label_selectors</em>.</div>
|
||||||
|
<div>If neither <em>name</em> nor <em>label_selectors</em> are specified, prune all resources in the namespace.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</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>Use to specify an object namespace.</div>
|
||||||
|
<div>Ignored when <em>resource</em> is set to <code>clusterroles</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>resource</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>roles</li>
|
||||||
|
<li>clusterroles</li>
|
||||||
|
<li>users</li>
|
||||||
|
<li>groups</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The specified resource to remove.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
- name: Prune all roles from default namespace
|
||||||
|
openshift_adm_prune_auth:
|
||||||
|
resource: roles
|
||||||
|
namespace: testing
|
||||||
|
|
||||||
|
- name: Prune clusterroles using label selectors
|
||||||
|
openshift_adm_prune_auth:
|
||||||
|
resource: roles
|
||||||
|
namespace: testing
|
||||||
|
label_selectors:
|
||||||
|
- phase=production
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="1">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>authorization</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><em>resource=users</em></td>
|
||||||
|
<td>
|
||||||
|
<div>list of OAuthClientAuthorization deleted.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>cluster_role_binding</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>list of cluster role binding deleted.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>group</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><em>resource=users</em></td>
|
||||||
|
<td>
|
||||||
|
<div>list of Security Context Constraints deleted.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>role_binding</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><em>resource=users</em> or <em>resource=groups</em> or <em>resource=clusterroles</em></td>
|
||||||
|
<td>
|
||||||
|
<div>list of role binding deleted.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>security_context_constraints</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><em>resource=users</em> or <em>resource=groups</em></td>
|
||||||
|
<td>
|
||||||
|
<div>list of Security Context Constraints deleted.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -0,0 +1,571 @@
|
|||||||
|
.. _community.okd.openshift_adm_prune_builds_module:
|
||||||
|
|
||||||
|
|
||||||
|
****************************************
|
||||||
|
community.okd.openshift_adm_prune_builds
|
||||||
|
****************************************
|
||||||
|
|
||||||
|
**Prune old completed and failed builds**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.3.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- This module allow administrators to delete old completed and failed builds.
|
||||||
|
- Analogous to ``oc adm prune builds``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>impersonate_groups</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.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Group(s) to impersonate for the operation.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_IMPERSONATE_GROUPS environment. Example: Group1,Group2</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>impersonate_user</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Username to impersonate for the operation.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_IMPERSONATE_USER environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>keep_younger_than</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>Specify the minimum age (in minutes) of a Build for it to be considered a candidate for pruning.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</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>Use to specify namespace for builds to be deleted.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>orphans</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If <code>true</code>, prune all builds whose associated BuildConfig no longer exists and whose status is complete, failed, error, or cancelled.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# Run deleting older completed and failed builds and also including
|
||||||
|
# all builds whose associated BuildConfig no longer exists
|
||||||
|
- name: Run delete orphan Builds
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
orphans: True
|
||||||
|
|
||||||
|
# Run deleting older completed and failed builds keep younger than 2hours
|
||||||
|
- name: Run delete builds, keep younger than 2h
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
keep_younger_than: 120
|
||||||
|
|
||||||
|
# Run deleting builds from specific namespace
|
||||||
|
- name: Run delete builds from namespace
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
namespace: testing_namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>builds</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">complex</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The builds that were deleted</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>api_version</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The versioned schema of this representation of an object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>kind</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Represents the REST resource this object represents.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>metadata</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Standard object metadata. Includes name, namespace, annotations, labels, etc.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>spec</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Specific attributes of the object. Will vary based on the <em>api_version</em> and <em>kind</em>.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>status</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Current status details for the object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -0,0 +1,428 @@
|
|||||||
|
.. _community.okd.openshift_adm_prune_deployments_module:
|
||||||
|
|
||||||
|
|
||||||
|
*********************************************
|
||||||
|
community.okd.openshift_adm_prune_deployments
|
||||||
|
*********************************************
|
||||||
|
|
||||||
|
**Remove old completed and failed deployment configs**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.2.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- This module allow administrators to remove old completed and failed deployment configs.
|
||||||
|
- Analogous to ``oc adm prune deployments``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>keep_younger_than</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>Specify the minimum age (in minutes) of a deployment for it to be considered a candidate for pruning.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</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>Use to specify namespace for deployments to be deleted.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>orphans</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If <code>true</code>, prune all deployments where the associated DeploymentConfig no longer exists, the status is complete or failed, and the replica size is <code>0</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
- name: Prune Deployments from testing namespace
|
||||||
|
community.okd.openshift_adm_prune_deployments:
|
||||||
|
namespace: testing
|
||||||
|
|
||||||
|
- name: Prune orphans deployments, keep younger than 2hours
|
||||||
|
community.okd.openshift_adm_prune_deployments:
|
||||||
|
orphans: True
|
||||||
|
keep_younger_than: 120
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="1">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>replication_controllers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>list of replication controllers candidate for pruning.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,844 @@
|
|||||||
|
.. _community.okd.openshift_build_module:
|
||||||
|
|
||||||
|
|
||||||
|
*****************************
|
||||||
|
community.okd.openshift_build
|
||||||
|
*****************************
|
||||||
|
|
||||||
|
**Start a new build or Cancel running, pending, or new builds.**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.3.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- This module starts a new build from the provided build config or build name.
|
||||||
|
- This module also cancel a new, pending or running build by requesting a graceful shutdown of the build. There may be a delay between requesting the build and the time the build is terminated.
|
||||||
|
- This can also restart a new build when the current is cancelled.
|
||||||
|
- Analogous to ``oc cancel-build`` and ``oc start-build``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>build_args</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=dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Specify a list of key-value pair to pass to Docker during the build.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>name</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>docker build argument name.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>docker build argument value.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>build_config_name</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>Specify the name of a build config from which a new build will be run.</div>
|
||||||
|
<div>Mutually exclusive with parameter <em>build_name</em>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>build_name</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>Specify the name of a build which should be re-run.</div>
|
||||||
|
<div>Mutually exclusive with parameter <em>build_config_name</em>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>build_phases</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>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>New</li>
|
||||||
|
<li>Pending</li>
|
||||||
|
<li>Running</li>
|
||||||
|
</ul>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>List of state for build to cancel.</div>
|
||||||
|
<div>Ignored when <code>state=started</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>commit</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>Specify the source code commit identifier the build should use; requires a build based on a Git repository.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>env_vars</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=dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Specify a list of key-value pair for an environment variable to set for the build container.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>name</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Environment variable name.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Environment variable value.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>impersonate_groups</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.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Group(s) to impersonate for the operation.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_IMPERSONATE_GROUPS environment. Example: Group1,Group2</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>impersonate_user</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Username to impersonate for the operation.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_IMPERSONATE_USER environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>incremental</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Overrides the incremental setting in a source-strategy build, ignored if not specified.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Specify the namespace for the build or the build config.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_cache</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Overrides the noCache setting in a docker-strategy build, ignored if not specified.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>state</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>started</b> ←</div></li>
|
||||||
|
<li>cancelled</li>
|
||||||
|
<li>restarted</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Determines if a Build should be started ,cancelled or restarted.</div>
|
||||||
|
<div>When set to <code>restarted</code> a new build will be created after the current build is cancelled.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>When <code>state=started</code>, specify whether to wait for a build to complete and exit with a non-zero return code if the build fails.</div>
|
||||||
|
<div>When <em>state=cancelled</em>, specify whether to wait for a build phase to be Cancelled.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait_sleep</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>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">5</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Number of seconds to sleep between checks.</div>
|
||||||
|
<div>Ignored if <code>wait=false</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>wait_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>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">120</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>How long in seconds to wait for a build to complete.</div>
|
||||||
|
<div>Ignored if <code>wait=false</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# Starts build from build config default/hello-world
|
||||||
|
- name: Starts build from build config
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: default
|
||||||
|
build_config_name: hello-world
|
||||||
|
|
||||||
|
# Starts build from a previous build "default/hello-world-1"
|
||||||
|
- name: Starts build from a previous build
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: default
|
||||||
|
build_name: hello-world-1
|
||||||
|
|
||||||
|
# Cancel the build with the given name
|
||||||
|
- name: Cancel build from default namespace
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_name: ruby-build-1
|
||||||
|
state: cancelled
|
||||||
|
|
||||||
|
# Cancel the named build and create a new one with the same parameters
|
||||||
|
- name: Cancel build from default namespace and create a new one
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_name: ruby-build-1
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
# Cancel all builds created from 'ruby-build' build configuration that are in 'new' state
|
||||||
|
- name: Cancel build from default namespace and create a new one
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_config_name: ruby-build
|
||||||
|
build_phases:
|
||||||
|
- New
|
||||||
|
state: cancelled
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>builds</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">complex</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The builds that were started/cancelled.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>api_version</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The versioned schema of this representation of an object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>kind</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Represents the REST resource this object represents.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>metadata</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Standard object metadata. Includes name, namespace, annotations, labels, etc.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>spec</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Specific attributes of the build.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>status</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Current status details for the object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -0,0 +1,626 @@
|
|||||||
|
.. _community.okd.openshift_import_image_module:
|
||||||
|
|
||||||
|
|
||||||
|
************************************
|
||||||
|
community.okd.openshift_import_image
|
||||||
|
************************************
|
||||||
|
|
||||||
|
**Import the latest image information from a tag in a container image registry.**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.2.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- Image streams allow you to control which images are rolled out to your builds and applications.
|
||||||
|
- This module fetches the latest version of an image from a remote repository and updates the image stream tag if it does not match the previous value.
|
||||||
|
- Running the module multiple times will not create duplicate entries.
|
||||||
|
- When importing an image, only the image metadata is copied, not the image contents.
|
||||||
|
- Analogous to ``oc import-image``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
- docker-image-py
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>all</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If set to <em>true</em>, import all tags from the provided source on creation or if <code>source</code> is specified.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>name</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Image stream to import tag into.</div>
|
||||||
|
<div>This can be provided as a list of images streams or a single value.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>namespace</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Use to specify namespace for image stream to create/update.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>reference_policy</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>source</b> ←</div></li>
|
||||||
|
<li>local</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Allow to request pullthrough for external image when set to <em>local</em>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>scheduled</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Set each imported Docker image to be periodically imported from a remote repository.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>source</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>A Docker image repository to import images from.</div>
|
||||||
|
<div>Should be provided as 'registry.io/repo/image'</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_registry_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If set to <em>true</em>, allow importing from registries that have invalid HTTPS certificates. or are hosted via HTTP. This parameter will take precedence over the insecure annotation.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# Import tag latest into a new image stream.
|
||||||
|
- name: Import tag latest into new image stream
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name: mystream
|
||||||
|
source: registry.io/repo/image:latest
|
||||||
|
|
||||||
|
# Update imported data for tag latest in an already existing image stream.
|
||||||
|
- name: Update imported data for tag latest
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name: mystream
|
||||||
|
|
||||||
|
# Update imported data for tag 'stable' in an already existing image stream.
|
||||||
|
- name: Update imported data for tag latest
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name: mystream:stable
|
||||||
|
|
||||||
|
# Update imported data for all tags in an existing image stream.
|
||||||
|
- name: Update imported data for all tags
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name: mystream
|
||||||
|
all: true
|
||||||
|
|
||||||
|
# Import all tags into a new image stream.
|
||||||
|
- name: Import all tags into a new image stream.
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name: mystream
|
||||||
|
source: registry.io/repo/image:latest
|
||||||
|
all: true
|
||||||
|
|
||||||
|
# Import all tags into a new image stream for a list of image streams
|
||||||
|
- name: Import all tags into a new image stream.
|
||||||
|
community.okd.openshift_import_image:
|
||||||
|
namespace: testing
|
||||||
|
name:
|
||||||
|
- mystream1
|
||||||
|
- mystream2
|
||||||
|
- mystream3
|
||||||
|
source: registry.io/repo/image:latest
|
||||||
|
all: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>result</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>List with all ImageStreamImport that have been created.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>api_version</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The versioned schema of this representation of an object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>kind</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Represents the REST resource this object represents.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>metadata</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Standard object metadata. Includes name, namespace, annotations, labels, etc.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>spec</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Specific attributes of the object. Will vary based on the <em>api_version</em> and <em>kind</em>.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>status</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Current status details for the object.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -143,13 +143,14 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -388,7 +389,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
||||||
<div>Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to <em>resource_definition</em>. See Examples below.</div>
|
<div>Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to <em>resource_definition</em>. See Examples below.</div>
|
||||||
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>k8s</span> module.</div>
|
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>kubernetes.core.k8s</span> module.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,464 @@
|
|||||||
|
.. _community.okd.openshift_registry_info_module:
|
||||||
|
|
||||||
|
|
||||||
|
*************************************
|
||||||
|
community.okd.openshift_registry_info
|
||||||
|
*************************************
|
||||||
|
|
||||||
|
**Display information about the integrated registry.**
|
||||||
|
|
||||||
|
|
||||||
|
Version added: 2.2.0
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
- This module exposes information about the integrated registry.
|
||||||
|
- Use ``check`` to verify your local client can access the registry.
|
||||||
|
- If the adminstrator has not configured a public hostname for the registry then this command may fail when run outside of the server.
|
||||||
|
- Analogous to ``oc registry info``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
- docker-image-py
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Parameter</th>
|
||||||
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
|
<th width="100%">Comments</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</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>Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>check</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Attempt to contact the integrated registry using local client.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: cert_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>client_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: key_file</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</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>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</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>Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>password</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>Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.</div>
|
||||||
|
<div>Please read the description of the <code>username</code> option for a discussion of when this option is applicable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>persist_config</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.</div>
|
||||||
|
<div>When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.</div>
|
||||||
|
<div>Default to false.</div>
|
||||||
|
<div>Please note that the current version of the k8s python client library does not support setting this flag to True yet.</div>
|
||||||
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy</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>The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_headers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>The Header used for the HTTP proxy.</div>
|
||||||
|
<div>Documentation can be found here <a href='https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers'>https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers</a>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>basic_auth</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>Colon-separated username:password for basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>proxy_basic_auth</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>Colon-separated username:password for proxy basic authentication header.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>user_agent</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>String representing the user-agent you want, such as foo/1.0.</div>
|
||||||
|
<div>Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>username</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>Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.</div>
|
||||||
|
<div>Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the <span class='module'>community.okd.k8s_auth</span> module, as that might do what you need.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</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>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# Get registry information
|
||||||
|
- name: Read integrated registry information
|
||||||
|
community.okd.openshift_registry_info:
|
||||||
|
|
||||||
|
# Read registry integrated information and attempt to contact using local client.
|
||||||
|
- name: Attempt to contact integrated registry using local client
|
||||||
|
community.okd.openshift_registry_info:
|
||||||
|
check: yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return Values
|
||||||
|
-------------
|
||||||
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Key</th>
|
||||||
|
<th>Returned</th>
|
||||||
|
<th width="100%">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>check</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether the local client can contact or not the registry.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>msg</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>message describing the ping operation.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>reached</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether the registry has been reached or not.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>internal_hostname</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The internal registry hostname.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>public_hostname</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>success</td>
|
||||||
|
<td>
|
||||||
|
<div>The public registry hostname.</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
Status
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -19,7 +19,7 @@ Synopsis
|
|||||||
--------
|
--------
|
||||||
- Looks up a Service and creates a new Route based on it.
|
- Looks up a Service and creates a new Route based on it.
|
||||||
- Analogous to `oc expose` and `oc create route` for creating Routes, but does not support creating Services.
|
- Analogous to `oc expose` and `oc create route` for creating Routes, but does not support creating Services.
|
||||||
- For creating Services from other resources, see kubernetes.core.k8s_expose
|
- For creating Services from other resources, see kubernetes.core.k8s.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +43,23 @@ Parameters
|
|||||||
<th>Choices/<font color="blue">Defaults</font></th>
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
<th width="100%">Comments</th>
|
<th width="100%">Comments</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>annotations</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.1.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Specify the Route Annotations.</div>
|
||||||
|
<div>A set of key: value pairs.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -176,13 +193,14 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<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>
|
||||||
|
<div>The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -808,6 +826,8 @@ Examples
|
|||||||
service: hello-kubernetes
|
service: hello-kubernetes
|
||||||
namespace: default
|
namespace: default
|
||||||
insecure_policy: allow
|
insecure_policy: allow
|
||||||
|
annotations:
|
||||||
|
haproxy.router.openshift.io/balance: roundrobin
|
||||||
register: route
|
register: route
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ authors:
|
|||||||
- willthames (https://github.com/willthames)
|
- willthames (https://github.com/willthames)
|
||||||
- Akasurde (https://github.com/akasurde)
|
- Akasurde (https://github.com/akasurde)
|
||||||
dependencies:
|
dependencies:
|
||||||
kubernetes.core: '>=2.1.0,<2.3.0'
|
kubernetes.core: '>=2.4.0'
|
||||||
description: OKD Collection for Ansible.
|
description: OKD Collection for Ansible.
|
||||||
documentation: ''
|
documentation: ''
|
||||||
homepage: ''
|
homepage: ''
|
||||||
@@ -24,4 +24,4 @@ tags:
|
|||||||
- okd
|
- okd
|
||||||
- cluster
|
- cluster
|
||||||
# Also needs to be updated in the Makefile
|
# Also needs to be updated in the Makefile
|
||||||
version: 2.1.0
|
version: 2.3.0
|
||||||
|
|||||||
@@ -1,11 +1,49 @@
|
|||||||
---
|
---
|
||||||
apiVersion: apiextensions.k8s.io/v1beta1
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
name: certificates.certmanager.k8s.io
|
name: certificates.certmanager.k8s.io
|
||||||
|
annotations:
|
||||||
|
"api-approved.kubernetes.io": "https://github.com/kubernetes/kubernetes/pull/78458"
|
||||||
spec:
|
spec:
|
||||||
group: certmanager.k8s.io
|
group: certmanager.k8s.io
|
||||||
version: v1alpha1
|
versions:
|
||||||
|
- name: v1alpha1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
certificate:
|
||||||
|
type: string
|
||||||
|
secretName:
|
||||||
|
type: string
|
||||||
|
dnsNames:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
acme:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
config:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ingressClass:
|
||||||
|
type: string
|
||||||
|
domains:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
issuerRef:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
type: string
|
||||||
scope: Namespaced
|
scope: Namespaced
|
||||||
names:
|
names:
|
||||||
kind: Certificate
|
kind: Certificate
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
name: cluster-reader
|
name: cluster-admin
|
||||||
subjects:
|
subjects:
|
||||||
- apiGroup: rbac.authorization.k8s.io
|
- apiGroup: rbac.authorization.k8s.io
|
||||||
kind: User
|
kind: User
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
# ignore_errors: true
|
# ignore_errors: true
|
||||||
# register: ping_ldap
|
# register: ping_ldap
|
||||||
|
|
||||||
|
- include_tasks: "tasks/python-ldap-not-installed.yml"
|
||||||
- include_tasks: "tasks/rfc2307.yml"
|
- include_tasks: "tasks/rfc2307.yml"
|
||||||
- include_tasks: "tasks/activeDirectory.yml"
|
- include_tasks: "tasks/activeDirectory.yml"
|
||||||
- include_tasks: "tasks/augmentedActiveDirectory.yml"
|
- include_tasks: "tasks/augmentedActiveDirectory.yml"
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
- block:
|
||||||
|
- name: Create temp directory
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
register: test_dir
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
test_dir: "{{ test_dir.path }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
venv: "{{ test_dir }}/virtualenv"
|
||||||
|
|
||||||
|
- pip:
|
||||||
|
name:
|
||||||
|
- kubernetes
|
||||||
|
virtualenv: "{{ venv }}"
|
||||||
|
virtualenv_command: "{{ virtualenv_command }}"
|
||||||
|
virtualenv_site_packages: false
|
||||||
|
|
||||||
|
- name: Load test configurations
|
||||||
|
set_fact:
|
||||||
|
configs: "{{ lookup('template', 'rfc2307/sync-config.j2') | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Synchronize Groups without python-ldap
|
||||||
|
community.okd.openshift_adm_groups_sync:
|
||||||
|
config: "{{ configs.simple }}"
|
||||||
|
register: result
|
||||||
|
ignore_errors: true
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: "{{ venv }}/bin/python"
|
||||||
|
|
||||||
|
- name: Check that module failed gracefully
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- '"Failed to import the required Python library (python-ldap)" in result.msg'
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Remove temp directory
|
||||||
|
file:
|
||||||
|
path: "{{ test_dir }}"
|
||||||
|
state: absent
|
||||||
|
ignore_errors: true
|
||||||
@@ -65,8 +65,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"nodes is forbidden: User" in error.msg'
|
||||||
# - '"nodes is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- name: list Pod for all namespace should failed
|
- name: list Pod for all namespace should failed
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -79,8 +78,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- name: list Pod for test namespace should failed
|
- name: list Pod for test namespace should failed
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -94,8 +92,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
test_labels:
|
test_labels:
|
||||||
@@ -158,8 +155,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- name: list Pod for test namespace should succeed
|
- name: list Pod for test namespace should succeed
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -247,8 +243,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- name: list Pod for test namespace should failed
|
- name: list Pod for test namespace should failed
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -263,8 +258,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
- name: list Node using ServiceAccount
|
- name: list Node using ServiceAccount
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -281,7 +275,7 @@
|
|||||||
label_selectors:
|
label_selectors:
|
||||||
- phase=dev
|
- phase=dev
|
||||||
|
|
||||||
- name: list Node using ServiceAccount
|
- name: list Node using ServiceAccount should fail
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
api_key: "{{ api_token }}"
|
api_key: "{{ api_token }}"
|
||||||
host: "{{ cluster_host }}"
|
host: "{{ cluster_host }}"
|
||||||
@@ -293,8 +287,7 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"nodes is forbidden: User" in error.msg'
|
||||||
# - '"nodes is forbidden: User" in error.msg'
|
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Ensure namespace is deleted
|
- name: Ensure namespace is deleted
|
||||||
@@ -302,7 +295,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
kind: Namespace
|
kind: Namespace
|
||||||
name: "{{ test_ns }}"
|
name: "{{ test_ns }}"
|
||||||
wait: yes
|
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Delete ClusterRoleBinding
|
- name: Delete ClusterRoleBinding
|
||||||
|
|||||||
@@ -90,14 +90,13 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- error is failed
|
- '"pods is forbidden: User" in error.msg'
|
||||||
# - '"pods is forbidden: User" in error.module_stderr'
|
|
||||||
|
|
||||||
- name: Create a role to manage Pod from namespace "{{ test_ns }}"
|
- name: Create a role to manage Pod from namespace "{{ test_ns }}"
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
definition:
|
definition:
|
||||||
kind: Role
|
kind: Role
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
metadata:
|
metadata:
|
||||||
namespace: "{{ test_ns }}"
|
namespace: "{{ test_ns }}"
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
@@ -209,8 +208,7 @@
|
|||||||
- name: assert pod deletion failed due to forbidden user
|
- name: assert pod deletion failed due to forbidden user
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- '"forbidden: User" in error.msg'
|
||||||
# - '"forbidden: User" in error.module_stderr'
|
|
||||||
|
|
||||||
- name: List Pod
|
- name: List Pod
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -290,8 +288,7 @@
|
|||||||
- name: assert user is not authorize to create pod anymore
|
- name: assert user is not authorize to create pod anymore
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- '"forbidden: User" in error.msg'
|
||||||
# - '"forbidden: User" in error.module_stderr'
|
|
||||||
|
|
||||||
- name: List Pod
|
- name: List Pod
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
@@ -332,8 +329,7 @@
|
|||||||
- name: assert user is not authorize to list pod anymore
|
- name: assert user is not authorize to list pod anymore
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- '"forbidden: User" in error.msg'
|
||||||
# - '"forbidden: User" in error.module_stderr'
|
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Ensure namespace is deleted
|
- name: Ensure namespace is deleted
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
- block:
|
- block:
|
||||||
|
- set_fact:
|
||||||
|
admin_user: test
|
||||||
|
admin_pass: testing123
|
||||||
|
|
||||||
- name: Retrieve cluster info
|
- name: Retrieve cluster info
|
||||||
kubernetes.core.k8s_cluster_info:
|
kubernetes.core.k8s_cluster_info:
|
||||||
register: k8s_cluster
|
register: k8s_cluster
|
||||||
@@ -10,47 +14,98 @@
|
|||||||
|
|
||||||
- name: Log in (obtain access token)
|
- name: Log in (obtain access token)
|
||||||
community.okd.openshift_auth:
|
community.okd.openshift_auth:
|
||||||
username: test
|
username: "{{ admin_user }}"
|
||||||
password: testing123
|
password: "{{ admin_pass }}"
|
||||||
host: '{{ openshift_host }}'
|
host: '{{ openshift_host }}'
|
||||||
verify_ssl: false
|
verify_ssl: false
|
||||||
register: openshift_auth_results
|
register: openshift_auth_results
|
||||||
|
|
||||||
- name: Get the test User
|
- set_fact:
|
||||||
|
auth_api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
||||||
|
|
||||||
|
- name: "Get the {{ admin_user }} User"
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
api_key: "{{ auth_api_key }}"
|
||||||
host: '{{ openshift_host }}'
|
host: '{{ openshift_host }}'
|
||||||
verify_ssl: false
|
verify_ssl: false
|
||||||
kind: User
|
kind: User
|
||||||
api_version: user.openshift.io/v1
|
api_version: user.openshift.io/v1
|
||||||
name: test
|
name: "{{ admin_user }}"
|
||||||
register: user_result
|
register: user_result
|
||||||
|
|
||||||
- name: assert that the user was found
|
- name: assert that the user was found
|
||||||
assert:
|
assert:
|
||||||
that: (user_result.resources | length) == 1
|
that: (user_result.resources | length) == 1
|
||||||
|
|
||||||
|
- name: list available tokens
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
kind: UserOAuthAccessToken
|
||||||
|
version: oauth.openshift.io/v1
|
||||||
|
register: tokens
|
||||||
|
|
||||||
|
- debug: var=tokens
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
token_names: "{{ tokens.resources | map(attribute='metadata.name') | list }}"
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- debug: var=token_names
|
||||||
|
|
||||||
|
- name: Revoke access token
|
||||||
|
community.okd.openshift_auth:
|
||||||
|
state: absent
|
||||||
|
api_key: "{{ auth_api_key }}"
|
||||||
|
host: '{{ openshift_host }}'
|
||||||
|
verify_ssl: false
|
||||||
|
register: _revoke
|
||||||
|
|
||||||
|
- name: Ensure that token has been revoked
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- _revoke is changed
|
||||||
|
|
||||||
|
- name: "Get the {{ admin_user }} User (after token deletion)"
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
api_key: "{{ auth_api_key }}"
|
||||||
|
host: '{{ openshift_host }}'
|
||||||
|
verify_ssl: false
|
||||||
|
kind: User
|
||||||
|
api_version: user.openshift.io/v1
|
||||||
|
name: "{{ admin_user }}"
|
||||||
|
ignore_errors: true
|
||||||
|
retries: 50
|
||||||
|
until: user_result is failed
|
||||||
|
delay: 20
|
||||||
|
register: user_result
|
||||||
|
|
||||||
|
- name: Ensure that task has failed due to revoked token
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user_result is failed
|
||||||
|
|
||||||
|
- name: Revoke access token once again (should fail)
|
||||||
|
community.okd.openshift_auth:
|
||||||
|
state: absent
|
||||||
|
api_key: "{{ auth_api_key }}"
|
||||||
|
host: '{{ openshift_host }}'
|
||||||
|
verify_ssl: false
|
||||||
|
register: _revoke
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Ensure that nothing changed
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- _revoke is failed
|
||||||
|
- _revoke.msg.startswith("Couldn't delete user oauth access token")
|
||||||
|
|
||||||
|
when: token_names | length > 0
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: If login succeeded, try to log out (revoke access token)
|
- name: If login succeeded, try to log out (revoke access token)
|
||||||
when: openshift_auth_results.openshift_auth.api_key is defined
|
when: auth_api_key is defined
|
||||||
community.okd.openshift_auth:
|
community.okd.openshift_auth:
|
||||||
state: absent
|
state: absent
|
||||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
api_key: "{{ auth_api_key }}"
|
||||||
host: '{{ openshift_host }}'
|
host: '{{ openshift_host }}'
|
||||||
verify_ssl: false
|
verify_ssl: false
|
||||||
|
ignore_errors: true
|
||||||
- name: Get the test user
|
|
||||||
kubernetes.core.k8s_info:
|
|
||||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
|
||||||
host: '{{ openshift_host }}'
|
|
||||||
verify_ssl: false
|
|
||||||
kind: User
|
|
||||||
name: test
|
|
||||||
api_version: user.openshift.io/v1
|
|
||||||
register: failed_user_result
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
# TODO(fabianvf) determine why token is not being rejected, maybe add more info to return
|
|
||||||
# - name: assert that the user was not found
|
|
||||||
# assert:
|
|
||||||
# that: (failed_user_result.resources | length) == 0
|
|
||||||
|
|||||||
@@ -0,0 +1,245 @@
|
|||||||
|
- block:
|
||||||
|
- set_fact:
|
||||||
|
build_ns: "builds"
|
||||||
|
build_config: "start-build"
|
||||||
|
is_name: "ruby"
|
||||||
|
prune_build: "prune-build"
|
||||||
|
|
||||||
|
- name: Ensure namespace
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kind: Namespace
|
||||||
|
name: "{{ build_ns }}"
|
||||||
|
|
||||||
|
- name: Create ImageStream
|
||||||
|
community.okd.k8s:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
definition:
|
||||||
|
apiVersion: image.openshift.io/v1
|
||||||
|
kind: ImageStream
|
||||||
|
metadata:
|
||||||
|
name: "{{ is_name }}"
|
||||||
|
spec:
|
||||||
|
lookupPolicy:
|
||||||
|
local: false
|
||||||
|
tags: []
|
||||||
|
|
||||||
|
- name: Create build configuration
|
||||||
|
community.okd.k8s:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
definition:
|
||||||
|
kind: BuildConfig
|
||||||
|
apiVersion: build.openshift.io/v1
|
||||||
|
metadata:
|
||||||
|
name: "{{ build_config }}"
|
||||||
|
spec:
|
||||||
|
source:
|
||||||
|
dockerfile: |
|
||||||
|
FROM openshift/ruby-22-centos7
|
||||||
|
RUN sleep 60s
|
||||||
|
USER ansible
|
||||||
|
strategy:
|
||||||
|
type: Docker
|
||||||
|
output:
|
||||||
|
to:
|
||||||
|
kind: "ImageStreamTag"
|
||||||
|
name: "{{ is_name }}:latest"
|
||||||
|
|
||||||
|
- name: Start Build from Build configuration
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
build_config_name: "{{ build_config }}"
|
||||||
|
register: new_build
|
||||||
|
|
||||||
|
- name: Assert that a build has been created
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- new_build is changed
|
||||||
|
- new_build.builds.0.metadata.name == "{{ build_config }}-1"
|
||||||
|
|
||||||
|
- name: Start a new Build from previous Build
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
build_name: "{{ new_build.builds.0.metadata.name }}"
|
||||||
|
register: rerun_build
|
||||||
|
|
||||||
|
- name: Assert that another build has been created
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- rerun_build is changed
|
||||||
|
- rerun_build.builds.0.metadata.name == "{{ build_config }}-2"
|
||||||
|
|
||||||
|
- name: Cancel first build created
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
build_name: "{{ build_config }}-1"
|
||||||
|
state: cancelled
|
||||||
|
wait: yes
|
||||||
|
register: cancel
|
||||||
|
|
||||||
|
- name: Assert that the Build was cancelled
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- cancel is changed
|
||||||
|
- cancel.builds | length == 1
|
||||||
|
- cancel.builds.0.metadata.name == "{{ build_config }}-1"
|
||||||
|
- cancel.builds.0.metadata.namespace == "{{ build_ns }}"
|
||||||
|
- cancel.builds.0.status.cancelled
|
||||||
|
|
||||||
|
- name: Get Build info
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
version: build.openshift.io/v1
|
||||||
|
kind: Build
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
name: "{{ cancel.builds.0.metadata.name }}"
|
||||||
|
register: build
|
||||||
|
|
||||||
|
- name: Assert that build phase is cancelled
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- build.resources | length == 1
|
||||||
|
- build.resources.0.status.cancelled
|
||||||
|
- build.resources.0.status.phase == 'Cancelled'
|
||||||
|
|
||||||
|
- name: Cancel and restart Build using build config name
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
build_config_name: "{{ build_config }}"
|
||||||
|
state: restarted
|
||||||
|
build_phases:
|
||||||
|
- Running
|
||||||
|
- New
|
||||||
|
register: restart
|
||||||
|
|
||||||
|
- name: assert that new build was created
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- restart is changed
|
||||||
|
- restart.builds | length == 1
|
||||||
|
- 'restart.builds.0.metadata.name == "{{ build_config }}-3"'
|
||||||
|
|
||||||
|
- name: Get Build 2 info
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
version: build.openshift.io/v1
|
||||||
|
kind: Build
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
name: "{{ build_config }}-2"
|
||||||
|
register: build
|
||||||
|
|
||||||
|
- name: Assert that build phase is cancelled
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- build.resources | length == 1
|
||||||
|
- build.resources.0.status.cancelled
|
||||||
|
- build.resources.0.status.phase == 'Cancelled'
|
||||||
|
|
||||||
|
- name: Get Build info
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
version: build.openshift.io/v1
|
||||||
|
kind: Build
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
name: "{{ build_config }}-3"
|
||||||
|
register: build
|
||||||
|
|
||||||
|
- name: Assert that Build is not cancelled
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- build.resources | length == 1
|
||||||
|
- '"cancelled" not in build.resources.0.status'
|
||||||
|
- "build.resources.0.status.phase in ('New', 'Pending', 'Running')"
|
||||||
|
|
||||||
|
- name: Prune Builds keep younger than 30min
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
keep_younger_than: 30
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: prune
|
||||||
|
check_mode: yes
|
||||||
|
|
||||||
|
- name: Assert that no Builds were found
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- not prune.changed
|
||||||
|
- prune.builds | length == 0
|
||||||
|
|
||||||
|
- name: Prune Builds without namespace
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
register: prune_without_ns
|
||||||
|
check_mode: yes
|
||||||
|
|
||||||
|
- name: Assert that completed build are candidate for prune
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- prune_without_ns is changed
|
||||||
|
- prune_without_ns.builds | length > 0
|
||||||
|
- '"{{ build_config }}-1" in build_names'
|
||||||
|
- '"{{ build_config }}-2" in build_names'
|
||||||
|
vars:
|
||||||
|
build_names: '{{ prune_without_ns.builds | map(attribute="metadata") | flatten | map(attribute="name") | list }}'
|
||||||
|
|
||||||
|
- name: Prune Builds using namespace
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: prune_with_ns
|
||||||
|
check_mode: yes
|
||||||
|
|
||||||
|
- name: Assert that prune operation found the completed build
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- prune_with_ns is changed
|
||||||
|
- prune_with_ns.builds | length == 2
|
||||||
|
|
||||||
|
- name: Check Build before prune
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
kind: Build
|
||||||
|
api_version: build.openshift.io/v1
|
||||||
|
name: "{{ build_config }}-1"
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: resource
|
||||||
|
|
||||||
|
- name: Validate that any previous build operation executed with check_mode did not deleted the build
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- resource.resources | length == 1
|
||||||
|
|
||||||
|
- name: Execute prune operation
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: prune
|
||||||
|
|
||||||
|
- name: assert prune is changed
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- prune is changed
|
||||||
|
|
||||||
|
- name: Check Build
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
kind: Build
|
||||||
|
api_version: build.openshift.io/v1
|
||||||
|
name: "{{ build_config }}-1"
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: resource
|
||||||
|
|
||||||
|
- name: Assert that the Build does not exist anymore
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- resource.resources | length == 0
|
||||||
|
|
||||||
|
- name: Check Build
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
kind: Build
|
||||||
|
api_version: build.openshift.io/v1
|
||||||
|
name: "{{ build_config }}-2"
|
||||||
|
namespace: "{{ build_ns }}"
|
||||||
|
register: resource
|
||||||
|
|
||||||
|
- name: Assert that the Build does not exist anymore
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- resource.resources | length == 0
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Ensure namespace is deleted
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
state: absent
|
||||||
|
kind: Namespace
|
||||||
|
name: "{{ build_ns }}"
|
||||||
|
ignore_errors: true
|
||||||
@@ -204,25 +204,12 @@
|
|||||||
- stream.resources | length == 1
|
- stream.resources | length == 1
|
||||||
- '"tags" not in stream.resources.0.status'
|
- '"tags" not in stream.resources.0.status'
|
||||||
|
|
||||||
- name: Validate that Image was deleted
|
|
||||||
kubernetes.core.k8s_info:
|
|
||||||
version: image.openshift.io/v1
|
|
||||||
kind: Image
|
|
||||||
name: "{{ is_image_name }}"
|
|
||||||
register: image
|
|
||||||
|
|
||||||
- name: Assert that image was deleted
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- image.resources | length == 0
|
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete namespace
|
- name: Delete namespace
|
||||||
community.okd.k8s:
|
community.okd.k8s:
|
||||||
name: "{{ prune_ns }}"
|
name: "{{ prune_ns }}"
|
||||||
kind: Namespace
|
kind: Namespace
|
||||||
state: absent
|
state: absent
|
||||||
wait: yes
|
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
when:
|
when:
|
||||||
|
|||||||
@@ -97,7 +97,6 @@
|
|||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- unknown_kind is successful
|
- unknown_kind is successful
|
||||||
- "'warnings' in unknown_kind"
|
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: remove custom resource
|
- name: remove custom resource
|
||||||
|
|||||||
@@ -22,4 +22,4 @@
|
|||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- k8s_no_validate is failed
|
- k8s_no_validate is failed
|
||||||
- "k8s_no_validate.msg == 'kubernetes-validate python library is required to validate resources'"
|
- k8s_no_validate.msg.startswith('Failed to import the required Python library (kubernetes-validate)')
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
- import_tasks: tasks/openshift_adm_prune_auth_clusterroles.yml
|
- import_tasks: tasks/openshift_adm_prune_auth_clusterroles.yml
|
||||||
- import_tasks: tasks/openshift_adm_prune_auth_roles.yml
|
- import_tasks: tasks/openshift_adm_prune_auth_roles.yml
|
||||||
- import_tasks: tasks/openshift_adm_prune_deployments.yml
|
- import_tasks: tasks/openshift_adm_prune_deployments.yml
|
||||||
|
- import_tasks: tasks/openshift_builds.yml
|
||||||
- import_tasks: tasks/openshift_route.yml
|
- import_tasks: tasks/openshift_route.yml
|
||||||
- import_tasks: tasks/openshift_import_images.yml
|
- import_tasks: tasks/openshift_import_images.yml
|
||||||
- import_tasks: tasks/openshift_prune_images.yml
|
- import_tasks: tasks/openshift_prune_images.yml
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ __metaclass__ = type
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
author:
|
author:
|
||||||
- xuxinkun
|
- xuxinkun (@xuxinkun)
|
||||||
|
|
||||||
connection: oc
|
name: oc
|
||||||
|
|
||||||
short_description: Execute tasks in pods running on OpenShift.
|
short_description: Execute tasks in pods running on OpenShift.
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ __metaclass__ = type
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
name: openshift
|
name: openshift
|
||||||
plugin_type: inventory
|
|
||||||
author:
|
author:
|
||||||
- Chris Houseknecht <@chouseknecht>
|
- Chris Houseknecht (@chouseknecht)
|
||||||
|
|
||||||
short_description: OpenShift inventory source
|
short_description: OpenShift inventory source
|
||||||
|
|
||||||
@@ -113,8 +112,13 @@ connections:
|
|||||||
context: 'awx/192-168-64-4:8443/developer'
|
context: 'awx/192-168-64-4:8443/developer'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
|
try:
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import get_api_client
|
from ansible_collections.kubernetes.core.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import get_api_client
|
||||||
|
HAS_KUBERNETES_COLLECTION = True
|
||||||
|
except ImportError as e:
|
||||||
|
HAS_KUBERNETES_COLLECTION = False
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
@@ -128,7 +132,14 @@ class InventoryModule(K8sInventoryModule):
|
|||||||
connection_plugin = 'community.okd.oc'
|
connection_plugin = 'community.okd.oc'
|
||||||
transport = 'oc'
|
transport = 'oc'
|
||||||
|
|
||||||
|
def check_kubernetes_collection(self):
|
||||||
|
if not HAS_KUBERNETES_COLLECTION:
|
||||||
|
raise K8sInventoryException(
|
||||||
|
"The kubernetes.core collection must be installed"
|
||||||
|
)
|
||||||
|
|
||||||
def fetch_objects(self, connections):
|
def fetch_objects(self, connections):
|
||||||
|
self.check_kubernetes_collection()
|
||||||
super(InventoryModule, self).fetch_objects(connections)
|
super(InventoryModule, self).fetch_objects(connections)
|
||||||
|
|
||||||
if connections:
|
if connections:
|
||||||
@@ -152,6 +163,7 @@ class InventoryModule(K8sInventoryModule):
|
|||||||
self.get_routes_for_namespace(client, name, namespace)
|
self.get_routes_for_namespace(client, name, namespace)
|
||||||
|
|
||||||
def get_routes_for_namespace(self, client, name, namespace):
|
def get_routes_for_namespace(self, client, name, namespace):
|
||||||
|
self.check_kubernetes_collection()
|
||||||
v1_route = client.resources.get(api_version='route.openshift.io/v1', kind='Route')
|
v1_route = client.resources.get(api_version='route.openshift.io/v1', kind='Route')
|
||||||
try:
|
try:
|
||||||
obj = v1_route.get(namespace=namespace)
|
obj = v1_route.get(namespace=namespace)
|
||||||
|
|||||||
+85
-51
@@ -6,79 +6,113 @@ __metaclass__ = type
|
|||||||
import re
|
import re
|
||||||
import operator
|
import operator
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
import traceback
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import create_definitions
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import CoreException
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError, NotFoundError, ForbiddenError
|
from kubernetes.dynamic.exceptions import DynamicApiError, NotFoundError, ForbiddenError
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
pass
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
|
|
||||||
TRIGGER_ANNOTATION = 'image.openshift.io/triggers'
|
TRIGGER_ANNOTATION = 'image.openshift.io/triggers'
|
||||||
TRIGGER_CONTAINER = re.compile(r"(?P<path>.*)\[((?P<index>[0-9]+)|\?\(@\.name==[\"'\\]*(?P<name>[a-z0-9]([-a-z0-9]*[a-z0-9])?))")
|
TRIGGER_CONTAINER = re.compile(r"(?P<path>.*)\[((?P<index>[0-9]+)|\?\(@\.name==[\"'\\]*(?P<name>[a-z0-9]([-a-z0-9]*[a-z0-9])?))")
|
||||||
|
|
||||||
|
|
||||||
class OKDRawModule(K8sAnsibleMixin):
|
class OKDRawModule(AnsibleOpenshiftModule):
|
||||||
|
|
||||||
def __init__(self, module, k8s_kind=None, *args, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
|
||||||
self.client = get_api_client(module=module)
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.params = self.module.params
|
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.fail = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
super(OKDRawModule, self).__init__(module, *args, **kwargs)
|
super(OKDRawModule, self).__init__(**kwargs)
|
||||||
|
|
||||||
self.warnings = []
|
@property
|
||||||
|
def module(self):
|
||||||
|
return self._module
|
||||||
|
|
||||||
self.kind = k8s_kind or self.params.get('kind')
|
def execute_module(self):
|
||||||
self.api_version = self.params.get('api_version')
|
results = []
|
||||||
self.name = self.params.get('name')
|
changed = False
|
||||||
self.namespace = self.params.get('namespace')
|
|
||||||
|
|
||||||
self.check_library_version()
|
try:
|
||||||
self.set_resource_definitions(module)
|
definitions = create_definitions(self.params)
|
||||||
|
except Exception as e:
|
||||||
|
msg = "Failed to load resource definition: {0}".format(e)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
def perform_action(self, resource, definition):
|
for definition in definitions:
|
||||||
state = self.params.get('state', None)
|
result = {"changed": False, "result": {}}
|
||||||
name = definition['metadata'].get('name')
|
warnings = []
|
||||||
namespace = definition['metadata'].get('namespace')
|
|
||||||
|
|
||||||
if state != 'absent':
|
if self.params.get("state") != 'absent':
|
||||||
|
existing = None
|
||||||
|
name = definition.get("metadata", {}).get("name")
|
||||||
|
namespace = definition.get("metadata", {}).get("namespace")
|
||||||
|
if definition.get("kind") in ['Project', 'ProjectRequest']:
|
||||||
|
try:
|
||||||
|
resource = self.svc.find_resource(kind=definition.get("kind"), api_version=definition.get("apiVersion", "v1"))
|
||||||
|
existing = resource.get(name=name, namespace=namespace).to_dict()
|
||||||
|
except (NotFoundError, ForbiddenError):
|
||||||
|
result = self.create_project_request(definition)
|
||||||
|
changed |= result["changed"]
|
||||||
|
results.append(result)
|
||||||
|
continue
|
||||||
|
except DynamicApiError as exc:
|
||||||
|
self.fail_json(msg='Failed to retrieve requested object: {0}'.format(exc.body),
|
||||||
|
error=exc.status, status=exc.status, reason=exc.reason)
|
||||||
|
|
||||||
if resource.kind in ['Project', 'ProjectRequest']:
|
if definition.get("kind") not in ['Project', 'ProjectRequest']:
|
||||||
try:
|
try:
|
||||||
resource.get(name, namespace)
|
resource = self.svc.find_resource(kind=definition.get("kind"), api_version=definition.get("apiVersion", "v1"))
|
||||||
except (NotFoundError, ForbiddenError):
|
existing = resource.get(name=name, namespace=namespace).to_dict()
|
||||||
return self.create_project_request(definition)
|
except Exception:
|
||||||
except DynamicApiError as exc:
|
existing = None
|
||||||
self.fail_json(msg='Failed to retrieve requested object: {0}'.format(exc.body),
|
|
||||||
error=exc.status, status=exc.status, reason=exc.reason)
|
if existing:
|
||||||
|
if resource.kind == 'DeploymentConfig':
|
||||||
|
if definition.get('spec', {}).get('triggers'):
|
||||||
|
definition = self.resolve_imagestream_triggers(existing, definition)
|
||||||
|
elif existing['metadata'].get('annotations', {}).get(TRIGGER_ANNOTATION):
|
||||||
|
definition = self.resolve_imagestream_trigger_annotation(existing, definition)
|
||||||
|
|
||||||
|
if self.params.get("validate") is not None:
|
||||||
|
warnings = self.validate(definition)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
existing = resource.get(name=name, namespace=namespace).to_dict()
|
result = self.perform_action(definition, self.params)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
existing = None
|
try:
|
||||||
|
error = e.result
|
||||||
|
except AttributeError:
|
||||||
|
error = {}
|
||||||
|
try:
|
||||||
|
error["reason"] = e.__cause__.reason
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
error["msg"] = to_native(e)
|
||||||
|
if warnings:
|
||||||
|
error.setdefault("warnings", []).extend(warnings)
|
||||||
|
|
||||||
if existing:
|
if self.params.get("continue_on_error"):
|
||||||
if resource.kind == 'DeploymentConfig':
|
result["error"] = error
|
||||||
if definition.get('spec', {}).get('triggers'):
|
else:
|
||||||
definition = self.resolve_imagestream_triggers(existing, definition)
|
self.fail_json(**error)
|
||||||
elif existing['metadata'].get('annotations', {}).get(TRIGGER_ANNOTATION):
|
|
||||||
definition = self.resolve_imagestream_trigger_annotation(existing, definition)
|
|
||||||
|
|
||||||
return super(OKDRawModule, self).perform_action(resource, definition)
|
if warnings:
|
||||||
|
result.setdefault("warnings", []).extend(warnings)
|
||||||
|
changed |= result["changed"]
|
||||||
|
results.append(result)
|
||||||
|
|
||||||
|
if len(results) == 1:
|
||||||
|
self.exit_json(**results[0])
|
||||||
|
|
||||||
|
self.exit_json(**{"changed": changed, "result": {"results": results}})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_index(desired, objects, keys):
|
def get_index(desired, objects, keys):
|
||||||
@@ -173,7 +207,7 @@ class OKDRawModule(K8sAnsibleMixin):
|
|||||||
def create_project_request(self, definition):
|
def create_project_request(self, definition):
|
||||||
definition['kind'] = 'ProjectRequest'
|
definition['kind'] = 'ProjectRequest'
|
||||||
result = {'changed': False, 'result': {}}
|
result = {'changed': False, 'result': {}}
|
||||||
resource = self.find_resource('ProjectRequest', definition['apiVersion'], fail=True)
|
resource = self.svc.find_resource(kind='ProjectRequest', api_version=definition['apiVersion'], fail=True)
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
try:
|
try:
|
||||||
k8s_obj = resource.create(definition)
|
k8s_obj = resource.create(definition)
|
||||||
|
|||||||
@@ -3,20 +3,9 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes import client
|
from kubernetes import client
|
||||||
@@ -25,24 +14,9 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftAdmPruneAuth(K8sAnsibleMixin):
|
class OpenShiftAdmPruneAuth(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftAdmPruneAuth, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.module.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftAdmPruneAuth, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
def prune_resource_binding(self, kind, api_version, ref_kind, ref_namespace_names, propagation_policy=None):
|
def prune_resource_binding(self, kind, api_version, ref_kind, ref_namespace_names, propagation_policy=None):
|
||||||
|
|
||||||
@@ -92,7 +66,7 @@ class OpenShiftAdmPruneAuth(K8sAnsibleMixin):
|
|||||||
def update_resource_binding(self, ref_kind, ref_names, namespaced=False):
|
def update_resource_binding(self, ref_kind, ref_names, namespaced=False):
|
||||||
|
|
||||||
kind = 'ClusterRoleBinding'
|
kind = 'ClusterRoleBinding'
|
||||||
api_version = "rbac.authorization.k8s.io/v1",
|
api_version = "rbac.authorization.k8s.io/v1"
|
||||||
if namespaced:
|
if namespaced:
|
||||||
kind = "RoleBinding"
|
kind = "RoleBinding"
|
||||||
resource = self.find_resource(kind=kind, api_version=api_version, fail=True)
|
resource = self.find_resource(kind=kind, api_version=api_version, fail=True)
|
||||||
|
|||||||
@@ -4,20 +4,10 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes import client
|
from kubernetes import client
|
||||||
@@ -40,24 +30,10 @@ def get_deploymentconfig_for_replicationcontroller(replica_controller):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftAdmPruneDeployment(K8sAnsibleMixin):
|
class OpenShiftAdmPruneDeployment(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
|
||||||
self.module = module
|
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
def __init__(self, **kwargs):
|
||||||
self.module.fail_json(
|
super(OpenShiftAdmPruneDeployment, self).__init__(**kwargs)
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftAdmPruneDeployment, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
def filter_replication_controller(self, replicacontrollers):
|
def filter_replication_controller(self, replicacontrollers):
|
||||||
def _deployment(obj):
|
def _deployment(obj):
|
||||||
@@ -107,7 +83,7 @@ class OpenShiftAdmPruneDeployment(K8sAnsibleMixin):
|
|||||||
results = filter(pred, results)
|
results = filter(pred, results)
|
||||||
return list(results)
|
return list(results)
|
||||||
|
|
||||||
def execute(self):
|
def execute_module(self):
|
||||||
# list replicationcontroller candidate for pruning
|
# list replicationcontroller candidate for pruning
|
||||||
kind = 'ReplicationController'
|
kind = 'ReplicationController'
|
||||||
api_version = 'v1'
|
api_version = 'v1'
|
||||||
|
|||||||
@@ -4,23 +4,13 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
import traceback
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_images_common import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_images_common import (
|
||||||
OpenShiftAnalyzeImageStream,
|
OpenShiftAnalyzeImageStream,
|
||||||
@@ -100,36 +90,9 @@ def determine_host_registry(module, images, image_streams):
|
|||||||
return result['hostname']
|
return result['hostname']
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftAdmPruneImages(K8sAnsibleMixin):
|
class OpenShiftAdmPruneImages(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftAdmPruneImages, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftAdmPruneImages, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
try:
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
except DynamicApiError as e:
|
|
||||||
self.fail_json(
|
|
||||||
msg="Failed to get kubernetes client.",
|
|
||||||
reason=e.reason,
|
|
||||||
status=e.status,
|
|
||||||
)
|
|
||||||
except Exception as e:
|
|
||||||
self.fail_json(
|
|
||||||
msg="Failed to get kubernetes client.",
|
|
||||||
error=to_native(e)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.max_creation_timestamp = self.get_max_creation_timestamp()
|
self.max_creation_timestamp = self.get_max_creation_timestamp()
|
||||||
self._rest_client = None
|
self._rest_client = None
|
||||||
@@ -237,7 +200,7 @@ class OpenShiftAdmPruneImages(K8sAnsibleMixin):
|
|||||||
result = definition
|
result = definition
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
try:
|
try:
|
||||||
result = self.client.request(
|
result = self.request(
|
||||||
"PUT",
|
"PUT",
|
||||||
"/apis/{api_version}/namespaces/{namespace}/imagestreams/{name}/status".format(
|
"/apis/{api_version}/namespaces/{namespace}/imagestreams/{name}/status".format(
|
||||||
api_version=api_version,
|
api_version=api_version,
|
||||||
|
|||||||
@@ -0,0 +1,408 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
from datetime import datetime, timezone, timedelta
|
||||||
|
import time
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
|
|
||||||
|
try:
|
||||||
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
|
except ImportError as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftBuilds(AnsibleOpenshiftModule):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(OpenShiftBuilds, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
def get_build_config(self, name, namespace):
|
||||||
|
params = dict(
|
||||||
|
kind="BuildConfig",
|
||||||
|
api_version="build.openshift.io/v1",
|
||||||
|
name=name,
|
||||||
|
namespace=namespace,
|
||||||
|
)
|
||||||
|
result = self.kubernetes_facts(**params)
|
||||||
|
return result["resources"]
|
||||||
|
|
||||||
|
def clone_build(self, name, namespace, request):
|
||||||
|
try:
|
||||||
|
result = self.request(
|
||||||
|
method="POST",
|
||||||
|
path="/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}/clone".format(
|
||||||
|
namespace=namespace,
|
||||||
|
name=name
|
||||||
|
),
|
||||||
|
body=request,
|
||||||
|
content_type="application/json",
|
||||||
|
)
|
||||||
|
return result.to_dict()
|
||||||
|
except DynamicApiError as exc:
|
||||||
|
msg = "Failed to clone Build %s/%s due to: %s" % (namespace, name, exc.body)
|
||||||
|
self.fail_json(msg=msg, status=exc.status, reason=exc.reason)
|
||||||
|
except Exception as e:
|
||||||
|
msg = "Failed to clone Build %s/%s due to: %s" % (namespace, name, to_native(e))
|
||||||
|
self.fail_json(msg=msg, error=to_native(e), exception=e)
|
||||||
|
|
||||||
|
def instantiate_build_config(self, name, namespace, request):
|
||||||
|
try:
|
||||||
|
result = self.request(
|
||||||
|
method="POST",
|
||||||
|
path="/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}/instantiate".format(
|
||||||
|
namespace=namespace,
|
||||||
|
name=name
|
||||||
|
),
|
||||||
|
body=request,
|
||||||
|
content_type="application/json",
|
||||||
|
)
|
||||||
|
return result.to_dict()
|
||||||
|
except DynamicApiError as exc:
|
||||||
|
msg = "Failed to instantiate BuildConfig %s/%s due to: %s" % (namespace, name, exc.body)
|
||||||
|
self.fail_json(msg=msg, status=exc.status, reason=exc.reason)
|
||||||
|
except Exception as e:
|
||||||
|
msg = "Failed to instantiate BuildConfig %s/%s due to: %s" % (namespace, name, to_native(e))
|
||||||
|
self.fail_json(msg=msg, error=to_native(e), exception=e)
|
||||||
|
|
||||||
|
def start_build(self):
|
||||||
|
|
||||||
|
result = None
|
||||||
|
name = self.params.get("build_config_name")
|
||||||
|
if not name:
|
||||||
|
name = self.params.get("build_name")
|
||||||
|
|
||||||
|
build_request = {
|
||||||
|
"kind": "BuildRequest",
|
||||||
|
"apiVersion": "build.openshift.io/v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": name
|
||||||
|
},
|
||||||
|
"triggeredBy": [
|
||||||
|
{"message": "Manually triggered"}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Overrides incremental
|
||||||
|
incremental = self.params.get("incremental")
|
||||||
|
if incremental is not None:
|
||||||
|
build_request.update(
|
||||||
|
{
|
||||||
|
"sourceStrategyOptions": {
|
||||||
|
"incremental": incremental
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Environment variable
|
||||||
|
if self.params.get("env_vars"):
|
||||||
|
build_request.update(
|
||||||
|
{
|
||||||
|
"env": self.params.get("env_vars")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Docker strategy option
|
||||||
|
if self.params.get("build_args"):
|
||||||
|
build_request.update(
|
||||||
|
{
|
||||||
|
"dockerStrategyOptions": {
|
||||||
|
"buildArgs": self.params.get("build_args")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# caching option
|
||||||
|
no_cache = self.params.get("no_cache")
|
||||||
|
if no_cache is not None:
|
||||||
|
build_request.update(
|
||||||
|
{
|
||||||
|
"dockerStrategyOptions": {
|
||||||
|
"noCache": no_cache
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# commit
|
||||||
|
if self.params.get("commit"):
|
||||||
|
build_request.update(
|
||||||
|
{
|
||||||
|
"revision": {
|
||||||
|
"git": {
|
||||||
|
"commit": self.params.get("commit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.params.get("build_config_name"):
|
||||||
|
# Instantiate Build from Build config
|
||||||
|
result = self.instantiate_build_config(
|
||||||
|
name=self.params.get("build_config_name"),
|
||||||
|
namespace=self.params.get("namespace"),
|
||||||
|
request=build_request
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Re-run Build
|
||||||
|
result = self.clone_build(
|
||||||
|
name=self.params.get("build_name"),
|
||||||
|
namespace=self.params.get("namespace"),
|
||||||
|
request=build_request
|
||||||
|
)
|
||||||
|
|
||||||
|
if result and self.params.get("wait"):
|
||||||
|
start = datetime.now()
|
||||||
|
|
||||||
|
def _total_wait_time():
|
||||||
|
return (datetime.now() - start).seconds
|
||||||
|
|
||||||
|
wait_timeout = self.params.get("wait_timeout")
|
||||||
|
wait_sleep = self.params.get("wait_sleep")
|
||||||
|
last_status_phase = None
|
||||||
|
while _total_wait_time() < wait_timeout:
|
||||||
|
params = dict(
|
||||||
|
kind=result["kind"],
|
||||||
|
api_version=result["apiVersion"],
|
||||||
|
name=result["metadata"]["name"],
|
||||||
|
namespace=result["metadata"]["namespace"],
|
||||||
|
)
|
||||||
|
facts = self.kubernetes_facts(**params)
|
||||||
|
if len(facts["resources"]) > 0:
|
||||||
|
last_status_phase = facts["resources"][0]["status"]["phase"]
|
||||||
|
if last_status_phase == "Complete":
|
||||||
|
result = facts["resources"][0]
|
||||||
|
break
|
||||||
|
elif last_status_phase in ("Cancelled", "Error", "Failed"):
|
||||||
|
self.fail_json(
|
||||||
|
msg="Unexpected status for Build %s/%s: %s" % (
|
||||||
|
result["metadata"]["name"],
|
||||||
|
result["metadata"]["namespace"],
|
||||||
|
last_status_phase
|
||||||
|
)
|
||||||
|
)
|
||||||
|
time.sleep(wait_sleep)
|
||||||
|
|
||||||
|
if last_status_phase != "Complete":
|
||||||
|
name = result["metadata"]["name"]
|
||||||
|
namespace = result["metadata"]["namespace"]
|
||||||
|
msg = "Build %s/%s has not complete after %d second(s)," \
|
||||||
|
"current status is %s" % (namespace, name, wait_timeout, last_status_phase)
|
||||||
|
|
||||||
|
self.fail_json(msg=msg)
|
||||||
|
|
||||||
|
result = [result] if result else []
|
||||||
|
self.exit_json(changed=True, builds=result)
|
||||||
|
|
||||||
|
def cancel_build(self, restart):
|
||||||
|
|
||||||
|
kind = 'Build'
|
||||||
|
api_version = 'build.openshift.io/v1'
|
||||||
|
|
||||||
|
namespace = self.params.get("namespace")
|
||||||
|
phases = ["new", "pending", "running"]
|
||||||
|
build_phases = self.params.get("build_phases", [])
|
||||||
|
if build_phases:
|
||||||
|
phases = [p.lower() for p in build_phases]
|
||||||
|
|
||||||
|
names = []
|
||||||
|
if self.params.get("build_name"):
|
||||||
|
names.append(self.params.get("build_name"))
|
||||||
|
else:
|
||||||
|
build_config = self.params.get("build_config_name")
|
||||||
|
# list all builds from namespace
|
||||||
|
params = dict(
|
||||||
|
kind=kind,
|
||||||
|
api_version=api_version,
|
||||||
|
namespace=namespace
|
||||||
|
)
|
||||||
|
resources = self.kubernetes_facts(**params).get("resources", [])
|
||||||
|
|
||||||
|
def _filter_builds(build):
|
||||||
|
config = build["metadata"].get("labels", {}).get("openshift.io/build-config.name")
|
||||||
|
return build_config is None or (build_config is not None and config in build_config)
|
||||||
|
|
||||||
|
for item in list(filter(_filter_builds, resources)):
|
||||||
|
name = item["metadata"]["name"]
|
||||||
|
if name not in names:
|
||||||
|
names.append(name)
|
||||||
|
|
||||||
|
if len(names) == 0:
|
||||||
|
self.exit_json(changed=False, msg="No Build found from namespace %s" % namespace)
|
||||||
|
|
||||||
|
warning = []
|
||||||
|
builds_to_cancel = []
|
||||||
|
for name in names:
|
||||||
|
params = dict(
|
||||||
|
kind=kind,
|
||||||
|
api_version=api_version,
|
||||||
|
name=name,
|
||||||
|
namespace=namespace
|
||||||
|
)
|
||||||
|
|
||||||
|
resource = self.kubernetes_facts(**params).get("resources", [])
|
||||||
|
if len(resource) == 0:
|
||||||
|
warning.append("Build %s/%s not found" % (namespace, name))
|
||||||
|
continue
|
||||||
|
|
||||||
|
resource = resource[0]
|
||||||
|
phase = resource["status"].get("phase").lower()
|
||||||
|
|
||||||
|
# Build status.phase is matching the requested state and is not completed
|
||||||
|
if phase in phases:
|
||||||
|
builds_to_cancel.append(resource)
|
||||||
|
else:
|
||||||
|
warning.append("build %s/%s is not in expected phase, found %s" % (namespace, name, phase))
|
||||||
|
|
||||||
|
changed = False
|
||||||
|
result = []
|
||||||
|
for build in builds_to_cancel:
|
||||||
|
# Set cancelled to true
|
||||||
|
build["status"]["cancelled"] = True
|
||||||
|
name = build["metadata"]["name"]
|
||||||
|
changed = True
|
||||||
|
try:
|
||||||
|
content_type = "application/json"
|
||||||
|
cancelled_build = self.request(
|
||||||
|
"PUT",
|
||||||
|
"/apis/build.openshift.io/v1/namespaces/{0}/builds/{1}".format(
|
||||||
|
namespace, name
|
||||||
|
),
|
||||||
|
body=build,
|
||||||
|
content_type=content_type,
|
||||||
|
).to_dict()
|
||||||
|
result.append(cancelled_build)
|
||||||
|
except DynamicApiError as exc:
|
||||||
|
self.fail_json(
|
||||||
|
msg="Failed to cancel Build %s/%s due to: %s" % (namespace, name, exc),
|
||||||
|
reason=exc.reason,
|
||||||
|
status=exc.status
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
self.fail_json(
|
||||||
|
msg="Failed to cancel Build %s/%s due to: %s" % (namespace, name, e)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make sure the build phase is really cancelled.
|
||||||
|
def _wait_until_cancelled(build, wait_timeout, wait_sleep):
|
||||||
|
start = datetime.now()
|
||||||
|
last_phase = None
|
||||||
|
name = build["metadata"]["name"]
|
||||||
|
while (datetime.now() - start).seconds < wait_timeout:
|
||||||
|
params = dict(
|
||||||
|
kind=kind,
|
||||||
|
api_version=api_version,
|
||||||
|
name=name,
|
||||||
|
namespace=namespace
|
||||||
|
)
|
||||||
|
resource = self.kubernetes_facts(**params).get("resources", [])
|
||||||
|
if len(resource) == 0:
|
||||||
|
return None, "Build %s/%s not found" % (namespace, name)
|
||||||
|
resource = resource[0]
|
||||||
|
last_phase = resource["status"]["phase"]
|
||||||
|
if last_phase == "Cancelled":
|
||||||
|
return resource, None
|
||||||
|
time.sleep(wait_sleep)
|
||||||
|
return None, "Build %s/%s is not cancelled as expected, current state is %s" % (namespace, name, last_phase)
|
||||||
|
|
||||||
|
if result and self.params.get("wait"):
|
||||||
|
wait_timeout = self.params.get("wait_timeout")
|
||||||
|
wait_sleep = self.params.get("wait_sleep")
|
||||||
|
|
||||||
|
wait_result = []
|
||||||
|
for build in result:
|
||||||
|
ret, err = _wait_until_cancelled(build, wait_timeout, wait_sleep)
|
||||||
|
if err:
|
||||||
|
self.exit_json(msg=err)
|
||||||
|
wait_result.append(ret)
|
||||||
|
result = wait_result
|
||||||
|
|
||||||
|
if restart:
|
||||||
|
self.start_build()
|
||||||
|
|
||||||
|
self.exit_json(builds=result, changed=changed)
|
||||||
|
|
||||||
|
def execute_module(self):
|
||||||
|
state = self.params.get("state")
|
||||||
|
if state == "started":
|
||||||
|
self.start_build()
|
||||||
|
else:
|
||||||
|
restart = bool(state == "restarted")
|
||||||
|
self.cancel_build(restart=restart)
|
||||||
|
|
||||||
|
|
||||||
|
class OpenShiftPruneBuilds(OpenShiftBuilds):
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(OpenShiftPruneBuilds, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
def execute_module(self):
|
||||||
|
# list replicationcontroller candidate for pruning
|
||||||
|
kind = 'Build'
|
||||||
|
api_version = 'build.openshift.io/v1'
|
||||||
|
resource = self.find_resource(kind=kind, api_version=api_version, fail=True)
|
||||||
|
|
||||||
|
self.max_creation_timestamp = None
|
||||||
|
keep_younger_than = self.params.get("keep_younger_than")
|
||||||
|
if keep_younger_than:
|
||||||
|
now = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||||
|
self.max_creation_timestamp = now - timedelta(minutes=keep_younger_than)
|
||||||
|
|
||||||
|
def _prunable_build(build):
|
||||||
|
return build["status"]["phase"] in ("Complete", "Failed", "Error", "Cancelled")
|
||||||
|
|
||||||
|
def _orphan_build(build):
|
||||||
|
if not _prunable_build(build):
|
||||||
|
return False
|
||||||
|
|
||||||
|
config = build["status"].get("config", None)
|
||||||
|
if not config:
|
||||||
|
return True
|
||||||
|
build_config = self.get_build_config(config["name"], config["namespace"])
|
||||||
|
return len(build_config) == 0
|
||||||
|
|
||||||
|
def _younger_build(build):
|
||||||
|
if not self.max_creation_timestamp:
|
||||||
|
return False
|
||||||
|
creation_timestamp = datetime.strptime(build['metadata']['creationTimestamp'], '%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
return creation_timestamp < self.max_creation_timestamp
|
||||||
|
|
||||||
|
predicates = [
|
||||||
|
_prunable_build,
|
||||||
|
]
|
||||||
|
if self.params.get("orphans"):
|
||||||
|
predicates.append(_orphan_build)
|
||||||
|
if self.max_creation_timestamp:
|
||||||
|
predicates.append(_younger_build)
|
||||||
|
|
||||||
|
# Get ReplicationController
|
||||||
|
params = dict(
|
||||||
|
kind=kind,
|
||||||
|
api_version=api_version,
|
||||||
|
namespace=self.params.get("namespace"),
|
||||||
|
)
|
||||||
|
result = self.kubernetes_facts(**params)
|
||||||
|
candidates = result["resources"]
|
||||||
|
for pred in predicates:
|
||||||
|
candidates = list(filter(pred, candidates))
|
||||||
|
|
||||||
|
if self.check_mode:
|
||||||
|
changed = len(candidates) > 0
|
||||||
|
self.exit_json(changed=changed, builds=candidates)
|
||||||
|
|
||||||
|
changed = False
|
||||||
|
for build in candidates:
|
||||||
|
changed = True
|
||||||
|
try:
|
||||||
|
name = build["metadata"]["name"]
|
||||||
|
namespace = build["metadata"]["namespace"]
|
||||||
|
resource.delete(name=name, namespace=namespace, body={})
|
||||||
|
except DynamicApiError as exc:
|
||||||
|
msg = "Failed to delete Build %s/%s due to: %s" % (namespace, name, exc.body)
|
||||||
|
self.fail_json(msg=msg, status=exc.status, reason=exc.reason)
|
||||||
|
except Exception as e:
|
||||||
|
msg = "Failed to delete Build %s/%s due to: %s" % (namespace, name, to_native(e))
|
||||||
|
self.fail_json(msg=msg, error=to_native(e), exception=e)
|
||||||
|
self.exit_json(changed=changed, builds=candidates)
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
from abc import abstractmethod
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import get_api_client
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import AnsibleK8SModule
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
||||||
|
K8sService,
|
||||||
|
diff_objects,
|
||||||
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import (
|
||||||
|
perform_action,
|
||||||
|
validate,
|
||||||
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
||||||
|
create_definitions,
|
||||||
|
merge_params,
|
||||||
|
flatten_list_kind,
|
||||||
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import CoreException
|
||||||
|
HAS_KUBERNETES_COLLECTION = True
|
||||||
|
k8s_collection_import_exception = None
|
||||||
|
K8S_COLLECTION_ERROR = None
|
||||||
|
except ImportError as e:
|
||||||
|
HAS_KUBERNETES_COLLECTION = False
|
||||||
|
k8s_collection_import_exception = e
|
||||||
|
K8S_COLLECTION_ERROR = traceback.format_exc()
|
||||||
|
|
||||||
|
|
||||||
|
class AnsibleOpenshiftModule(AnsibleK8SModule):
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(AnsibleOpenshiftModule, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
self.client = get_api_client(module=self)
|
||||||
|
self.fail = self.fail_json
|
||||||
|
|
||||||
|
self.svc = K8sService(self.client, self._module)
|
||||||
|
self.find_resource = self.svc.find_resource
|
||||||
|
self.kubernetes_facts = self.svc.find
|
||||||
|
|
||||||
|
if not HAS_KUBERNETES_COLLECTION:
|
||||||
|
self.fail_json(
|
||||||
|
msg="The kubernetes.core collection must be installed",
|
||||||
|
exception=K8S_COLLECTION_ERROR,
|
||||||
|
error=to_native(k8s_collection_import_exception),
|
||||||
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def module(self):
|
||||||
|
return self._module
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def execute_module(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def request(self, *args, **kwargs):
|
||||||
|
return self.client.client.request(*args, **kwargs)
|
||||||
|
|
||||||
|
def set_resource_definitions(self):
|
||||||
|
self.resource_definitions = create_definitions(self.params)
|
||||||
|
|
||||||
|
def perform_action(self, definition, params):
|
||||||
|
return perform_action(self.svc, definition, params)
|
||||||
|
|
||||||
|
def validate(self, definition):
|
||||||
|
validate(self.client, self, definition)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def merge_params(definition, params):
|
||||||
|
return merge_params(definition, params)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def flatten_list_kind(definition, params):
|
||||||
|
return flatten_list_kind(definition, params)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def diff_objects(existing, new):
|
||||||
|
return diff_objects(existing, new)
|
||||||
|
|
||||||
|
def run_module(self):
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.execute_module()
|
||||||
|
except CoreException as e:
|
||||||
|
self.fail_from_exception(e)
|
||||||
@@ -7,10 +7,8 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (K8sAnsibleMixin, get_api_client)
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
from ansible.module_utils.basic import missing_required_lib
|
||||||
@@ -26,20 +24,12 @@ from ansible_collections.community.okd.plugins.module_utils.openshift_ldap impor
|
|||||||
try:
|
try:
|
||||||
import ldap
|
import ldap
|
||||||
HAS_PYTHON_LDAP = True
|
HAS_PYTHON_LDAP = True
|
||||||
|
PYTHON_LDAP_ERROR = None
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_PYTHON_LDAP = False
|
HAS_PYTHON_LDAP = False
|
||||||
PYTHON_LDAP_ERROR = e
|
PYTHON_LDAP_ERROR = e
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
@@ -225,12 +215,11 @@ class OpenshiftLDAPGroups(object):
|
|||||||
name = definition["metadata"]["name"]
|
name = definition["metadata"]["name"]
|
||||||
existing = self.get_group_info(name=name)
|
existing = self.get_group_info(name=name)
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
|
method = "patch" if existing else "create"
|
||||||
try:
|
try:
|
||||||
if existing:
|
if existing:
|
||||||
method = 'patch'
|
|
||||||
definition = self.k8s_group_api.patch(definition).to_dict()
|
definition = self.k8s_group_api.patch(definition).to_dict()
|
||||||
else:
|
else:
|
||||||
method = 'create'
|
|
||||||
definition = self.k8s_group_api.create(definition).to_dict()
|
definition = self.k8s_group_api.create(definition).to_dict()
|
||||||
except DynamicApiError as exc:
|
except DynamicApiError as exc:
|
||||||
self.module.fail_json(msg="Failed to %s Group '%s' due to: %s" % (method, name, exc.body))
|
self.module.fail_json(msg="Failed to %s Group '%s' due to: %s" % (method, name, exc.body))
|
||||||
@@ -262,30 +251,11 @@ class OpenshiftLDAPGroups(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class OpenshiftGroupsSync(K8sAnsibleMixin):
|
class OpenshiftGroupsSync(AnsibleOpenshiftModule):
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
|
|
||||||
self.module = module
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.module.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
if not HAS_PYTHON_LDAP:
|
|
||||||
self.fail_json(
|
|
||||||
msg=missing_required_lib('python-ldap'), error=to_native(PYTHON_LDAP_ERROR)
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenshiftGroupsSync, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
|
super(OpenshiftGroupsSync, self).__init__(**kwargs)
|
||||||
self.__k8s_group_api = None
|
self.__k8s_group_api = None
|
||||||
self.__ldap_connection = None
|
self.__ldap_connection = None
|
||||||
self.host = None
|
self.host = None
|
||||||
@@ -294,6 +264,11 @@ class OpenshiftGroupsSync(K8sAnsibleMixin):
|
|||||||
self.scheme = None
|
self.scheme = None
|
||||||
self.config = self.params.get("sync_config")
|
self.config = self.params.get("sync_config")
|
||||||
|
|
||||||
|
if not HAS_PYTHON_LDAP:
|
||||||
|
self.fail_json(
|
||||||
|
msg=missing_required_lib('python-ldap'), error=to_native(PYTHON_LDAP_ERROR)
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def k8s_group_api(self):
|
def k8s_group_api(self):
|
||||||
if not self.__k8s_group_api:
|
if not self.__k8s_group_api:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from ansible.module_utils.six import iteritems
|
|||||||
|
|
||||||
|
|
||||||
def get_image_blobs(image):
|
def get_image_blobs(image):
|
||||||
blobs = [layer["image"] for layer in image["dockerImageLayers"]]
|
blobs = [layer["image"] for layer in image["dockerImageLayers"] if "image" in layer]
|
||||||
docker_image_metadata = image.get("dockerImageMetadata")
|
docker_image_metadata = image.get("dockerImageMetadata")
|
||||||
if not docker_image_metadata:
|
if not docker_image_metadata:
|
||||||
return blobs, "failed to read metadata for image %s" % image["metadata"]["name"]
|
return blobs, "failed to read metadata for image %s" % image["metadata"]["name"]
|
||||||
@@ -53,7 +53,7 @@ class OpenShiftAnalyzeImageStream(object):
|
|||||||
if error:
|
if error:
|
||||||
return error
|
return error
|
||||||
|
|
||||||
if len(result['hostname']) == 0 or len(result['namespace']) == 0:
|
if not result['hostname'] or not result['namespace']:
|
||||||
# image reference does not match hostname/namespace/name pattern - skipping
|
# image reference does not match hostname/namespace/name pattern - skipping
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -161,41 +161,35 @@ class OpenShiftAnalyzeImageStream(object):
|
|||||||
return name, tag, None
|
return name, tag, None
|
||||||
|
|
||||||
from_strategy = _determine_source_strategy()
|
from_strategy = _determine_source_strategy()
|
||||||
if not from_strategy:
|
if from_strategy:
|
||||||
# Build strategy not found
|
if from_strategy.get('kind') == "DockerImage":
|
||||||
return
|
docker_image_ref = from_strategy.get('name').strip()
|
||||||
|
if len(docker_image_ref) > 0:
|
||||||
if from_strategy.get('kind') == "DockerImage":
|
err = self.analyze_reference_image(docker_image_ref, referrer)
|
||||||
docker_image_ref = from_strategy.get('name').strip()
|
elif from_strategy.get('kind') == "ImageStreamImage":
|
||||||
if len(docker_image_ref) > 0:
|
name, tag, error = _parse_image_stream_image_name(from_strategy.get('name'))
|
||||||
err = self.analyze_reference_image(docker_image_ref, referrer)
|
if error:
|
||||||
|
if not self.ignore_invalid_refs:
|
||||||
elif from_strategy.get('kind') == "ImageStreamImage":
|
return error
|
||||||
name, tag, error = _parse_image_stream_image_name(from_strategy.get('name'))
|
else:
|
||||||
if error:
|
namespace = from_strategy.get('namespace') or namespace
|
||||||
if not self.ignore_invalid_refs:
|
self.used_images.append({
|
||||||
return error
|
'namespace': namespace,
|
||||||
else:
|
'name': name,
|
||||||
namespace = from_strategy.get('namespace') or namespace
|
'tag': tag
|
||||||
self.used_images.append({
|
})
|
||||||
'namespace': namespace,
|
elif from_strategy.get('kind') == "ImageStreamTag":
|
||||||
'name': name,
|
name, tag, error = _parse_image_stream_tag_name(from_strategy.get('name'))
|
||||||
'tag': tag
|
if error:
|
||||||
})
|
if not self.ignore_invalid_refs:
|
||||||
elif from_strategy.get('kind') == "ImageStreamTag":
|
return error
|
||||||
name, tag, error = _parse_image_stream_tag_name(from_strategy.get('name'))
|
else:
|
||||||
if error:
|
namespace = from_strategy.get('namespace') or namespace
|
||||||
if not self.ignore_invalid_refs:
|
self.used_tags.append({
|
||||||
return error
|
'namespace': namespace,
|
||||||
else:
|
'name': name,
|
||||||
namespace = from_strategy.get('namespace') or namespace
|
'tag': tag
|
||||||
self.used_tags.append({
|
})
|
||||||
'namespace': namespace,
|
|
||||||
'name': name,
|
|
||||||
'tag': tag
|
|
||||||
})
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def analyze_refs_from_build_strategy(self, resources):
|
def analyze_refs_from_build_strategy(self, resources):
|
||||||
# Json Path is always spec.strategy
|
# Json Path is always spec.strategy
|
||||||
@@ -212,7 +206,7 @@ class OpenShiftAnalyzeImageStream(object):
|
|||||||
error = self.analyze_refs_from_strategy(obj['spec']['strategy'],
|
error = self.analyze_refs_from_strategy(obj['spec']['strategy'],
|
||||||
obj['metadata']['namespace'],
|
obj['metadata']['namespace'],
|
||||||
referrer)
|
referrer)
|
||||||
if not error:
|
if error is not None:
|
||||||
return "%s/%s/%s: %s" % (referrer["kind"], referrer["namespace"], referrer["name"], error)
|
return "%s/%s/%s: %s" % (referrer["kind"], referrer["namespace"], referrer["name"], error)
|
||||||
|
|
||||||
def analyze_image_stream(self, resources):
|
def analyze_image_stream(self, resources):
|
||||||
|
|||||||
@@ -3,23 +3,12 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import traceback
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
@@ -84,24 +73,9 @@ def follow_imagestream_tag_reference(stream, tag):
|
|||||||
multiple = True
|
multiple = True
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftImportImage(K8sAnsibleMixin):
|
class OpenShiftImportImage(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftImportImage, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftImportImage, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
self._rest_client = None
|
self._rest_client = None
|
||||||
self.registryhost = self.params.get('registry_url')
|
self.registryhost = self.params.get('registry_url')
|
||||||
@@ -339,7 +313,7 @@ class OpenShiftImportImage(K8sAnsibleMixin):
|
|||||||
if not result["api_found"]:
|
if not result["api_found"]:
|
||||||
msg = 'Failed to find API for resource with apiVersion "{0}" and kind "{1}"'.format(
|
msg = 'Failed to find API for resource with apiVersion "{0}" and kind "{1}"'.format(
|
||||||
api_version, kind
|
api_version, kind
|
||||||
),
|
)
|
||||||
self.fail_json(msg=msg)
|
self.fail_json(msg=msg)
|
||||||
imagestream = None
|
imagestream = None
|
||||||
if len(result["resources"]) > 0:
|
if len(result["resources"]) > 0:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def validate_ldap_sync_config(config):
|
|||||||
schemas.append(schema)
|
schemas.append(schema)
|
||||||
|
|
||||||
if len(schemas) == 0:
|
if len(schemas) == 0:
|
||||||
return "No schema-specific config was provided, should be one of %s" % schema_list
|
return "No schema-specific config was provided, should be one of %s" % ", ".join(schema_list)
|
||||||
if len(schemas) > 1:
|
if len(schemas) > 1:
|
||||||
return "Exactly one schema-specific config is required; found (%d) %s" % (len(schemas), ','.join(schemas))
|
return "Exactly one schema-specific config is required; found (%d) %s" % (len(schemas), ','.join(schemas))
|
||||||
|
|
||||||
|
|||||||
@@ -4,47 +4,21 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
try:
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError, NotFoundError
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError, NotFoundError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftProcess(K8sAnsibleMixin):
|
class OpenShiftProcess(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftProcess, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.module.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftProcess, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
def execute_module(self):
|
def execute_module(self):
|
||||||
v1_templates = self.find_resource(
|
v1_templates = self.find_resource(
|
||||||
@@ -74,7 +48,7 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
|||||||
template = None
|
template = None
|
||||||
|
|
||||||
if src or definition:
|
if src or definition:
|
||||||
self.set_resource_definitions(self.module)
|
self.set_resource_definitions()
|
||||||
if len(self.resource_definitions) < 1:
|
if len(self.resource_definitions) < 1:
|
||||||
self.fail_json(
|
self.fail_json(
|
||||||
"Unable to load a Template resource from src or resource_definition"
|
"Unable to load a Template resource from src or resource_definition"
|
||||||
@@ -99,7 +73,7 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
|||||||
reason=exc.reason,
|
reason=exc.reason,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(
|
self.fail_json(
|
||||||
msg="Failed to retrieve Template with name '{0}' in namespace '{1}': {2}".format(
|
msg="Failed to retrieve Template with name '{0}' in namespace '{1}': {2}".format(
|
||||||
name, namespace, to_native(exc)
|
name, namespace, to_native(exc)
|
||||||
),
|
),
|
||||||
@@ -132,7 +106,7 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
|||||||
reason=exc.reason,
|
reason=exc.reason,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(
|
self.fail_json(
|
||||||
msg="Server failed to render the Template: {0}".format(to_native(exc)),
|
msg="Server failed to render the Template: {0}".format(to_native(exc)),
|
||||||
error="",
|
error="",
|
||||||
status="",
|
status="",
|
||||||
@@ -144,16 +118,41 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
|||||||
result["resources"] = response["objects"]
|
result["resources"] = response["objects"]
|
||||||
|
|
||||||
if state != "rendered":
|
if state != "rendered":
|
||||||
self.resource_definitions = response["objects"]
|
self.create_resources(response["objects"])
|
||||||
self.kind = self.api_version = self.name = None
|
|
||||||
self.namespace = self.params.get("namespace_target")
|
|
||||||
self.append_hash = False
|
|
||||||
self.apply = False
|
|
||||||
self.params["validate"] = None
|
|
||||||
self.params["merge_type"] = None
|
|
||||||
super(OpenShiftProcess, self).execute_module()
|
|
||||||
|
|
||||||
self.module.exit_json(**result)
|
self.exit_json(**result)
|
||||||
|
|
||||||
|
def create_resources(self, definitions):
|
||||||
|
|
||||||
|
params = {"namespace": self.params.get("namespace_target")}
|
||||||
|
|
||||||
|
self.params["apply"] = False
|
||||||
|
self.params["validate"] = None
|
||||||
|
|
||||||
|
changed = False
|
||||||
|
results = []
|
||||||
|
|
||||||
|
flattened_definitions = []
|
||||||
|
for definition in definitions:
|
||||||
|
if definition is None:
|
||||||
|
continue
|
||||||
|
kind = definition.get("kind")
|
||||||
|
if kind and kind.endswith("List"):
|
||||||
|
flattened_definitions.extend(
|
||||||
|
self.flatten_list_kind(definition, params)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
flattened_definitions.append(self.merge_params(definition, params))
|
||||||
|
|
||||||
|
for definition in flattened_definitions:
|
||||||
|
result = self.perform_action(definition, self.params)
|
||||||
|
changed = changed or result["changed"]
|
||||||
|
results.append(result)
|
||||||
|
|
||||||
|
if len(results) == 1:
|
||||||
|
self.exit_json(**results[0])
|
||||||
|
|
||||||
|
self.exit_json(**{"changed": changed, "result": {"results": results}})
|
||||||
|
|
||||||
def update_template_param(self, template, k, v):
|
def update_template_param(self, template, k, v):
|
||||||
for i, param in enumerate(template["parameters"]):
|
for i, param in enumerate(template["parameters"]):
|
||||||
|
|||||||
@@ -6,18 +6,7 @@ __metaclass__ = type
|
|||||||
import traceback
|
import traceback
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
|
|
||||||
try:
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_docker_image import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_docker_image import (
|
||||||
parse_docker_image_ref,
|
parse_docker_image_ref,
|
||||||
@@ -27,31 +16,16 @@ try:
|
|||||||
from requests import request
|
from requests import request
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
HAS_REQUESTS_MODULE = True
|
HAS_REQUESTS_MODULE = True
|
||||||
|
requests_import_exception = None
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_REQUESTS_MODULE = False
|
HAS_REQUESTS_MODULE = False
|
||||||
requests_import_exception = e
|
requests_import_exception = e
|
||||||
REQUESTS_MODULE_ERROR = traceback.format_exc()
|
REQUESTS_MODULE_ERROR = traceback.format_exc()
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftRegistry(K8sAnsibleMixin):
|
class OpenShiftRegistry(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftRegistry, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftRegistry, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
self.check = self.params.get("check")
|
self.check = self.params.get("check")
|
||||||
|
|
||||||
def list_image_streams(self, namespace=None):
|
def list_image_streams(self, namespace=None):
|
||||||
@@ -100,7 +74,7 @@ class OpenShiftRegistry(K8sAnsibleMixin):
|
|||||||
|
|
||||||
self.fail_json(msg="No Image Streams could be located to retrieve registry info.")
|
self.fail_json(msg="No Image Streams could be located to retrieve registry info.")
|
||||||
|
|
||||||
def info(self):
|
def execute_module(self):
|
||||||
result = {}
|
result = {}
|
||||||
result["internal_hostname"], result["public_hostname"] = self.find_registry_info()
|
result["internal_hostname"], result["public_hostname"] = self.find_registry_info()
|
||||||
|
|
||||||
|
|||||||
+4
-14
@@ -260,13 +260,9 @@ result:
|
|||||||
'''
|
'''
|
||||||
# ENDREMOVE (downstream)
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
try:
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
|
|
||||||
except ImportError:
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
NAME_ARG_SPEC, RESOURCE_ARG_SPEC, AUTH_ARG_SPEC, WAIT_ARG_SPEC, DELETE_OPTS_ARG_SPEC)
|
NAME_ARG_SPEC, RESOURCE_ARG_SPEC, AUTH_ARG_SPEC, WAIT_ARG_SPEC, DELETE_OPTS_ARG_SPEC
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def validate_spec():
|
def validate_spec():
|
||||||
@@ -303,15 +299,9 @@ def main():
|
|||||||
('template', 'src'),
|
('template', 'src'),
|
||||||
]
|
]
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=argspec(), supports_check_mode=True, mutually_exclusive=mutually_exclusive)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.k8s import OKDRawModule
|
from ansible_collections.community.okd.plugins.module_utils.k8s import OKDRawModule
|
||||||
okdraw_module = OKDRawModule(module)
|
module = OKDRawModule(argument_spec=argspec(), supports_check_mode=True, mutually_exclusive=mutually_exclusive)
|
||||||
|
module.run_module()
|
||||||
# remove_aliases from kubernetes.core's common requires the argspec attribute. Ideally, it should
|
|
||||||
# read that throught the module class, but we cannot change that.
|
|
||||||
okdraw_module.argspec = argspec()
|
|
||||||
okdraw_module.execute_module()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ options:
|
|||||||
- The elements specified in this list will override the ones specified in C(allow_groups).
|
- The elements specified in this list will override the ones specified in C(allow_groups).
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
|
default: []
|
||||||
allow_groups:
|
allow_groups:
|
||||||
description:
|
description:
|
||||||
- Allowed groups, could be openshift group name or LDAP group dn value.
|
- Allowed groups, could be openshift group name or LDAP group dn value.
|
||||||
@@ -67,6 +68,7 @@ options:
|
|||||||
like I(cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat).
|
like I(cn=developers,ou=groups,ou=rfc2307,dc=ansible,dc=redhat).
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
|
default: []
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 3.6
|
- python >= 3.6
|
||||||
@@ -190,9 +192,7 @@ builds:
|
|||||||
# ENDREMOVE (downstream)
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
@@ -211,17 +211,12 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec(), supports_check_mode=True)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_groups import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_groups import (
|
||||||
OpenshiftGroupsSync
|
OpenshiftGroupsSync
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
module = OpenshiftGroupsSync(argument_spec=argument_spec(), supports_check_mode=True)
|
||||||
openshift_groups = OpenshiftGroupsSync(module)
|
module.run_module()
|
||||||
openshift_groups.execute_module()
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -233,31 +233,20 @@ result:
|
|||||||
"""
|
"""
|
||||||
# ENDREMOVE (downstream)
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
WAIT_ARG_SPEC,
|
WAIT_ARG_SPEC,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
K8sAnsibleMixin,
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
transforms = {
|
transforms = {
|
||||||
"Build": "build.openshift.io/v1",
|
"Build": "build.openshift.io/v1",
|
||||||
"BuildConfig": "build.openshift.io/v1",
|
"BuildConfig": "build.openshift.io/v1",
|
||||||
@@ -266,24 +255,9 @@ transforms = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftMigrateTemplateInstances(K8sAnsibleMixin):
|
class OpenShiftMigrateTemplateInstances(AnsibleOpenshiftModule):
|
||||||
def __init__(self, module):
|
def __init__(self, **kwargs):
|
||||||
self.module = module
|
super(OpenShiftMigrateTemplateInstances, self).__init__(**kwargs)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
self.exit_json = self.module.exit_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.module.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftMigrateTemplateInstances, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
def patch_template_instance(self, resource, templateinstance):
|
def patch_template_instance(self, resource, templateinstance):
|
||||||
result = None
|
result = None
|
||||||
@@ -291,7 +265,7 @@ class OpenShiftMigrateTemplateInstances(K8sAnsibleMixin):
|
|||||||
try:
|
try:
|
||||||
result = resource.status.patch(templateinstance)
|
result = resource.status.patch(templateinstance)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(
|
self.fail_json(
|
||||||
msg="Failed to migrate TemplateInstance {0} due to: {1}".format(
|
msg="Failed to migrate TemplateInstance {0} due to: {1}".format(
|
||||||
templateinstance["metadata"]["name"], to_native(exc)
|
templateinstance["metadata"]["name"], to_native(exc)
|
||||||
)
|
)
|
||||||
@@ -349,7 +323,7 @@ class OpenShiftMigrateTemplateInstances(K8sAnsibleMixin):
|
|||||||
reason=exc.reason,
|
reason=exc.reason,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(
|
self.fail_json(
|
||||||
msg="Failed to retrieve TemplateInstances in namespace '{0}': {1}".format(
|
msg="Failed to retrieve TemplateInstances in namespace '{0}': {1}".format(
|
||||||
namespace, to_native(exc)
|
namespace, to_native(exc)
|
||||||
),
|
),
|
||||||
@@ -365,7 +339,7 @@ class OpenShiftMigrateTemplateInstances(K8sAnsibleMixin):
|
|||||||
|
|
||||||
if ti_to_be_migrated:
|
if ti_to_be_migrated:
|
||||||
if self.check_mode:
|
if self.check_mode:
|
||||||
self.module.exit_json(
|
self.exit_json(
|
||||||
**{"changed": True, "result": ti_to_be_migrated}
|
**{"changed": True, "result": ti_to_be_migrated}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -375,7 +349,7 @@ class OpenShiftMigrateTemplateInstances(K8sAnsibleMixin):
|
|||||||
)
|
)
|
||||||
results["changed"] = True
|
results["changed"] = True
|
||||||
|
|
||||||
self.module.exit_json(**results)
|
self.exit_json(**results)
|
||||||
|
|
||||||
|
|
||||||
def argspec():
|
def argspec():
|
||||||
@@ -389,10 +363,8 @@ def argspec():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = argspec()
|
argument_spec = argspec()
|
||||||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
module = OpenShiftMigrateTemplateInstances(argument_spec=argument_spec, supports_check_mode=True)
|
||||||
openshift_process = OpenShiftMigrateTemplateInstances(module)
|
module.run_module()
|
||||||
openshift_process.argspec = argument_spec
|
|
||||||
openshift_process.execute_module()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ group:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
@@ -119,16 +118,14 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec(),
|
|
||||||
mutually_exclusive=[("name", "label_selectors")],
|
|
||||||
supports_check_mode=True)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_auth import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_auth import (
|
||||||
OpenShiftAdmPruneAuth)
|
OpenShiftAdmPruneAuth)
|
||||||
|
|
||||||
adm_prune_auth = OpenShiftAdmPruneAuth(module)
|
module = OpenShiftAdmPruneAuth(argument_spec=argument_spec(),
|
||||||
adm_prune_auth.argspec = argument_spec
|
mutually_exclusive=[("name", "label_selectors")],
|
||||||
adm_prune_auth.execute_module()
|
supports_check_mode=True)
|
||||||
|
module.run_module()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright (c) 2021, Red Hat
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
# STARTREMOVE (downstream)
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
|
||||||
|
module: openshift_adm_prune_builds
|
||||||
|
|
||||||
|
short_description: Prune old completed and failed builds
|
||||||
|
|
||||||
|
version_added: "2.3.0"
|
||||||
|
|
||||||
|
author:
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
|
|
||||||
|
description:
|
||||||
|
- This module allow administrators to delete old completed and failed builds.
|
||||||
|
- Analogous to C(oc adm prune builds).
|
||||||
|
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- kubernetes.core.k8s_auth_options
|
||||||
|
|
||||||
|
options:
|
||||||
|
namespace:
|
||||||
|
description:
|
||||||
|
- Use to specify namespace for builds to be deleted.
|
||||||
|
type: str
|
||||||
|
keep_younger_than:
|
||||||
|
description:
|
||||||
|
- Specify the minimum age (in minutes) of a Build for it to be considered a candidate for pruning.
|
||||||
|
type: int
|
||||||
|
orphans:
|
||||||
|
description:
|
||||||
|
- If C(true), prune all builds whose associated BuildConfig no longer exists and whose status is
|
||||||
|
complete, failed, error, or cancelled.
|
||||||
|
type: bool
|
||||||
|
default: False
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
# Run deleting older completed and failed builds and also including
|
||||||
|
# all builds whose associated BuildConfig no longer exists
|
||||||
|
- name: Run delete orphan Builds
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
orphans: True
|
||||||
|
|
||||||
|
# Run deleting older completed and failed builds keep younger than 2hours
|
||||||
|
- name: Run delete builds, keep younger than 2h
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
keep_younger_than: 120
|
||||||
|
|
||||||
|
# Run deleting builds from specific namespace
|
||||||
|
- name: Run delete builds from namespace
|
||||||
|
community.okd.openshift_adm_prune_builds:
|
||||||
|
namespace: testing_namespace
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
builds:
|
||||||
|
description:
|
||||||
|
- The builds that were deleted
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
api_version:
|
||||||
|
description: The versioned schema of this representation of an object.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
kind:
|
||||||
|
description: Represents the REST resource this object represents.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
metadata:
|
||||||
|
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
spec:
|
||||||
|
description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
status:
|
||||||
|
description: Current status details for the object.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
'''
|
||||||
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
|
import copy
|
||||||
|
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
|
def argument_spec():
|
||||||
|
args = copy.deepcopy(AUTH_ARG_SPEC)
|
||||||
|
args.update(
|
||||||
|
dict(
|
||||||
|
namespace=dict(type='str'),
|
||||||
|
keep_younger_than=dict(type='int'),
|
||||||
|
orphans=dict(type='bool', default=False),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_builds import OpenShiftPruneBuilds
|
||||||
|
|
||||||
|
module = OpenShiftPruneBuilds(argument_spec=argument_spec(), supports_check_mode=True)
|
||||||
|
module.run_module()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -69,7 +69,6 @@ replication_controllers:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
try:
|
try:
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
@@ -89,13 +88,12 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec(), supports_check_mode=True)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_deployments import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_deployments import (
|
||||||
OpenShiftAdmPruneDeployment)
|
OpenShiftAdmPruneDeployment)
|
||||||
|
|
||||||
adm_prune_deployments = OpenShiftAdmPruneDeployment(module)
|
module = OpenShiftAdmPruneDeployment(argument_spec=argument_spec(), supports_check_mode=True)
|
||||||
adm_prune_deployments.execute()
|
module.run_module()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ deleted_images:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
@@ -303,14 +302,13 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec(), supports_check_mode=True)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_images import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_adm_prune_images import (
|
||||||
OpenShiftAdmPruneImages)
|
OpenShiftAdmPruneImages
|
||||||
|
)
|
||||||
|
|
||||||
adm_prune_images = OpenShiftAdmPruneImages(module)
|
module = OpenShiftAdmPruneImages(argument_spec=argument_spec(), supports_check_mode=True)
|
||||||
adm_prune_images.argspec = argument_spec()
|
module.run_module()
|
||||||
adm_prune_images.execute_module()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ requirements:
|
|||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
module_defaults:
|
module_defaults:
|
||||||
group/k8s:
|
group/community.okd.okd:
|
||||||
host: https://k8s.example.com/
|
host: https://k8s.example.com/
|
||||||
ca_cert: ca.pem
|
ca_cert: ca.pem
|
||||||
tasks:
|
tasks:
|
||||||
@@ -173,6 +173,9 @@ from ansible.module_utils.basic import AnsibleModule
|
|||||||
from ansible.module_utils.six.moves.urllib_parse import urlparse, parse_qs, urlencode
|
from ansible.module_utils.six.moves.urllib_parse import urlparse, parse_qs, urlencode
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
|
from base64 import urlsafe_b64encode
|
||||||
|
import hashlib
|
||||||
|
|
||||||
# 3rd party imports
|
# 3rd party imports
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
@@ -211,6 +214,20 @@ K8S_AUTH_ARG_SPEC = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_oauthaccesstoken_objectname_from_token(token_name):
|
||||||
|
|
||||||
|
"""
|
||||||
|
openshift convert the access token to an OAuthAccessToken resource name using the algorithm
|
||||||
|
https://github.com/openshift/console/blob/9f352ba49f82ad693a72d0d35709961428b43b93/pkg/server/server.go#L609-L613
|
||||||
|
"""
|
||||||
|
|
||||||
|
sha256Prefix = "sha256~"
|
||||||
|
content = token_name.strip(sha256Prefix)
|
||||||
|
|
||||||
|
b64encoded = urlsafe_b64encode(hashlib.sha256(content.encode()).digest()).rstrip(b'=')
|
||||||
|
return sha256Prefix + b64encoded.decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftAuthModule(AnsibleModule):
|
class OpenShiftAuthModule(AnsibleModule):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
AnsibleModule.__init__(
|
AnsibleModule.__init__(
|
||||||
@@ -250,6 +267,8 @@ class OpenShiftAuthModule(AnsibleModule):
|
|||||||
# Get needed info to access authorization APIs
|
# Get needed info to access authorization APIs
|
||||||
self.openshift_discover()
|
self.openshift_discover()
|
||||||
|
|
||||||
|
changed = False
|
||||||
|
result = dict()
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
new_api_key = self.openshift_login()
|
new_api_key = self.openshift_login()
|
||||||
result = dict(
|
result = dict(
|
||||||
@@ -260,11 +279,10 @@ class OpenShiftAuthModule(AnsibleModule):
|
|||||||
username=self.auth_username,
|
username=self.auth_username,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.openshift_logout()
|
changed = self.openshift_logout()
|
||||||
result = dict()
|
|
||||||
|
|
||||||
# return k8s_auth as well for backwards compatibility
|
# return k8s_auth as well for backwards compatibility
|
||||||
self.exit_json(changed=False, openshift_auth=result, k8s_auth=result)
|
self.exit_json(changed=changed, openshift_auth=result, k8s_auth=result)
|
||||||
|
|
||||||
def openshift_discover(self):
|
def openshift_discover(self):
|
||||||
url = urljoin(self.con_host, '.well-known/oauth-authorization-server')
|
url = urljoin(self.con_host, '.well-known/oauth-authorization-server')
|
||||||
@@ -328,19 +346,29 @@ class OpenShiftAuthModule(AnsibleModule):
|
|||||||
return ret.json()['access_token']
|
return ret.json()['access_token']
|
||||||
|
|
||||||
def openshift_logout(self):
|
def openshift_logout(self):
|
||||||
url = '{0}/apis/oauth.openshift.io/v1/oauthaccesstokens/{1}'.format(self.con_host, self.auth_api_key)
|
|
||||||
|
name = get_oauthaccesstoken_objectname_from_token(self.auth_api_key)
|
||||||
headers = {
|
headers = {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer {0}'.format(self.auth_api_key)
|
'Authorization': "Bearer {0}".format(self.auth_api_key)
|
||||||
}
|
|
||||||
json = {
|
|
||||||
"apiVersion": "oauth.openshift.io/v1",
|
|
||||||
"kind": "DeleteOptions"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
requests.delete(url, headers=headers, json=json, verify=self.con_verify_ca)
|
url = "{0}/apis/oauth.openshift.io/v1/useroauthaccesstokens/{1}".format(self.con_host, name)
|
||||||
# Ignore errors, the token will time out eventually anyway
|
json = {
|
||||||
|
"apiVersion": "oauth.openshift.io/v1",
|
||||||
|
"kind": "DeleteOptions",
|
||||||
|
"gracePeriodSeconds": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = requests.delete(url, json=json, verify=self.con_verify_ca, headers=headers)
|
||||||
|
if ret.status_code != 200:
|
||||||
|
self.fail_json(
|
||||||
|
msg="Couldn't delete user oauth access token '{0}' due to: {1}".format(name, ret.json().get("message")),
|
||||||
|
status_code=ret.status_code
|
||||||
|
)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def fail(self, msg=None):
|
def fail(self, msg=None):
|
||||||
self.fail_json(msg=msg)
|
self.fail_json(msg=msg)
|
||||||
|
|||||||
@@ -0,0 +1,260 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright (c) 2021, Red Hat
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
# STARTREMOVE (downstream)
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
|
||||||
|
module: openshift_build
|
||||||
|
|
||||||
|
short_description: Start a new build or Cancel running, pending, or new builds.
|
||||||
|
|
||||||
|
version_added: "2.3.0"
|
||||||
|
|
||||||
|
author:
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
|
|
||||||
|
description:
|
||||||
|
- This module starts a new build from the provided build config or build name.
|
||||||
|
- This module also cancel a new, pending or running build by requesting a graceful shutdown of the build.
|
||||||
|
There may be a delay between requesting the build and the time the build is terminated.
|
||||||
|
- This can also restart a new build when the current is cancelled.
|
||||||
|
- Analogous to C(oc cancel-build) and C(oc start-build).
|
||||||
|
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- kubernetes.core.k8s_auth_options
|
||||||
|
|
||||||
|
options:
|
||||||
|
state:
|
||||||
|
description:
|
||||||
|
- Determines if a Build should be started ,cancelled or restarted.
|
||||||
|
- When set to C(restarted) a new build will be created after the current build is cancelled.
|
||||||
|
choices:
|
||||||
|
- started
|
||||||
|
- cancelled
|
||||||
|
- restarted
|
||||||
|
default: started
|
||||||
|
type: str
|
||||||
|
build_name:
|
||||||
|
description:
|
||||||
|
- Specify the name of a build which should be re-run.
|
||||||
|
- Mutually exclusive with parameter I(build_config_name).
|
||||||
|
type: str
|
||||||
|
build_config_name:
|
||||||
|
description:
|
||||||
|
- Specify the name of a build config from which a new build will be run.
|
||||||
|
- Mutually exclusive with parameter I(build_name).
|
||||||
|
type: str
|
||||||
|
namespace:
|
||||||
|
description:
|
||||||
|
- Specify the namespace for the build or the build config.
|
||||||
|
type: str
|
||||||
|
required: True
|
||||||
|
build_args:
|
||||||
|
description:
|
||||||
|
- Specify a list of key-value pair to pass to Docker during the build.
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- docker build argument name.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- docker build argument value.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
commit:
|
||||||
|
description:
|
||||||
|
- Specify the source code commit identifier the build should use;
|
||||||
|
requires a build based on a Git repository.
|
||||||
|
type: str
|
||||||
|
env_vars:
|
||||||
|
description:
|
||||||
|
- Specify a list of key-value pair for an environment variable to set for the build container.
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Environment variable name.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- Environment variable value.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
incremental:
|
||||||
|
description:
|
||||||
|
- Overrides the incremental setting in a source-strategy build, ignored if not specified.
|
||||||
|
type: bool
|
||||||
|
no_cache:
|
||||||
|
description:
|
||||||
|
- Overrides the noCache setting in a docker-strategy build, ignored if not specified.
|
||||||
|
type: bool
|
||||||
|
wait:
|
||||||
|
description:
|
||||||
|
- When C(state=started), specify whether to wait for a build to complete
|
||||||
|
and exit with a non-zero return code if the build fails.
|
||||||
|
- When I(state=cancelled), specify whether to wait for a build phase to be Cancelled.
|
||||||
|
default: False
|
||||||
|
type: bool
|
||||||
|
wait_sleep:
|
||||||
|
description:
|
||||||
|
- Number of seconds to sleep between checks.
|
||||||
|
- Ignored if C(wait=false).
|
||||||
|
default: 5
|
||||||
|
type: int
|
||||||
|
wait_timeout:
|
||||||
|
description:
|
||||||
|
- How long in seconds to wait for a build to complete.
|
||||||
|
- Ignored if C(wait=false).
|
||||||
|
default: 120
|
||||||
|
type: int
|
||||||
|
build_phases:
|
||||||
|
description:
|
||||||
|
- List of state for build to cancel.
|
||||||
|
- Ignored when C(state=started).
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
choices:
|
||||||
|
- New
|
||||||
|
- Pending
|
||||||
|
- Running
|
||||||
|
default: []
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
- python >= 3.6
|
||||||
|
- kubernetes >= 12.0.0
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
# Starts build from build config default/hello-world
|
||||||
|
- name: Starts build from build config
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: default
|
||||||
|
build_config_name: hello-world
|
||||||
|
|
||||||
|
# Starts build from a previous build "default/hello-world-1"
|
||||||
|
- name: Starts build from a previous build
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: default
|
||||||
|
build_name: hello-world-1
|
||||||
|
|
||||||
|
# Cancel the build with the given name
|
||||||
|
- name: Cancel build from default namespace
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_name: ruby-build-1
|
||||||
|
state: cancelled
|
||||||
|
|
||||||
|
# Cancel the named build and create a new one with the same parameters
|
||||||
|
- name: Cancel build from default namespace and create a new one
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_name: ruby-build-1
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
# Cancel all builds created from 'ruby-build' build configuration that are in 'new' state
|
||||||
|
- name: Cancel build from default namespace and create a new one
|
||||||
|
community.okd.openshift_build:
|
||||||
|
namespace: "default"
|
||||||
|
build_config_name: ruby-build
|
||||||
|
build_phases:
|
||||||
|
- New
|
||||||
|
state: cancelled
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
builds:
|
||||||
|
description:
|
||||||
|
- The builds that were started/cancelled.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
api_version:
|
||||||
|
description: The versioned schema of this representation of an object.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
kind:
|
||||||
|
description: Represents the REST resource this object represents.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
metadata:
|
||||||
|
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
spec:
|
||||||
|
description: Specific attributes of the build.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
status:
|
||||||
|
description: Current status details for the object.
|
||||||
|
returned: success
|
||||||
|
type: dict
|
||||||
|
'''
|
||||||
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
|
import copy
|
||||||
|
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
|
def argument_spec():
|
||||||
|
args = copy.deepcopy(AUTH_ARG_SPEC)
|
||||||
|
|
||||||
|
args_options = dict(
|
||||||
|
name=dict(type='str', required=True),
|
||||||
|
value=dict(type='str', required=True)
|
||||||
|
)
|
||||||
|
|
||||||
|
args.update(
|
||||||
|
dict(
|
||||||
|
state=dict(type='str', choices=['started', 'cancelled', 'restarted'], default="started"),
|
||||||
|
build_args=dict(type='list', elements='dict', options=args_options),
|
||||||
|
commit=dict(type='str'),
|
||||||
|
env_vars=dict(type='list', elements='dict', options=args_options),
|
||||||
|
build_name=dict(type='str'),
|
||||||
|
build_config_name=dict(type='str'),
|
||||||
|
namespace=dict(type='str', required=True),
|
||||||
|
incremental=dict(type='bool'),
|
||||||
|
no_cache=dict(type='bool'),
|
||||||
|
wait=dict(type='bool', default=False),
|
||||||
|
wait_sleep=dict(type='int', default=5),
|
||||||
|
wait_timeout=dict(type='int', default=120),
|
||||||
|
build_phases=dict(type='list', elements='str', default=[], choices=["New", "Pending", "Running"]),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
mutually_exclusive = [
|
||||||
|
('build_name', 'build_config_name'),
|
||||||
|
]
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_builds import (
|
||||||
|
OpenShiftBuilds
|
||||||
|
)
|
||||||
|
module = OpenShiftBuilds(
|
||||||
|
argument_spec=argument_spec(),
|
||||||
|
mutually_exclusive=mutually_exclusive,
|
||||||
|
required_one_of=[
|
||||||
|
[
|
||||||
|
'build_name',
|
||||||
|
'build_config_name',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
)
|
||||||
|
module.run_module()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -158,7 +158,6 @@ result:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
@@ -179,17 +178,16 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_import_image import (
|
||||||
|
OpenShiftImportImage
|
||||||
|
)
|
||||||
|
|
||||||
|
module = OpenShiftImportImage(
|
||||||
argument_spec=argument_spec(),
|
argument_spec=argument_spec(),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
module.run_module()
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_import_image import (
|
|
||||||
OpenShiftImportImage)
|
|
||||||
|
|
||||||
import_image = OpenShiftImportImage(module)
|
|
||||||
import_image.argspec = argument_spec()
|
|
||||||
import_image.execute_module()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -203,11 +203,6 @@ resources:
|
|||||||
'''
|
'''
|
||||||
# ENDREMOVE (downstream)
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
try:
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
|
|
||||||
except ImportError:
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, WAIT_ARG_SPEC
|
AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, WAIT_ARG_SPEC
|
||||||
)
|
)
|
||||||
@@ -229,17 +224,12 @@ def argspec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = argspec()
|
|
||||||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_process import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_process import (
|
||||||
OpenShiftProcess)
|
OpenShiftProcess)
|
||||||
|
|
||||||
openshift_process = OpenShiftProcess(module)
|
module = OpenShiftProcess(argument_spec=argspec(), supports_check_mode=True)
|
||||||
# remove_aliases from kubernetes.core's common requires the argspec attribute. Ideally, it should
|
module.run_module()
|
||||||
# read that throught the module class, but we cannot change that.
|
|
||||||
openshift_process.argspec = argument_spec
|
|
||||||
openshift_process.execute_module()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ check:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||||
|
|
||||||
|
|
||||||
@@ -99,17 +98,16 @@ def argument_spec():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_registry import (
|
||||||
|
OpenShiftRegistry
|
||||||
|
)
|
||||||
|
|
||||||
|
module = OpenShiftRegistry(
|
||||||
argument_spec=argument_spec(),
|
argument_spec=argument_spec(),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
module.run_module()
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_registry import (
|
|
||||||
OpenShiftRegistry)
|
|
||||||
|
|
||||||
registry = OpenShiftRegistry(module)
|
|
||||||
registry.argspec = argument_spec()
|
|
||||||
registry.info()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -307,25 +307,19 @@ duration:
|
|||||||
# ENDREMOVE (downstream)
|
# ENDREMOVE (downstream)
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import traceback
|
|
||||||
|
|
||||||
try:
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
|
|
||||||
except ImportError:
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import AnsibleOpenshiftModule
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import K8sAnsibleMixin, get_api_client
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import perform_action
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import Waiter
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_SPEC, WAIT_ARG_SPEC, COMMON_ARG_SPEC
|
AUTH_ARG_SPEC, WAIT_ARG_SPEC, COMMON_ARG_SPEC
|
||||||
)
|
)
|
||||||
HAS_KUBERNETES_COLLECTION = True
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_KUBERNETES_COLLECTION = False
|
pass
|
||||||
k8s_collection_import_exception = e
|
|
||||||
K8S_COLLECTION_ERROR = traceback.format_exc()
|
|
||||||
K8sAnsibleMixin = object
|
|
||||||
AUTH_ARG_SPEC = WAIT_ARG_SPEC = COMMON_ARG_SPEC = {}
|
AUTH_ARG_SPEC = WAIT_ARG_SPEC = COMMON_ARG_SPEC = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -334,33 +328,18 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OpenShiftRoute(K8sAnsibleMixin):
|
class OpenShiftRoute(AnsibleOpenshiftModule):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.module = AnsibleModule(
|
super(OpenShiftRoute, self).__init__(
|
||||||
argument_spec=self.argspec,
|
argument_spec=self.argspec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
self.fail_json = self.module.fail_json
|
|
||||||
|
|
||||||
if not HAS_KUBERNETES_COLLECTION:
|
|
||||||
self.module.fail_json(
|
|
||||||
msg="The kubernetes.core collection must be installed",
|
|
||||||
exception=K8S_COLLECTION_ERROR,
|
|
||||||
error=to_native(k8s_collection_import_exception)
|
|
||||||
)
|
|
||||||
|
|
||||||
super(OpenShiftRoute, self).__init__(self.module)
|
|
||||||
|
|
||||||
self.params = self.module.params
|
|
||||||
# TODO: should probably make it so that at least some of these aren't required for perform_action to work
|
|
||||||
# Or at least explicitly pass them in
|
|
||||||
self.append_hash = False
|
self.append_hash = False
|
||||||
self.apply = False
|
self.apply = False
|
||||||
self.check_mode = self.module.check_mode
|
|
||||||
self.warnings = []
|
self.warnings = []
|
||||||
self.params['merge_type'] = None
|
self.params['merge_type'] = None
|
||||||
self.client = get_api_client(self.module)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def argspec(self):
|
def argspec(self):
|
||||||
@@ -389,7 +368,6 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
|||||||
return spec
|
return spec
|
||||||
|
|
||||||
def execute_module(self):
|
def execute_module(self):
|
||||||
v1_routes = self.find_resource('Route', 'route.openshift.io/v1', fail=True)
|
|
||||||
|
|
||||||
service_name = self.params.get('service')
|
service_name = self.params.get('service')
|
||||||
namespace = self.params['namespace']
|
namespace = self.params['namespace']
|
||||||
@@ -455,13 +433,15 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
|||||||
tls_dest_ca_cert=tls_dest_ca_cert,
|
tls_dest_ca_cert=tls_dest_ca_cert,
|
||||||
)
|
)
|
||||||
|
|
||||||
result = self.perform_action(v1_routes, route)
|
result = perform_action(self.svc, route, self.params)
|
||||||
timeout = self.params.get('wait_timeout')
|
timeout = self.params.get('wait_timeout')
|
||||||
sleep = self.params.get('wait_sleep')
|
sleep = self.params.get('wait_sleep')
|
||||||
if custom_wait:
|
if custom_wait:
|
||||||
success, result['result'], result['duration'] = self._wait_for(v1_routes, route_name, namespace, wait_predicate, sleep, timeout, state)
|
v1_routes = self.find_resource('Route', 'route.openshift.io/v1', fail=True)
|
||||||
|
waiter = Waiter(self.client, v1_routes, wait_predicate)
|
||||||
|
success, result['result'], result['duration'] = waiter.wait(timeout=timeout, sleep=sleep, name=route_name, namespace=namespace)
|
||||||
|
|
||||||
self.module.exit_json(**result)
|
self.exit_json(**result)
|
||||||
|
|
||||||
def build_route_spec(self, service_name, namespace, port=None, wildcard_policy=None, hostname=None, path=None, termination_type=None,
|
def build_route_spec(self, service_name, namespace, port=None, wildcard_policy=None, hostname=None, path=None, termination_type=None,
|
||||||
tls_insecure_policy=None, tls_ca_cert=None, tls_cert=None, tls_key=None, tls_dest_ca_cert=None):
|
tls_insecure_policy=None, tls_ca_cert=None, tls_cert=None, tls_key=None, tls_dest_ca_cert=None):
|
||||||
@@ -470,14 +450,14 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
|||||||
target_service = v1_services.get(name=service_name, namespace=namespace)
|
target_service = v1_services.get(name=service_name, namespace=namespace)
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
if not port:
|
if not port:
|
||||||
self.module.fail_json(msg="You need to provide the 'port' argument when exposing a non-existent service")
|
self.fail_json(msg="You need to provide the 'port' argument when exposing a non-existent service")
|
||||||
target_service = None
|
target_service = None
|
||||||
except DynamicApiError as exc:
|
except DynamicApiError as exc:
|
||||||
self.module.fail_json(msg='Failed to retrieve service to be exposed: {0}'.format(exc.body),
|
self.fail_json(msg='Failed to retrieve service to be exposed: {0}'.format(exc.body),
|
||||||
error=exc.status, status=exc.status, reason=exc.reason)
|
error=exc.status, status=exc.status, reason=exc.reason)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(msg='Failed to retrieve service to be exposed: {0}'.format(to_native(exc)),
|
self.fail_json(msg='Failed to retrieve service to be exposed: {0}'.format(to_native(exc)),
|
||||||
error='', status='', reason='')
|
error='', status='', reason='')
|
||||||
|
|
||||||
route_spec = {
|
route_spec = {
|
||||||
'tls': {},
|
'tls': {},
|
||||||
@@ -499,27 +479,27 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
|||||||
route_spec['tls']['insecureEdgeTerminationPolicy'] = tls_insecure_policy.capitalize()
|
route_spec['tls']['insecureEdgeTerminationPolicy'] = tls_insecure_policy.capitalize()
|
||||||
elif termination_type == 'passthrough':
|
elif termination_type == 'passthrough':
|
||||||
if tls_insecure_policy != 'redirect':
|
if tls_insecure_policy != 'redirect':
|
||||||
self.module.fail_json("'redirect' is the only supported insecureEdgeTerminationPolicy for passthrough routes")
|
self.fail_json("'redirect' is the only supported insecureEdgeTerminationPolicy for passthrough routes")
|
||||||
route_spec['tls']['insecureEdgeTerminationPolicy'] = tls_insecure_policy.capitalize()
|
route_spec['tls']['insecureEdgeTerminationPolicy'] = tls_insecure_policy.capitalize()
|
||||||
elif termination_type == 'reencrypt':
|
elif termination_type == 'reencrypt':
|
||||||
self.module.fail_json("'tls.insecure_policy' is not supported with reencrypt routes")
|
self.fail_json("'tls.insecure_policy' is not supported with reencrypt routes")
|
||||||
else:
|
else:
|
||||||
route_spec['tls']['insecureEdgeTerminationPolicy'] = None
|
route_spec['tls']['insecureEdgeTerminationPolicy'] = None
|
||||||
if tls_ca_cert:
|
if tls_ca_cert:
|
||||||
if termination_type == 'passthrough':
|
if termination_type == 'passthrough':
|
||||||
self.module.fail_json("'tls.ca_certificate' is not supported with passthrough routes")
|
self.fail_json("'tls.ca_certificate' is not supported with passthrough routes")
|
||||||
route_spec['tls']['caCertificate'] = tls_ca_cert
|
route_spec['tls']['caCertificate'] = tls_ca_cert
|
||||||
if tls_cert:
|
if tls_cert:
|
||||||
if termination_type == 'passthrough':
|
if termination_type == 'passthrough':
|
||||||
self.module.fail_json("'tls.certificate' is not supported with passthrough routes")
|
self.fail_json("'tls.certificate' is not supported with passthrough routes")
|
||||||
route_spec['tls']['certificate'] = tls_cert
|
route_spec['tls']['certificate'] = tls_cert
|
||||||
if tls_key:
|
if tls_key:
|
||||||
if termination_type == 'passthrough':
|
if termination_type == 'passthrough':
|
||||||
self.module.fail_json("'tls.key' is not supported with passthrough routes")
|
self.fail_json("'tls.key' is not supported with passthrough routes")
|
||||||
route_spec['tls']['key'] = tls_key
|
route_spec['tls']['key'] = tls_key
|
||||||
if tls_dest_ca_cert:
|
if tls_dest_ca_cert:
|
||||||
if termination_type != 'reencrypt':
|
if termination_type != 'reencrypt':
|
||||||
self.module.fail_json("'destination_certificate' is only valid for reencrypt routes")
|
self.fail_json("'destination_certificate' is only valid for reencrypt routes")
|
||||||
route_spec['tls']['destinationCACertificate'] = tls_dest_ca_cert
|
route_spec['tls']['destinationCACertificate'] = tls_dest_ca_cert
|
||||||
else:
|
else:
|
||||||
route_spec['tls'] = None
|
route_spec['tls'] = None
|
||||||
@@ -542,7 +522,7 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
|||||||
|
|
||||||
|
|
||||||
def wait_predicate(route):
|
def wait_predicate(route):
|
||||||
if not(route.status and route.status.ingress):
|
if not (route.status and route.status.ingress):
|
||||||
return False
|
return False
|
||||||
for ingress in route.status.ingress:
|
for ingress in route.status.ingress:
|
||||||
match = [x for x in ingress.conditions if x.type == 'Admitted']
|
match = [x for x in ingress.conditions if x.type == 'Admitted']
|
||||||
@@ -555,7 +535,7 @@ def wait_predicate(route):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
OpenShiftRoute().execute_module()
|
OpenShiftRoute().run_module()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
collections:
|
collections:
|
||||||
- name: kubernetes.core
|
- name: kubernetes.core
|
||||||
version: '>=2.1.0,<2.3.0'
|
version: '>=2.4.0'
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
coverage==4.5.4
|
coverage==4.5.4
|
||||||
pytest
|
pytest
|
||||||
pytest-xdist
|
pytest-xdist
|
||||||
|
pytest-forked
|
||||||
|
pytest-ansible
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
modules:
|
||||||
|
python_requires: ">=3.6"
|
||||||
@@ -2,3 +2,168 @@ plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
|||||||
plugins/modules/k8s.py validate-modules:return-syntax-error
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
plugins/module_utils/k8s.py pylint:bad-option-value
|
plugins/module_utils/k8s.py pylint:bad-option-value
|
||||||
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/connection/oc.py import-2.6!skip
|
||||||
|
plugins/connection/oc.py import-2.7!skip
|
||||||
|
plugins/connection/oc.py import-3.5!skip
|
||||||
|
plugins/connection/oc.py compile-2.6!skip
|
||||||
|
plugins/connection/oc.py compile-2.7!skip
|
||||||
|
plugins/connection/oc.py compile-3.5!skip
|
||||||
|
plugins/inventory/openshift.py import-2.6!skip
|
||||||
|
plugins/inventory/openshift.py import-2.7!skip
|
||||||
|
plugins/inventory/openshift.py import-3.5!skip
|
||||||
|
plugins/inventory/openshift.py compile-2.6!skip
|
||||||
|
plugins/inventory/openshift.py compile-2.7!skip
|
||||||
|
plugins/inventory/openshift.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_route.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_route.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_route.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_route.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_route.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_route.py compile-3.5!skip
|
||||||
|
plugins/modules/k8s.py import-2.6!skip
|
||||||
|
plugins/modules/k8s.py import-2.7!skip
|
||||||
|
plugins/modules/k8s.py import-3.5!skip
|
||||||
|
plugins/modules/k8s.py compile-2.6!skip
|
||||||
|
plugins/modules/k8s.py compile-2.7!skip
|
||||||
|
plugins/modules/k8s.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_process.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_process.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_process.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_process.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_process.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_process.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_groups_sync.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_migrate_template_instances.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_auth.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_deployments.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_images.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_auth.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_auth.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_auth.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_auth.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_auth.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_auth.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_import_image.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_import_image.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_import_image.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_import_image.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_import_image.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_import_image.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_registry_info.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_registry_info.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_registry_info.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_registry_info.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_registry_info.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_registry_info.py compile-3.5!skip
|
||||||
|
plugins/module_utils/k8s.py import-2.6!skip
|
||||||
|
plugins/module_utils/k8s.py import-2.7!skip
|
||||||
|
plugins/module_utils/k8s.py import-3.5!skip
|
||||||
|
plugins/module_utils/k8s.py compile-2.6!skip
|
||||||
|
plugins/module_utils/k8s.py compile-2.7!skip
|
||||||
|
plugins/module_utils/k8s.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_process.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_process.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_process.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_process.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_process.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_process.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_auth.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_deployments.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_ldap.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_adm_prune_images.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_docker_image.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_import_image.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_groups.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_groups.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_groups.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_groups.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_groups.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_groups.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_images_common.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_registry.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_registry.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_registry.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_registry.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_registry.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_registry.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_builds.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_builds.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_builds.py import-3.5!skip
|
||||||
|
plugins/module_utils/openshift_builds.py compile-2.6!skip
|
||||||
|
plugins/module_utils/openshift_builds.py compile-2.7!skip
|
||||||
|
plugins/module_utils/openshift_builds.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_build.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_build.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_build.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_build.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_build.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_build.py compile-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py import-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py import-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py import-3.5!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py compile-2.6!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py compile-2.7!skip
|
||||||
|
plugins/modules/openshift_adm_prune_builds.py compile-3.5!skip
|
||||||
|
plugins/module_utils/openshift_common.py import-2.6!skip
|
||||||
|
plugins/module_utils/openshift_common.py import-2.7!skip
|
||||||
|
plugins/module_utils/openshift_common.py import-3.5!skip
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
@@ -10,7 +10,7 @@ from ansible_collections.community.okd.plugins.module_utils.openshift_ldap impor
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ldap
|
import ldap # pylint: disable=unused-import
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pytestmark = pytest.mark.skip("This test requires the python-ldap library")
|
pytestmark = pytest.mark.skip("This test requires the python-ldap library")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user