summaryrefslogtreecommitdiffstats
path: root/roles/ands_openshift/tasks/ssh.yml
blob: 7d8d99de8bc3ff62f0bc711778937fb54f9c72f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: Check if ssh secret exists
  run_once: true
  delegate_to: "{{ groups.masters[0] }}"
  command: oc -n "{{ openshift_namespace }}" get secret/ands-ssh
  register: result
  changed_when: (result | failed)
  failed_when: false

- include: ssh_keygen.yml
  run_once: true
  delegate_to: "{{ groups.masters[0] }}"
  when: (result | changed)

- name: Read SSH public key
  shell: cat "{{ ssh_template_path }}/id_rsa.pub"
  changed_when: false
  register: result

- name: Distribute public keys
  authorized_key: user="root" key="{{result.stdout}}" state=present manage_dir=yes exclusive=no