|
5 | 5 | become: yes |
6 | 6 | # VARS TO BE SUPPLIED VIA CLOUD INIT METADATA |
7 | 7 | vars: |
8 | | - control_node_ip: "172.16.1.228" |
| 8 | + server_node_ip: "172.16.1.154" |
9 | 9 | resolv_conf_nameservers: [1.1.1.1, 8.8.8.8] |
10 | 10 |
|
11 | | - nfs_export: "/exports/home" |
12 | | - nfs_client_mnt_options: |
13 | | - nfs_client_mnt_point: "/home" |
14 | | - nfs_client_mnt_state: mounted |
15 | | - nfs_server: "{{ control_node_ip }}" |
| 11 | + nfs_configurations: |
| 12 | + - nfs_export: "/exports/home" |
| 13 | + nfs_client_mnt_options: |
| 14 | + nfs_client_mnt_point: "/home" |
| 15 | + nfs_client_mnt_state: mounted |
| 16 | + nfs_server: "{{ server_node_ip }}" |
16 | 17 |
|
17 | 18 | os_manila_mount_state: mounted |
18 | 19 | os_manila_mount_opts: |
|
36 | 37 | uid: 1005 |
37 | 38 | basic_users_groups: [] |
38 | 39 |
|
39 | | - openhpc_conf_server: "{{ control_node_ip }}" |
| 40 | + openhpc_conf_server: "{{ server_node_ip }}" |
40 | 41 |
|
41 | 42 | tasks: |
42 | 43 | - name: Configure resolve.conf |
|
77 | 78 | - name: Mount /mnt/cluster |
78 | 79 | mount: |
79 | 80 | path: /mnt/cluster |
80 | | - src: "{{ vars.control_node_ip }}:/exports/cluster" |
| 81 | + src: "{{ vars.server_node_ip }}:/exports/cluster" |
81 | 82 | fstype: nfs |
82 | 83 | opts: rw,sync |
83 | 84 | state: mounted |
|
90 | 91 | group: root |
91 | 92 | mode: 0644 |
92 | 93 |
|
| 94 | + # - name: Include hostvars from NFS share |
| 95 | + # block: |
| 96 | + # - name: Extract short hostname using a shell block |
| 97 | + # shell: | |
| 98 | + # HOSTNAME=$(hostname) |
| 99 | + # echo "${HOSTNAME%.test.invalid}" |
| 100 | + # register: short_hostname |
| 101 | + |
| 102 | + # - name: Include vars from NFS mount |
| 103 | + # include_vars: |
| 104 | + # file: "/mnt/cluster/{{ short_hostname.stdout }}/hostvars.yml" |
| 105 | + |
93 | 106 |
|
94 | 107 | - name: NFS client mount |
95 | 108 | block: |
96 | 109 | - name: ensure mount directory exists |
97 | 110 | file: |
98 | | - path: "{{ nfs_client_mnt_point }}" |
| 111 | + path: "{{ item.get('nfs_client_mnt_point', nfs_client_mnt_point) }}" |
99 | 112 | state: directory |
| 113 | + loop: "{{ nfs_configurations }}" |
100 | 114 |
|
101 | 115 | - name: mount the filesystem |
102 | 116 | mount: |
103 | | - path: "{{ nfs_client_mnt_point }}" |
104 | | - src: "{{ nfs_server }}:{{ nfs_export }}" |
| 117 | + path: "{{ item.get('nfs_client_mnt_point', nfs_client_mnt_point) }}" |
| 118 | + src: "{{ item.get('nfs_server', nfs_server) }}:{{ item.get('nfs_export', nfs_export) }}" |
| 119 | + opts: "{{ item['nfs_client_mnt_options'] | default(nfs_client_mnt_options, true) | default(omit, true) }}" # for some reason items.get() here fails with "an incorrect mount option was specified" |
105 | 120 | fstype: nfs |
106 | | - state: "{{ nfs_client_mnt_state }}" |
| 121 | + state: "{{ item.get('nfs_client_mnt_state', nfs_client_mnt_state) }}" |
| 122 | + loop: "{{ nfs_configurations }}" |
107 | 123 |
|
108 | 124 |
|
109 | 125 | - name: Manila mount |
|
0 commit comments