summaryrefslogtreecommitdiffstats
path: root/roles/ands_openshift/tasks/ssh.yml
blob: 97f3926019affe6b673081c671c31c15642f6b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---
- 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_tasks: ssh_keygen.yml
  args:
    apply:
      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