Johnathan Kupferer
2020-03-16 f98a616586e8fc8c257c62595d87acdcc63ccaee
Add agnosticd_user_info for ocp4-ha-lab (#1327)

2 files modified
121 ■■■■■ changed files
ansible/configs/ocp4-ha-lab/post_software.yml 22 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-ha-lab/software.yml 99 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp4-ha-lab/post_software.yml
@@ -254,18 +254,18 @@
        - name: Delete project
          command: oc delete project postflightcheck
        - 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
@@ -292,4 +292,4 @@
  become: false
  tasks:
  - debug:
      msg: "Post-Software checks completed successfully"
      msg: "Post-Software checks completed successfully"
ansible/configs/ocp4-ha-lab/software.yml
@@ -178,36 +178,48 @@
          environment:
            KUBECONFIG: /home/{{ ansible_user }}/{{ cluster_name }}/auth/kubeconfig
          command: oc whoami --show-server
          register: showserver
          register: r_showserver
        - name: Print Overview
          debug:
        - name: Openshift access user info messages
          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 https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ ocp4_installer_version }}/openshift-client-linux-{{ ocp4_installer_version }}.tar.gz"
          loop:
            - "Openshift Master Console: {{ webconsole }}"
            - "Openshift API for command line 'oc' client: {{ r_showserver.stdout | trim }}"
            - "Download oc client from https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ ocp4_installer_version }}/openshift-client-linux-{{ ocp4_installer_version }}.tar.gz"
        - name: Openshift access user data
          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:
@@ -222,29 +234,48 @@
  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: Print Student SSH access as user.info
      debug:
        msg: "{{ item }}"
      with_items:
        - "user.info: "
        - "user.info: SSH Access: ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}"
        - "user.info: SSH password: {{ student_password | d(hostvars[groups.bastions.0].student_password) }}"
      when:
        - 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
        - student_name is defined
        - student_password is defined or hostvars[groups.bastions.0].student_password is defined
      block:
        - name: Print Student SSH access as user.info
          agnosticd_user_info:
            msg: "{{ item }}"
          loop:
            - ""
            - "SSH Access: ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}"
            - "SSH password: {{ student_password | default(hostvars[groups.bastions.0].student_password) }}"
          when:
            - install_student_user | bool
            - student_name is defined
            - student_password is defined or hostvars[groups.bastions.0].student_password is defined
        - name: User access data
          agnosticd_user_info:
            data:
              student_ssh_command: "ssh {{ student_name }}@bastion.{{ guid }}{{ subdomain_base_suffix }}"
              student_ssh_password: "{{ student_password | default(hostvars[groups.bastions.0].student_password) }}"