Skip to content

Commit 054cb73

Browse files
committed
copy /etc/hosts to /exports/hosts/hosts
1 parent 9e30bf6 commit 054cb73

File tree

2 files changed

+29
-0
lines changed
  • ansible/roles/etc_hosts/tasks
  • environments/common/inventory/group_vars/all

2 files changed

+29
-0
lines changed

ansible/roles/etc_hosts/tasks/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,26 @@
66
group: root
77
mode: 0644
88
become: yes
9+
10+
- name: Ensure /exports/hosts directory exists and copy /etc/hosts
11+
block:
12+
- name: Ensure the /exports/hosts directory exists
13+
file:
14+
path: /exports/hosts
15+
state: directory
16+
owner: root
17+
group: root
18+
mode: 0755
19+
become: yes
20+
delegate_to: "{{ groups['control'] | first }}"
21+
22+
- name: Copy /etc/hosts to NFS exported directory
23+
copy:
24+
src: /etc/hosts
25+
dest: /exports/hosts/hosts
26+
owner: root
27+
group: root
28+
mode: 0644
29+
remote_src: true
30+
become: yes
31+
delegate_to: "{{ groups['control'] | first }}"

environments/common/inventory/group_vars/all/nfs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ nfs_configurations:
1515
nfs_server: "{{ nfs_server_default }}"
1616
nfs_export: "/exports/home" # assumes skeleton TF is being used
1717
nfs_client_mnt_point: "/home"
18+
19+
- comment: Export /etc/hosts copy from Slurm control node
20+
nfs_enable:
21+
server: "{{ inventory_hostname in groups['control'] }}"
22+
clients: false
23+
nfs_export: "/exports/hosts" # control node has to copy in /etc/hosts to here

0 commit comments

Comments
 (0)