New in version 2.1.
Removed in Ansible: | |
---|---|
version: 2.9 | |
Why: | This module used the oc command line tool, where as k8s_raw goes over the REST API. |
Alternative: | Use k8s_raw instead. |
Parameter |
Choices/Defaults |
Comments |
---|---|---|
api_endpoint
required |
|
The IPv4 API endpoint of the Kubernetes cluster.
aliases: endpoint |
certificate_authority_data
|
|
Certificate Authority data for Kubernetes server. Should be in either standard PEM format or base64 encoded PEM data. Note that certificate verification is broken until ansible supports a version of 'match_hostname' that can match the IP address against the CA data.
|
file_reference
|
|
Specify full path to a Kubernets YAML file to send to API endpoint. This option is mutually exclusive with
'inline_data' . |
inline_data
required |
|
The Kubernetes YAML data to send to the API endpoint. This option is mutually exclusive with
'file_reference' . |
insecure
|
|
Reverts the connection to using HTTP instead of HTTPS. This option should only be used when execuing the 'kubernetes' module local to the Kubernetes cluster using the insecure local port (locahost:8080 by default).
|
patch_operation
(added in 2.4) |
|
Specify patch operation for Kubernetes resource update.
For details, see the description of PATCH operations at https://github.com/kubernetes/kubernetes/blob/release-1.5/docs/devel/api-conventions.md#patch-operations.
aliases: patch_strategy |
state
required |
|
The desired action to take on the Kubernetes data.
|
url_password
|
|
The HTTP Basic Auth password for the API endpoint. This should be set unless using the
'insecure' option.aliases: password |
url_username
|
Default:
admin
|
The HTTP Basic Auth username for the API endpoint. This should be set unless using the
'insecure' option.aliases: username |
validate_certs
|
|
Enable/disable certificate validation. Note that this is set to
false until Ansible can support IP address based certificate hostname matching (exists in >= python3.5.0). |
# Create a new namespace with in-line YAML.
- name: Create a kubernetes namespace
kubernetes:
api_endpoint: 123.45.67.89
url_username: admin
url_password: redacted
inline_data:
kind: Namespace
apiVersion: v1
metadata:
name: ansible-test
labels:
label_env: production
label_ver: latest
annotations:
a1: value1
a2: value2
state: present
# Create a new namespace from a YAML file.
- name: Create a kubernetes namespace
kubernetes:
api_endpoint: 123.45.67.89
url_username: admin
url_password: redacted
file_reference: /path/to/create_namespace.yaml
state: present
# Do the same thing, but using the insecure localhost port
- name: Create a kubernetes namespace
kubernetes:
api_endpoint: 123.45.67.89
insecure: true
file_reference: /path/to/create_namespace.yaml
state: present
Common return values are documented here, the following are the fields unique to this module:
Key |
Returned |
Description |
---|---|---|
api_response
complex
|
success |
Raw response from Kubernetes API, content varies with API.
|
status
|
|
|
kind
|
|
|
spec
|
|
|
apiVersion
|
|
|
metadata
|
|
This module is flagged as deprecated and will be removed in version { deprecated[‘removed_in’] | default(‘’) | string | convert_symbols_to_format }@. For more information see DEPRECATED.
Hint
If you notice any issues in this documentation you can edit this document to improve it.