|
1 | 1 | --- |
2 | | -- name: ssh-keys | get public key for oracle user |
3 | | - ansible.builtin.shell: cat /home/{{ oracle_user }}/.ssh/id_rsa.pub |
4 | | - # noqa command-instead-of-shell no-changed-when |
5 | | - register: oracle_key |
6 | | - tags: |
7 | | - - sshkeys |
| 2 | +- name: Deploy SSH-Keys on Cluster |
| 3 | + block: |
8 | 4 |
|
9 | | -- name: ssh-keys | get public key for grid user |
10 | | - ansible.builtin.shell: cat /home/{{ grid_user }}/.ssh/id_rsa.pub |
11 | | - # noqa command-instead-of-shell |
12 | | - register: grid_key |
13 | | - when: role_separation |
14 | | - tags: |
15 | | - - sshkeys |
| 5 | + - name: ssh-keys | get public key for oracle user |
| 6 | + ansible.builtin.shell: cat /home/{{ oracle_user }}/.ssh/id_rsa.pub |
| 7 | + # noqa command-instead-of-shell no-changed-when |
| 8 | + register: oracle_key |
| 9 | + tags: |
| 10 | + - sshkeys |
16 | 11 |
|
17 | | -- name: ssh-keys | Add keys for {{ oracle_user }} user |
18 | | - ansible.builtin.authorized_key: user={{ oracle_user }} key="{{ item[1] }}" |
19 | | - delegate_to: "{{ item[0] }}" |
20 | | - with_nested: |
21 | | - - "{{ groups[hostgroup] }}" |
22 | | - - "{{ oracle_key.stdout }}" |
23 | | - tags: |
24 | | - - sshkeys |
25 | | - when: oracle_key is defined |
| 12 | + - name: ssh-keys | get public key for grid user |
| 13 | + ansible.builtin.shell: cat /home/{{ grid_user }}/.ssh/id_rsa.pub |
| 14 | + # noqa command-instead-of-shell |
| 15 | + register: grid_key |
| 16 | + when: role_separation |
| 17 | + tags: |
| 18 | + - sshkeys |
26 | 19 |
|
27 | | -- name: ssh-keys | Add keys for {{ grid_user }} user |
28 | | - ansible.builtin.authorized_key: user={{ grid_user }} key="{{ item[1] }}" |
29 | | - delegate_to: "{{ item[0] }}" |
30 | | - with_nested: |
31 | | - - "{{ groups[hostgroup] }}" |
32 | | - - "{{ grid_key.stdout }}" |
33 | | - tags: |
34 | | - - sshkeys |
35 | | - when: role_separation and grid_key is defined |
| 20 | + - name: ssh-keys | Add keys for {{ oracle_user }} user |
| 21 | + ansible.builtin.authorized_key: user={{ oracle_user }} key="{{ item[1] }}" |
| 22 | + delegate_to: "{{ item[0] }}" |
| 23 | + with_nested: |
| 24 | + - "{{ groups[hostgroup] }}" |
| 25 | + - "{{ oracle_key.stdout }}" |
| 26 | + tags: |
| 27 | + - sshkeys |
| 28 | + when: oracle_key is defined |
36 | 29 |
|
37 | | -- name: ssh-keys | create .known_hosts |
38 | | - ansible.builtin.file: |
39 | | - path: "/home/{{ item }}/.ssh/known_hosts" |
40 | | - state: touch |
41 | | - owner: "{{ item }}" |
42 | | - group: "{{ oracle_group }}" |
43 | | - mode: 0600 |
44 | | - with_items: |
45 | | - - "{{ oracle_user }}" |
46 | | - - "{% if role_separation %}{{ grid_user }}{% else %}[]{% endif %}" |
47 | | - changed_when: false |
48 | | - tags: sshkeys,known_hosts |
| 30 | + - name: ssh-keys | Add keys for {{ grid_user }} user |
| 31 | + ansible.builtin.authorized_key: user={{ grid_user }} key="{{ item[1] }}" |
| 32 | + delegate_to: "{{ item[0] }}" |
| 33 | + with_nested: |
| 34 | + - "{{ groups[hostgroup] }}" |
| 35 | + - "{{ grid_key.stdout }}" |
| 36 | + tags: |
| 37 | + - sshkeys |
| 38 | + when: role_separation and grid_key is defined |
49 | 39 |
|
50 | | -- ansible.builtin.include: known-hosts.yml |
51 | | - with_items: |
52 | | - - "{{ oracle_user }}" |
53 | | - - "{% if role_separation %}{{ grid_user }}{% else %}[]{% endif %}" |
54 | | - loop_control: |
55 | | - loop_var: user |
56 | | - tags: sshkeys,known_hosts |
| 40 | + - name: ssh-keys | create .known_hosts |
| 41 | + ansible.builtin.file: |
| 42 | + path: "/home/{{ item }}/.ssh/known_hosts" |
| 43 | + state: touch |
| 44 | + owner: "{{ item }}" |
| 45 | + group: "{{ oracle_group }}" |
| 46 | + mode: 0600 |
| 47 | + with_items: |
| 48 | + - "{{ oracle_user }}" |
| 49 | + - "{% if role_separation %}{{ grid_user }}{% else %}[]{% endif %}" |
| 50 | + changed_when: false |
| 51 | + tags: sshkeys,known_hosts |
| 52 | + |
| 53 | + - ansible.builtin.include: known-hosts.yml |
| 54 | + with_items: |
| 55 | + - "{{ oracle_user }}" |
| 56 | + - "{% if role_separation %}{{ grid_user }}{% else %}[]{% endif %}" |
| 57 | + loop_control: |
| 58 | + loop_var: user |
| 59 | + tags: sshkeys,known_hosts |
| 60 | + |
| 61 | + when: |
| 62 | + - configure_cluster | default(false) |
0 commit comments