mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Improving docs and examples (#34155)
* Improving docs and examples * Removes trailing whitespace
This commit is contained in:
parent
d19108e592
commit
1c391e777a
4 changed files with 69 additions and 31 deletions
|
@ -77,7 +77,8 @@ ARG_SPEC = {
|
||||||
'description': {},
|
'description': {},
|
||||||
'display_name': {},
|
'display_name': {},
|
||||||
'api_version': {
|
'api_version': {
|
||||||
'aliases': ['api', 'version']
|
'default': 'v1',
|
||||||
|
'aliases': ['api', 'version'],
|
||||||
},
|
},
|
||||||
'kubeconfig': {
|
'kubeconfig': {
|
||||||
'type': 'path',
|
'type': 'path',
|
||||||
|
|
|
@ -24,16 +24,20 @@ version_added: "2.5"
|
||||||
author: "Chris Houseknecht (@chouseknecht)"
|
author: "Chris Houseknecht (@chouseknecht)"
|
||||||
|
|
||||||
description:
|
description:
|
||||||
- Use the OpenShift Python client to perform CRUD operations on Kubernetes objects.
|
- Use the OpenShift Python client to perform CRUD operations on K8s objects.
|
||||||
- Supports authentication using either a config file, certificates, password or token.
|
- Pass the object definition from a source file or inline. See examples for reading
|
||||||
|
files and using Jinja templates.
|
||||||
|
- Access to the full range of K8s APIs.
|
||||||
|
- Authenticate using either a config file, certificates, password or token.
|
||||||
|
- Supports check mode, and the diff option.
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 2.7"
|
- "python >= 2.7"
|
||||||
- "openshift >= 0.3"
|
- "openshift >= 0.3"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -93,6 +97,23 @@ EXAMPLES = '''
|
||||||
kind: Service
|
kind: Service
|
||||||
namespace: testing
|
namespace: testing
|
||||||
name: web
|
name: web
|
||||||
|
|
||||||
|
# Passing the object definition from a file
|
||||||
|
|
||||||
|
- name: Create a Deployment by reading the definition from a local file
|
||||||
|
k8s_raw:
|
||||||
|
state: present
|
||||||
|
src: /testing/deployment.yml
|
||||||
|
|
||||||
|
- name: Read definition file from the Ansible controller file system
|
||||||
|
k8s_raw:
|
||||||
|
state: present
|
||||||
|
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Read definition file from the Ansible controller file system after Jinja templating
|
||||||
|
k8s_raw:
|
||||||
|
state: present
|
||||||
|
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -25,10 +25,24 @@ author: "Chris Houseknecht (@chouseknecht)"
|
||||||
|
|
||||||
description:
|
description:
|
||||||
- Use the OpenShift Python client to perform CRUD operations on OpenShift objects.
|
- Use the OpenShift Python client to perform CRUD operations on OpenShift objects.
|
||||||
- Supports authentication using either a config file, certificates, password or token.
|
- Pass the object definition from a source file or inline. See examples for reading
|
||||||
|
files and using Jinja templates.
|
||||||
|
- Access to the full range of K8s and OpenShift APIs.
|
||||||
|
- Authenticate using either a config file, certificates, password or token.
|
||||||
|
- Supports check mode, and the diff option.
|
||||||
|
|
||||||
extends_documentation_fragment: kubernetes
|
extends_documentation_fragment: kubernetes
|
||||||
|
|
||||||
|
options:
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- Use only when creating a project, otherwise ignored. Adds a description to the project
|
||||||
|
metadata.
|
||||||
|
display_name:
|
||||||
|
description:
|
||||||
|
- Use only when creating a project, otherwise ignored. Adds a display name to the project
|
||||||
|
metadata.
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 2.7"
|
- "python >= 2.7"
|
||||||
- "openshift >= 0.3"
|
- "openshift >= 0.3"
|
||||||
|
@ -95,18 +109,6 @@ EXAMPLES = '''
|
||||||
strategy:
|
strategy:
|
||||||
type: Rolling
|
type: Rolling
|
||||||
|
|
||||||
- name: Create a Deployment by reading the definition from a file
|
|
||||||
openshift_raw:
|
|
||||||
state: present
|
|
||||||
src: /testing/deployment.yml
|
|
||||||
|
|
||||||
- name: Get the list of all Deployments
|
|
||||||
openshift_raw:
|
|
||||||
api_version: v1
|
|
||||||
kind: DeploymentConfigList
|
|
||||||
namespace: testing
|
|
||||||
register: deployment_list
|
|
||||||
|
|
||||||
- name: Remove an existing Deployment
|
- name: Remove an existing Deployment
|
||||||
openshift_raw:
|
openshift_raw:
|
||||||
api_version: v1
|
api_version: v1
|
||||||
|
@ -117,7 +119,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
- name: Create a Secret
|
- name: Create a Secret
|
||||||
openshift_raw:
|
openshift_raw:
|
||||||
inline:
|
definition:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -128,13 +130,30 @@ EXAMPLES = '''
|
||||||
username: "{{ 'admin' | b64encode }}"
|
username: "{{ 'admin' | b64encode }}"
|
||||||
password: "{{ 'foobard' | b64encode }}"
|
password: "{{ 'foobard' | b64encode }}"
|
||||||
|
|
||||||
- name: Retrieve the Secret
|
- name: Retrieve a Secret
|
||||||
openshift_raw:
|
openshift_raw:
|
||||||
api: v1
|
api: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
name: mysecret
|
name: mysecret
|
||||||
namespace: testing
|
namespace: testing
|
||||||
register: mysecret
|
register: mysecret
|
||||||
|
|
||||||
|
# Passing the object definition from a file
|
||||||
|
|
||||||
|
- name: Create a Deployment by reading the definition from a local file
|
||||||
|
openshift_raw:
|
||||||
|
state: present
|
||||||
|
src: /testing/deployment.yml
|
||||||
|
|
||||||
|
- name: Read definition file from the Ansible controller file system
|
||||||
|
openshift_raw:
|
||||||
|
state: present
|
||||||
|
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Read definition file from the Ansible controller file system after Jinja templating
|
||||||
|
openshift_raw:
|
||||||
|
state: present
|
||||||
|
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -46,12 +46,16 @@ options:
|
||||||
- "Provide a path to a file containing a valid YAML definition of an object to be created or updated. Mutually
|
- "Provide a path to a file containing a valid YAML definition of an object to be created or updated. Mutually
|
||||||
exclusive with I(resource_definition). NOTE: I(kind), I(api_version), I(name), and I(namespace) will be
|
exclusive with I(resource_definition). NOTE: I(kind), I(api_version), I(name), and I(namespace) will be
|
||||||
overwritten by corresponding values found in the configuration read in from the I(src) file."
|
overwritten by corresponding values found in the configuration read in from the I(src) file."
|
||||||
|
- Reads from the local file system. To read from the Ansible controller's file system, use the file lookup
|
||||||
|
plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to
|
||||||
|
I(resource_definition). See Examples below.
|
||||||
api_version:
|
api_version:
|
||||||
description:
|
description:
|
||||||
- Use to specify the API version. Use to create, delete, or discover an object without providing a full
|
- Use to specify the API version. Use to create, delete, or discover an object without providing a full
|
||||||
resource definition. Use in conjunction with I(kind), I(name), and I(namespace) to identify a
|
resource definition. Use in conjunction with I(kind), I(name), and I(namespace) to identify a
|
||||||
specific object. If I(resource definition) is provided, the I(apiVersion) from the I(resource_definition)
|
specific object. If I(resource definition) is provided, the I(apiVersion) from the I(resource_definition)
|
||||||
will override this option.
|
will override this option.
|
||||||
|
default: v1
|
||||||
aliases:
|
aliases:
|
||||||
- api
|
- api
|
||||||
- version
|
- version
|
||||||
|
@ -73,14 +77,6 @@ options:
|
||||||
providing a full resource definition. Use in conjunction with I(api_version), I(kind), and I(name)
|
providing a full resource definition. Use in conjunction with I(api_version), I(kind), and I(name)
|
||||||
to identify a specfic object. If I(resource definition) is provided, the I(metadata.namespace) value
|
to identify a specfic object. If I(resource definition) is provided, the I(metadata.namespace) value
|
||||||
from the I(resource_definition) will override this option.
|
from the I(resource_definition) will override this option.
|
||||||
description:
|
|
||||||
description:
|
|
||||||
- Used only when creating an OpenShift project, otherwise ignored. Adds a description to the project meta
|
|
||||||
data.
|
|
||||||
display_name:
|
|
||||||
description:
|
|
||||||
- Use only when creating an OpenShift project, otherwise ignored. Adds a display name to the project meta
|
|
||||||
data.
|
|
||||||
host:
|
host:
|
||||||
description:
|
description:
|
||||||
- Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
|
- Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
|
||||||
|
@ -123,6 +119,7 @@ options:
|
||||||
type: bool
|
type: bool
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
- "To learn more about the OpenShift Python client and available object models, visit:
|
- "The OpenShift Python client wraps the K8s Python client, providing full access to
|
||||||
https://github.com/openshift/openshift-restclient-python"
|
all of the APIS and models available on both platforms. For API version details and
|
||||||
|
additional information visit https://github.com/openshift/openshift-restclient-python"
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue