| | |
| | | --- |
| | | - name: "Ensuring SSH directory" |
| | | file: |
| | | path: "/home/{{ student_name }}/.ssh" |
| | | state: directory |
| | | owner: "{{ student_name }}" |
| | | delegate_to: "{{ bastion_internal }}" |
| | | when: bastion_internal is defined and student_name is defined |
| | | |
| | | - name: "Creating SSH keys on bastion" |
| | | openssh_keypair: |
| | | path: /home/{{ student_name }}/.ssh/openshift_key |
| | | delegate_to: "{{ bastion_internal }}" |
| | | when: bastion_internal is defined and student_name is defined |
| | | |
| | | - name: "Finding SSH key" |
| | | stat: |
| | | path: /home/{{ student_name }}/.ssh/openshift_key.pub |
| | | register: public_key |
| | | delegate_to: "{{ bastion_internal }}" |
| | | when: bastion_internal is defined and student_name is defined |
| | | |
| | | - name: "Reading public key" |
| | | shell: "cat /home/{{ student_name }}/.ssh/openshift_key.pub" |
| | | register: pub_key_contents |
| | | delegate_to: "{{ bastion_internal }}" |
| | | when: public_key.stat.exists|d('false') and bastion_internal is defined |
| | | |
| | | - name: "Adding public key to authorized_keys" |
| | | authorized_key: |
| | | user: "{{ migration_master_user_name | d('ec2-user') }}" |
| | | state: present |
| | | key: "{{ pub_key_contents.stdout }}" |
| | | when: pub_key_contents is defined and student_name is defined |
| | | |
| | | - name: "Creating temp directory for operator repo" |
| | | tempfile: |
| | | state: directory |