From 4663a06ee72eadd3be41cddbeb539ef3f462ee8a Mon Sep 17 00:00:00 2001
From: Johnathan Kupferer <jkupfere@redhat.com>
Date: Mon, 16 Mar 2020 16:08:15 +0100
Subject: [PATCH] Add agnosticd_user_info for ocp4_workshop (#1320)

---
 ansible/configs/ocp4-workshop/post_software.yml |   20 +++++-----
 ansible/configs/ocp4-workshop/software.yml      |   90 +++++++++++++++++++++++++++++---------------
 2 files changed, 69 insertions(+), 41 deletions(-)

diff --git a/ansible/configs/ocp4-workshop/post_software.yml b/ansible/configs/ocp4-workshop/post_software.yml
index 4297ad0..0fbf95c 100644
--- a/ansible/configs/ocp4-workshop/post_software.yml
+++ b/ansible/configs/ocp4-workshop/post_software.yml
@@ -309,18 +309,18 @@
         - name: Switch back to default project
           command: oc project default
 
-        - debug:
+        - agnosticd_user_info:
             msg: "{{ item }}"
           loop:
-            - "user.info: "
-            - "user.info: Post Flight Check"
-            - "user.info: DNS Web Console ............... {{ 'OK' if checkdnswebconsole.rc == 0 else 'FAIL' }}"
-            - "user.info: DNS API ....................... {{ 'OK' if checkdnsapi.rc == 0 else 'FAIL' }}"
-            - "user.info: Web console ................... {{ 'OK' if testwebconsole is succeeded else 'FAIL' }}"
-            - "user.info: API ........................... {{ 'OK' if clusterinfor.rc == 0 else 'FAIL' }}"
-            - "user.info: Create Project with PV ........ {{ 'OK' if newproject.rc == 0 else 'FAIL' }}"
-            - "user.info: App deployed .................. {{ 'OK' if phpw.rc == 0 and mysqlw.rc == 0 else 'FAIL' }}"
-            - "user.info: Route ......................... {{ 'OK' if testroute is succeeded else 'FAIL' }}"
+            - ""
+            - "Post Flight Check"
+            - "DNS Web Console ............... {{ 'OK' if checkdnswebconsole.rc == 0 else 'FAIL' }}"
+            - "DNS API ....................... {{ 'OK' if checkdnsapi.rc == 0 else 'FAIL' }}"
+            - "Web console ................... {{ 'OK' if testwebconsole is succeeded else 'FAIL' }}"
+            - "API ........................... {{ 'OK' if clusterinfor.rc == 0 else 'FAIL' }}"
+            - "Create Project with PV ........ {{ 'OK' if newproject.rc == 0 else 'FAIL' }}"
+            - "App deployed .................. {{ 'OK' if phpw.rc == 0 and mysqlw.rc == 0 else 'FAIL' }}"
+            - "Route ......................... {{ 'OK' if testroute is succeeded else 'FAIL' }}"
 
         - when:
             - smoke_tests | bool
diff --git a/ansible/configs/ocp4-workshop/software.yml b/ansible/configs/ocp4-workshop/software.yml
index 2805bf8..ca2a305 100644
--- a/ansible/configs/ocp4-workshop/software.yml
+++ b/ansible/configs/ocp4-workshop/software.yml
@@ -201,36 +201,48 @@
           environment:
             KUBECONFIG: /home/{{ ansible_user }}/{{ cluster_name }}/auth/kubeconfig
           command: oc whoami --show-server
-          register: showserver
+          register: r_showserver
 
         - name: Print Overview
-          debug:
+          agnosticd_user_info:
             msg: "{{ item }}"
-          with_items:
-            - "user.info: Openshift Master Console: {{ webconsole }}"
-            - "user.info: Openshift API for command line 'oc' client: {{ showserver.stdout | trim }}"
-            - "user.info: Download oc client from {{ ocp4_client_url }}"
+          loop:
+            - "Openshift Master Console: {{ webconsole }}"
+            - "Openshift API for command line 'oc' client: {{ r_showserver.stdout | trim }}"
+            - "Download oc client from {{ ocp4_client_url }}"
+
+        - name: Print Overview
+          agnosticd_user_info:
+            data:
+              openshift_console_url: "{{ webconsole }}"
+              openshift_api_url: "{{ r_showserver.stdout | trim }}"
+              openshift_client_download_url: "{{ ocp4_client_url }}"
 
         - name: Output htpasswd
-          debug:
-            msg: "user.info: This cluster has authentication enabled. You can use '{{ admin_user }}' with password '{{ admin_password }}' to access your cluster"
+          agnosticd_user_info:
+            msg: "This cluster has authentication enabled. You can use '{{ admin_user }}' with password '{{ admin_password }}' to access your cluster"
+            data:
+              openshift_admin_user: "{{ admin_user }}"
+              openshift_admin_password: "{{ admin_password }}"
           when:
             - admin_password is defined
             - install_idm == "htpasswd"
 
         - name: Output kubeadmin
-          debug:
-            msg: "user.info: Kubeadmin user / password: kubeadmin / {{ kubeadminr.content | b64decode }}"
+          agnosticd_user_info:
+            msg: "Kubeadmin user / password: kubeadmin / {{ kubeadminr.content | b64decode }}"
+            data:
+              openshift_kubeadmin_password: "{{ kubeadminr.content | b64decode }}"
           when: >-
             install_idm is not defined
             or install_idm != "htpasswd"
 
         - name: Print SSH warning
-          debug:
+          agnosticd_user_info:
             msg: "{{ item }}"
-          with_items:
-            - "user.info: "
-            - "user.info: You *CANNOT* SSH into this environment"
+          loop:
+            - ""
+            - "You *CANNOT* SSH into this environment"
           when: not install_student_user | bool
 
       always:
@@ -245,20 +257,28 @@
   become: false
   tasks:
     # NOT Pre-installed
-    - name: Print Student aws access as user.info
-      debug:
-        msg: "{{ item }}"
-      with_items:
-        - "user.info: Top level domain: {{ subdomain_base_suffix }}"
-        - "user.info: "
-        - "user.info: WARNING: with great power comes great responsibility. We monitor usage."
-        - "user.info: Your AWS programmatic access:"
-        - "user.info: aws_access_key_id = {{ student_access_key_id }}"
-        - "user.info: aws_secret_access_key = {{ student_secret_access_key }}"
-      when:
+    - when:
         - not install_ocp4 | bool
         - student_access_key_id is defined
         - student_secret_access_key is defined
+      block:
+        - name: Print Student aws access as user.info
+          agnosticd_user_info:
+            msg: "{{ item }}"
+          loop:
+            - "Top level domain: {{ subdomain_base_suffix }}"
+            - ""
+            - "WARNING: with great power comes great responsibility. We monitor usage."
+            - "Your AWS programmatic access:"
+            - "aws_access_key_id = {{ student_access_key_id }}"
+            - "aws_secret_access_key = {{ student_secret_access_key }}"
+
+        - name: Set aws access user data
+          agnosticd_user_info:
+            data:
+              subdomain_base_suffix: "{{ subdomain_base_suffix }}"
+              aws_access_key_id: "{{ student_access_key_id }}"
+              aws_secret_access_key: "{{ student_secret_access_key }}"
 
     - when:
         - install_student_user | bool
@@ -266,13 +286,21 @@
         - student_password is defined or hostvars[groups.bastions.0].student_password is defined
       block:
         - name: Print Student SSH access as user.info
-          debug:
+          agnosticd_user_info:
             msg: "{{ item }}"
-          with_items:
-            - "user.info: "
-            - "user.info: SSH Access: ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}"
+            data:
+              student_ssh_command: >-
+                ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}
+          loop:
+            - ""
+            - "SSH Access: ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}"
 
         - name: Print Student SSH password as user.info
-          debug:
-            msg: "user.info: SSH password: {{ student_password | d(hostvars[groups.bastions.0].student_password) }}"
+          agnosticd_user_info:
+            msg: "SSH password: {{ student_ssh_password }}"
+            data:
+              student_ssh_password: "{{ student_ssh_password }}"
+          vars:
+            student_ssh_password: >-
+              {{ student_password | default(hostvars[groups.bastions.0].student_password) }}
           when: print_student_password | default(true) | bool

--
Gitblit v1.9.3