|
10 | 10 | enable_resolv_conf: "{{ os_metadata.meta.enable_resolv_conf | default(false) | bool }}"
|
11 | 11 | enable_etc_hosts: "{{ os_metadata.meta.enable_etc_hosts | default(false) | bool }}"
|
12 | 12 | enable_nfs: "{{ os_metadata.meta.enable_nfs | default(false) | bool }}"
|
| 13 | + enable_manila: "{{ os_metadata.meta.enable_manila | default(false) | bool }}" |
13 | 14 |
|
14 | 15 | # TODO: "= role defaults" - could be moved to a vars_file: on play with similar precedence effects
|
15 | 16 | resolv_conf_nameservers: []
|
|
23 | 24 |
|
24 | 25 | # openhpc: no defaults required
|
25 | 26 |
|
| 27 | + os_manila_mount_shares: [] |
| 28 | + os_manila_mount_ceph_conf_path: /etc/ceph |
| 29 | + os_manila_mount_state: mounted |
| 30 | + os_manila_mount_opts: |
| 31 | + - x-systemd.device-timeout=30 |
| 32 | + - x-systemd.mount-timeout=30 |
| 33 | + - noatime |
| 34 | + - _netdev # prevents mount blocking early boot before networking available |
| 35 | + - rw |
| 36 | + |
26 | 37 | tasks:
|
27 | 38 | - block:
|
28 | 39 | - name: Report skipping initialization if not compute node
|
|
103 | 114 | mode: 0644
|
104 | 115 | when: enable_etc_hosts
|
105 | 116 |
|
106 |
| - # TODO: - name: NFS client mount |
| 117 | + # NFS client mount |
107 | 118 | - name: If nfs-clients is present
|
108 |
| - include_tasks: ../tasks/nfs-clients.yml |
| 119 | + include_tasks: tasks/nfs-clients.yml |
109 | 120 | when:
|
110 | 121 | - enable_nfs
|
111 | 122 | - nfs_enable.clients | bool or ('nfs_enable' in item and item.nfs_enable.clients | bool)
|
112 | 123 | loop: "{{ nfs_configurations }}"
|
113 | 124 |
|
114 |
| - # TODO: - name: Manila mount |
| 125 | + - name: Manila mounts |
| 126 | + block: |
| 127 | + - name: Read manila share info from nfs file |
| 128 | + include_vars: |
| 129 | + file: /mnt/cluster/manila_share_info.yml |
| 130 | + no_log: true # contains secrets |
| 131 | + |
| 132 | + - name: Ensure Ceph configuration directory exists |
| 133 | + ansible.builtin.file: |
| 134 | + path: "{{ os_manila_mount_ceph_conf_path }}" |
| 135 | + state: directory |
| 136 | + mode: "0755" |
| 137 | + owner: root |
| 138 | + group: root |
| 139 | + |
| 140 | + - name: Configure ceph.conf using os_manila_mount_host |
| 141 | + ansible.builtin.template: |
| 142 | + src: ceph.conf.j2 |
| 143 | + dest: "{{ os_manila_mount_ceph_conf_path }}/ceph.conf" |
| 144 | + owner: root |
| 145 | + group: root |
| 146 | + mode: "0600" |
| 147 | + |
| 148 | + - name: Ensure mount directory exists |
| 149 | + ansible.builtin.file: |
| 150 | + path: "{{ item.mount_path }}" |
| 151 | + state: directory |
| 152 | + owner: "{{ item.mount_user | default(omit) }}" |
| 153 | + group: "{{ item.mount_group | default(omit) }}" |
| 154 | + mode: "{{ item.mount_mode | default(omit) }}" |
| 155 | + loop: "{{ os_manila_mount_shares }}" |
| 156 | + loop_control: |
| 157 | + label: "{{ item.share_name }}" |
| 158 | + |
| 159 | + - name: Write Ceph client keyring |
| 160 | + ansible.builtin.template: |
| 161 | + src: ceph.keyring.j2 |
| 162 | + dest: "{{ os_manila_mount_ceph_conf_path }}/ceph.client.{{ item.share_user }}.keyring" |
| 163 | + mode: "0600" |
| 164 | + owner: root |
| 165 | + group: root |
| 166 | + loop: "{{ os_manila_mount_share_info }}" |
| 167 | + loop_control: |
| 168 | + label: "{{ item.share_name }}" |
| 169 | + |
| 170 | + - name: Mount the Ceph share |
| 171 | + ansible.posix.mount: |
| 172 | + path: "{{ item[0].mount_path }}" |
| 173 | + src: "{{ item[1].host }}:{{ item[1].export }}" |
| 174 | + fstype: ceph |
| 175 | + opts: "name={{ item[1].share_user }},{{ (item[0].mount_opts | default(os_manila_mount_opts)) | join(',') }}" |
| 176 | + # NB share_user is looked up here in case of autodetection |
| 177 | + state: "{{ item[0].mount_state | default(os_manila_mount_state) }}" |
| 178 | + loop: "{{ os_manila_mount_shares | zip(os_manila_mount_share_info) }}" |
| 179 | + loop_control: |
| 180 | + label: "{{ item[0].share_name }}" |
| 181 | + |
| 182 | + - name: Ensure mounted directory has correct permissions |
| 183 | + ansible.builtin.file: |
| 184 | + path: "{{ item.mount_path }}" |
| 185 | + state: directory |
| 186 | + owner: "{{ item.mount_user | default(omit) }}" |
| 187 | + group: "{{ item.mount_group | default(omit) }}" |
| 188 | + mode: "{{ item.mount_mode | default(omit) }}" |
| 189 | + loop: "{{ os_manila_mount_shares }}" |
| 190 | + loop_control: |
| 191 | + label: "{{ item.share_name }}" |
| 192 | + when: item.mount_state | default(os_manila_mount_state) in ['mounted' or 'ephemeral'] |
| 193 | + when: |
| 194 | + - enable_manila |
| 195 | + - os_manila_mount_shares | length > 0 |
115 | 196 |
|
116 | 197 | # TODO: - name: Basic users setup
|
117 | 198 |
|
|
0 commit comments