forked from redhat-cop/ocp4-helpernode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_ssh_keys.yaml
65 lines (61 loc) · 1.83 KB
/
generate_ssh_keys.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- file:
path: "{{ ansible_env.HOME }}/.ssh"
state: directory
mode: 0700
- openssh_keypair:
path: "{{ ansible_env.HOME }}/.ssh/helper_rsa"
size: 4096
comment: "{{ ansible_env.USER }}@helper"
state: present
- blockinfile:
path: "{{ ansible_env.HOME }}/.ssh/config"
state: present
backup: yes
create: yes
marker: "# {mark} {{ item.name }} MANAGED BLOCK"
block: |
Host {{ item.name }}
HostName %h.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
Host {{ item.name }}.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
loop: "{{ masters }}"
- blockinfile:
path: "{{ ansible_env.HOME }}/.ssh/config"
state: present
backup: yes
create: yes
marker: "# {mark} {{ item.name }} MANAGED BLOCK"
block: |
Host {{ item.name }}
HostName %h.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
Host {{ item.name }}.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
loop: "{{ workers }}"
when:
- workers is defined
- workers | length > 0
- blockinfile:
path: "{{ ansible_env.HOME }}/.ssh/config"
state: present
backup: yes
create: yes
marker: "# {mark} {{ item.name }} MANAGED BLOCK"
block: |
Host {{ item.name }}
HostName %h.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
Host {{ item.name }}.{{ dns.clusterid }}.{{ dns.domain }}
User core
IdentityFile {{ ansible_env.HOME }}/.ssh/helper_rsa
loop:
- name: "{{ bootstrap.name }}"
when:
- bootstrap is defined