Skip to content

Commit 8e2de65

Browse files
committed
Persist control local facts on state volume
1 parent 3a6f85e commit 8e2de65

File tree

1 file changed

+12
-7
lines changed
  • roles/persist_openhpc_secrets/tasks

1 file changed

+12
-7
lines changed

roles/persist_openhpc_secrets/tasks/main.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@
22

33
- name: Check if OpenHPC secrets exist
44
stat:
5-
path: /etc/ansible/facts.d/openhpc_secrets.fact
5+
path: "{{ appliances_state_dir }}/ansible/facts.d/openhpc_secrets.fact"
66
register: openhpc_secrets_stat
77

88
- name: Persist OpenHPC secrets
99
block:
1010
- name: Ensure Ansible facts directory exists
1111
file:
12-
path: /etc/ansible/facts.d
12+
path: "{{ appliances_state_dir }}/ansible/facts.d"
1313
state: directory
14+
owner: root
15+
mode: 0600
1416
recurse: yes
1517

1618
- name: Write OpenHPC secrets
1719
template:
1820
src: openhpc_secrets.fact
19-
dest: /etc/ansible/facts.d/openhpc_secrets.fact
20-
21-
- name: Re-read facts after adding custom fact
22-
ansible.builtin.setup:
23-
filter: ansible_local
21+
dest: "{{ appliances_state_dir }}/ansible/facts.d/openhpc_secrets.fact"
22+
owner: root
23+
mode: 0600
2424
when: "not openhpc_secrets_stat.stat.exists"
25+
26+
- name: Read facts
27+
ansible.builtin.setup:
28+
fact_path: "{{ appliances_state_dir }}/ansible/facts.d"
29+
filter: ansible_local

0 commit comments

Comments
 (0)