Skip to content

Commit

Permalink
#891 Show OpenShift details
Browse files Browse the repository at this point in the history
  • Loading branch information
fketelaars committed Jan 30, 2025
1 parent 082a311 commit 486befc
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Login to the OpenShift cluster {{ _current_openshift_cluster.name }}
include_role:
name: openshift-login
vars:
_p_openshift_cluster_name: "{{ _current_openshift_cluster.name }}"

- name: Output OpenShift URLs and passwords
include_tasks: openshift-show-details.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Get kubeadmin password {rom the vault
include_role:
name: vault-get-secret
vars:
secret_name: "{{ _current_openshift_cluster.name }}-kubeadmin-password"
secret_group: "{{ environment_name }}"
_p_secret_variable: _kubeadmin_password

- name: Get oc-login secret
include_role:
name: vault-get-secret
vars:
secret_name: oc-login
secret_group: "{{ environment_name }}"
_p_secret_variable: _oc_login_secret

- name: Get OpenShift Console endpoint
shell: |
oc whoami --show-console
register: _openshift_console_endpoint

- name: Get OpenShift API endpoint
shell: |
oc whoami --show-server
register: _openshift_api_endpoint

- name: Make sure that directory {{ status_dir }}/cloud-paks exists
file:
path: "{{ status_dir }}/cloud-paks"
state: directory

- name: Write Cloud Pak for Data info to {{ status_dir }}/cloud-paks/cloud-pak-deployer-info.txt
blockinfile:
path: "{{ status_dir }}/cloud-paks/cloud-pak-deployer-info.txt"
create: True
insertafter: EOF
marker: ""
block: |
{{ lookup('template','openshift-details.j2') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- OpenShift cluster {{ _current_openshift_cluster.name }} ---
OpenShift Console URL: {{ _openshift_console_endpoint.stdout }}
OpenShift API endpoint: {{ _openshift_api_endpoint.stdout }}
{% if _kubeadmin_password | default('') != '' %}
kubeadmin password: {{ _kubeadmin_password }}
{% endif %}
{% if _oc_login_secret | default('') != '' %}
OpenShift login: {{ _oc_login_secret }}
{% endif %}
7 changes: 7 additions & 0 deletions playbooks/playbook-env-apply-80-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
path: "{{ status_dir }}/cloud-paks/cloud-pak-deployer-info.txt"
state: touch

- name: OpenShift smoke tests
include_role:
name: openshift-smoke-tests
loop: "{{ all_config.openshift | default([]) }}"
loop_control:
loop_var: _current_openshift_cluster

- name: OpenShift Red Hat SSO smoke tests
include_role:
name: openshift-redhat-sso-smoke-tests
Expand Down

0 comments on commit 486befc

Please sign in to comment.