W3cubDocs

/Ansible

community.okd.oc – Execute tasks in pods running on OpenShift.

Note

This plugin is part of the community.okd collection (version 1.1.2).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.okd.

To use it in a playbook, specify: community.okd.oc.

Synopsis

  • Use the oc exec command to run tasks in, or put/fetch files to, pods running on the OpenShift container platform.

Requirements

The below requirements are needed on the local controller node that executes this connection.

  • oc (go binary)

Parameters

Parameter Choices/Defaults Configuration Comments
ca_cert
string
Default:
""
env:K8S_AUTH_SSL_CA_CERT
var: ansible_oc_ssl_ca_cert
var: ansible_oc_ca_cert
Path to a CA certificate used to authenticate with the API.

aliases: oc_ssl_ca_cert
client_cert
string
Default:
""
env:K8S_AUTH_CERT_FILE
var: ansible_oc_cert_file
var: ansible_oc_client_cert
Path to a certificate used to authenticate with the API.

aliases: oc_cert_file
client_key
string
Default:
""
env:K8S_AUTH_KEY_FILE
var: ansible_oc_key_file
var: ansible_oc_client_key
Path to a key file used to authenticate with the API.

aliases: oc_key_file
oc_container
string
Default:
""
env:K8S_AUTH_CONTAINER
var: ansible_oc_container
Container name. Required when a pod contains more than one container.
oc_context
string
Default:
""
env:K8S_AUTH_CONTEXT
var: ansible_oc_context
The name of a context found in the K8s config file.
oc_extra_args
string
Default:
""
env:K8S_AUTH_EXTRA_ARGS
var: ansible_oc_extra_args
Extra arguments to pass to the oc command line.
oc_host
string
Default:
""
env:K8S_AUTH_HOST
env:K8S_AUTH_SERVER
var: ansible_oc_host
var: ansible_oc_server
URL for accessing the API.
oc_kubeconfig
string
Default:
""
env:K8S_AUTH_KUBECONFIG
var: ansible_oc_kubeconfig
var: ansible_oc_config
Path to a oc config file. Defaults to ~/.kube/config
oc_namespace
string
Default:
""
env:K8S_AUTH_NAMESPACE
var: ansible_oc_namespace
The namespace of the pod
oc_pod
string
Default:
""
env:K8S_AUTH_POD
var: ansible_oc_pod
Pod name. Required when the host name does not match pod name.
oc_token
string
env:K8S_AUTH_TOKEN
env:K8S_AUTH_API_KEY
var: ansible_oc_token
var: ansible_oc_api_key
API authentication bearer token.
validate_certs
string
Default:
""
env:K8S_AUTH_VERIFY_SSL
var: ansible_oc_verify_ssl
var: ansible_oc_validate_certs
Whether or not to verify the API server's SSL certificate. Defaults to true.

aliases: oc_verify_ssl

Authors

  • xuxinkun

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/okd/oc_connection.html