summaryrefslogtreecommitdiffstats
path: root/roles/ands_openshift/tasks/ssh.yml
blob: e8cb8d18432a43a490695a5553b137b668356816 (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_tasks: 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