Guillaume Coré
2019-07-12 62b2ec5a14130467a2b9916cc161c2372d02ab2d
OCP Workshop: print user.info for access

Reuse some of the code from ocp4-workshop: print information about how to access
the environment using 'user.info' pattern.

This allows dynamic information in emails to be sent.

Fix student groups: do not add 'wheel' if student_sudo is not true.
2 files modified
27 ■■■■ changed files
ansible/configs/ocp-workshop/post_software.yml 23 ●●●●● patch | view | raw | blame | history
ansible/roles/bastion-student-user/tasks/main.yml 4 ●●●● patch | view | raw | blame | history
ansible/configs/ocp-workshop/post_software.yml
@@ -678,11 +678,32 @@
      - ocp_report|bool
      - cloud_provider == 'ec2'
  - name: Sending Console URL for Azure and Documentation
  - name: Sending Console URL
    debug:
      msg: "{{ item }}"
    with_items:
      - "user.info: Openshift Master Console: https://{{ master_lb_dns }}/console"
  - 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
          debug:
            msg: "{{ item }}"
          with_items:
            - "user.info: "
            - "user.info: 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) }}"
          when: print_student_password | default(true) | bool
  - name: Sending Console URL for Azure and Documentation
    debug:
      msg: "{{ item }}"
    with_items:
      - "user.info: User guide for the workshop: https://gist.github.com/vincepower/e16aaf96b996aa2dbe581cb67c7fdf12"
    when:
      - cloud_provider == 'azure'
ansible/roles/bastion-student-user/tasks/main.yml
@@ -2,7 +2,7 @@
---
# tasks file for bastion
######################### Setting up a bastion host to use student/r3dh4t1! to access
######################### Setting up a bastion host to use student/password to access
# Enable SSH Login with UserID/Password
# needs a parameter:
@@ -28,7 +28,7 @@
    password: "{{ student_password|password_hash('sha512') }}"
    comment: GTPE Student
    group: users
    groups: wheel
    groups: "{{ 'wheel' if student_sudo | bool else '' }}"
    shell: /bin/bash
    state: present