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