Skip to content

Commit d222592

Browse files
committed
orahost_ssh: added block with configure_cluster check
1 parent 0d0fbbb commit d222592

File tree

3 files changed

+60
-52
lines changed

3 files changed

+60
-52
lines changed

changelogs/fragments/271-ssh.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bugfixes:
3+
- "orahost_ssh: added block with configure_cluster check (#271)"

playbooks/os.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
- common
1111
- orahost
1212
- orahost_storage
13-
- name: orahost_ssh
14-
when: configure_cluster | default(false)
13+
- orahost_ssh
1514
- cxoracle
1615
- orahost_logrotate
1716

roles/orahost_ssh/tasks/main.yml

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,62 @@
11
---
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:
84

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
1611

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
2619

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
3629

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
4939

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

Comments
 (0)