joelbirchler
2020-03-04 cc7de5148fab759f9457fa4889805292ee09aaa2
Merge branch 'shared-status-report' of github.com:RedHatTraining/agnosticd into test
2 files added
4 files modified
75 ■■■■■ changed files
ansible/configs/ocp4-workshop/post_software.yml 29 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/pre_software.yml 4 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/requirements.yml 4 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/software.yml 36 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/templates/report-before-install.j2 1 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/templates/report.j2 1 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-workshop/post_software.yml
@@ -394,5 +394,30 @@
  gather_facts: false
  become: false
  tasks:
  - debug:
      msg: "Post-Software checks completed successfully"
    - name: Retrieve cluster UUID
      block:
        - name: Get kubeadmin password
          slurp:
            path: /home/{{ ansible_user }}/{{ cluster_name }}/auth/kubeadmin-password
          register: kubeadminr
        - name: Get Cluster ID
          environment:
            KUBECONFIG: /home/{{ ansible_user }}/{{ cluster_name }}/auth/kubeconfig
          command: oc get clusterversion version -o jsonpath="{.spec.clusterID}"
          register: clusteridr
        - name: Set cluster id
          set_fact:
            cluster_id: "{{ clusteridr.stdout | trim }}"
        - name: Report provisioning status
          include_role:
            name: status-report
          vars:
            classroom_status: "Classroom ready"
            status_json: "{{ lookup('template', 'report.j2') }}"
            bastion_dns_name: "bastion{{ guid }}{{ subdomain_base_suffix }}"
      when: report_status | d(false)
    - debug:
        msg: "Post-Software checks completed successfully"
ansible/configs/ocp4-workshop/pre_software.yml
@@ -45,6 +45,10 @@
  become: true
  roles:
  - { role: "bastion",              when: 'install_bastion | bool' }
  - role: "status-report-install"
    vars:
      bastion_dns_name: "bastion{{ guid }}{{ subdomain_base_suffix }}"
    when: 'report_status | d(false)'
  - { role: "bastion-student-user", when: 'install_student_user | bool' }
  - { role: "bastion-opentlc-ipa",  when: 'install_ipa_client | bool' }
  tags:
ansible/configs/ocp4-workshop/requirements.yml
@@ -4,3 +4,7 @@
- src: https://github.com/redhat-gpte-devopsautomation/ftl-injector
  name: ftl-injector
  version: v0.17.0
# From 'Stouts.wsgi'
- src: https://github.com/Stouts/Stouts.wsgi
  version: 2.1.4
ansible/configs/ocp4-workshop/software.yml
@@ -1,4 +1,19 @@
---
- name: OpenShift Provisioning Pre-Tasks
  hosts: localhost
  connection: local
  gather_facts: false
  become: no
  tasks:
    - name: Report provisioning status
      include_role:
        name: status-report
      vars:
        classroom_status: "Starting the OpenShift Installation"
        status_json: "{{ lookup('template', 'report-before-install.j2') }}"
        bastion_dns_name: "bastion{{ guid }}{{ subdomain_base_suffix }}"
      when: report_status | d(false)
- name: Step 00xxxxx software
  hosts: bastions
  gather_facts: false
@@ -51,7 +66,7 @@
              aws_access_key_id = {{ hostvars.localhost.student_access_key_id }}
              aws_secret_access_key = {{ hostvars.localhost.student_secret_access_key }}
        # For GA Releases
        # For GA Releases
        - name: Set URLs for OpenShift GA releases
          when: not ocp4_installer_use_dev_preview | d(False) | bool
          set_fact:
@@ -203,6 +218,16 @@
          command: oc whoami --show-server
          register: showserver
        - name: Get Cluster ID
          environment:
            KUBECONFIG: /home/{{ ansible_user }}/{{ cluster_name }}/auth/kubeconfig
          command: oc get clusterversion version -o jsonpath="{.spec.clusterID}"
          register: clusteridr
        - name: Set cluster id
          set_fact:
            cluster_id: "{{ clusteridr.stdout | trim }}"
        - name: Print Overview
          debug:
            msg: "{{ item }}"
@@ -233,6 +258,15 @@
            - "user.info: You *CANNOT* SSH into this environment"
          when: not install_student_user | bool
        - name: Report provisioning status
          include_role:
            name: status-report
          vars:
            classroom_status: "OpenShift Installation Completed"
            status_json: "{{ lookup('template', 'report.j2') }}"
            bastion_dns_name: "bastion{{ guid }}{{ subdomain_base_suffix }}"
          when: report_status | d(false)
      always:
        - name: Delete deployinprogress lock file
          file:
ansible/configs/ocp4-workshop/templates/report-before-install.j2
New file
@@ -0,0 +1 @@
{ "classroom_identifier": "{{ guid }}", "classroom_type": "{{ env_type }}", "classroom_region": "{{ aws_region }}", "status": "{{ classroom_status | d('unknown') }}" }
ansible/configs/ocp4-workshop/templates/report.j2
New file
@@ -0,0 +1 @@
{ "cluster_id": "{{ cluster_id }}", "cluster_username": "kubeadmin", "cluster_password": "{{ kubeadminr.content | b64decode }}", "cluster_api_url": "api.{{cluster_name}}{{subdomain_base_suffix}}:6443", "classroom_identifier": "{{ guid }}", "classroom_type": "{{ env_type }}", "classroom_region": "{{ aws_region }}", "status": "{{ classroom_status | d('unknown') }}" }