oasis_roles.ocp_client_install
ocp_client_install
This tool downloads and installs the oc
and kubectl
software into a chosen folder.
It is designed for use with the oc
and kubectl
client versions needed to set up OpenShift Container Platform (OCP) 4.x, as mentioned in the official Red Hat OCP 4 installation guide.
Requirements
- Ansible version 2.9 or higher
- Red Hat Enterprise Linux 7 or similar
- A valid Red Hat subscription
Role Variables
These variables are currently supported:
General
ocp_client_install_url
- This is required. It's the http(s) link to the OCP Client archive. You can find an example of how to set this automatically below.ocp_client_install_path
- Default value is/usr/local/bin/
. This is where theoc
andkubectl
binaries will be installed. This path should be included in the systemPATH
.ocp_client_install_tmpdir
- Default value is/tmp/ocp_client_install
. This is the directory where the OCP Client archive will be downloaded.ocp_client_install_cleanup
- Default value isfalse
. By default, the temporary directory (ocp_client_install_tmpdir
) will not be deleted to ensure repeatability. Set this totrue
if you want to remove the temporary directory after installation.
Privilege Escalation
ocp_client_install_become
- Default value istrue
. If this role requires administrative rights, it will use the Ansiblebecome
feature (which relies on sudo).ocp_client_install_become_user
- Default value isroot
. If the role uses thebecome
feature for elevated privileges, this specifies the user to switch to.
Dependencies
None
Example Playbook
To download directly using an absolute URL to the archive:
- hosts: ocp_client_install
roles:
- role: oasis_roles.ocp_client_install
ocp_client_install_url: 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-4.2.4.tar.gz'
To automatically find the latest OCP Client archive URL using the index_href
role:
- hosts: ocp_client_install
vars:
# Remember the trailing slash
ocp_installers_index_url: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/
ocp_installers_index: "{{ query('url', ocp_installers_index_url) }}"
ocp_client_install_url: >-
{{ query('index_href', ocp_installers_index, 'client-linux',
base_url=ocp_installers_index_url) }}
roles:
- oasis_roles.ocp_client_install
- oasis_roles.index_href
Keep in mind that this example may change if the naming format for OCP Client download files is updated.
License
GPLv3
Author Information
Sean Myers semyers@redhat.com
Informazioni sul progetto
Download and install the oc and kubectl binaries to a specified directory
Installa
ansible-galaxy install oasis_roles.ocp_client_install
Licenza
gpl-3.0
Download
17.7k
Proprietario