Commit 2e96d0fe authored by Chris Hines's avatar Chris Hines
Browse files

make use of the inventory a bit better to get the exports

parent 4eeccf88
......@@ -63,11 +63,22 @@ def make_vars_filesystems(choices, inventory):
# ATM we have only one NFS server, and its hostname ends in -sql because it does double duty as the SQL server for slurm accounting logs
nfsserver = "{}-sql0".format(choices['clustername'])
for vol in ['userdata','slurm_state', 'userdata2']:
#for vol in ['userdata','slurm_state', 'userdata2']:
data['exports']=[]
data['disks'] = {}
for (name,value) in inventory['all']['children']['hostvars']['hosts'][nfsserver]['ansible_host_volumes'].items():
try:
vol = "_".join(name.split('_')[1:])
data['{}_disk'.format(vol)] = inventory['all']['children']['hostvars']['hosts'][nfsserver]['ansible_host_volumes']["{}_{}".format(clustername,vol)]['dev']
except:
pass
data['exports'].append(vol)
data['disks'][vol] = inventory['all']['children']['hostvars']['hosts'][nfsserver]['ansible_host_volumes']["{}_{}".format(clustername,vol)]['dev']
except Exception as e:
import traceback
print(traceback.format_exc())
print(e)
#pass
with open('pre_templates/filesystems_yml.j2') as f:
template = jinja2.Template(f.read())
......
domain: {{ domain }}
volumes:
{% for name in exports %}
- host: {{ clustername}}-sql0
dev: {{ slurm_state_disk }}
mnt: /mnt/slurm_state
- host: {{ clustername }}-sql0
dev: {{ userdata_disk }}
mnt: /mnt/userdata
- host: {{ clustername }}-sql0
dev: {{ userdata2_disk }}
mnt: /mnt/nfs01
dev: {{ disks[name] }}
mnt: /mnt/{{ name }}
{% endfor %}
nfsexports:
- host: {{ clustername }}-sql0
exportList:
- src: /mnt/userdata
- src: /mnt/slurm_state
- src: /home
- src: /mnt/nfs01
{% for name in exports %} - src: /mnt/{{ name }}
{% endfor %}
{% for name in ['/home','/nfs/opt'] %} - src: {{ name }}
{% endfor %}
nfsmounts:
- group: LoginNodes
nfsMounts:
- name: /userdata
ipv4: {{ clustername }}-sql0
src: /mnt/userdata
fstype: nfs4
opts: "defaults,rw"
- name: /mnt/nfs01
{% for name in exports %}
- name: /mnt/{{ name }}
ipv4: {{ clustername }}-sql0
src: /mnt/nfs01
src: /mnt/{{ name }}
fstype: nfs4
opts: "defaults,rw"
- name: /home
{% endfor %}
{% for name in ['/home','/nfs/opt'] %}
- name: {{ name }}
ipv4: {{ clustername }}-sql0
src: /home
src: {{ name }}
fstype: nfs4
opts: "defaults,rw"
{% endfor %}
- group: ComputeNodes
nfsMounts:
- name: /userdata
ipv4: {{ clustername }}-sql0
src: /mnt/userdata
fstype: nfs4
opts: "defaults,rw"
- name: /mnt/nfs01
{% for name in exports %}
- name: /mnt/{{ name }}
ipv4: {{ clustername }}-sql0
src: /mnt/nfs01
src: /mnt/{{ name }}
fstype: nfs4
opts: "defaults,rw"
opts: "defaults,rw" {% endfor %}
- name: /home
ipv4: {{ clustername }}-sql0
src: /home
......@@ -53,8 +44,9 @@ nfsmounts:
opts: "defaults,rw"
- group: ManagementNodes
nfsMounts:
- name: /slurm_state
{% for name in exports %}
- name: /mnt/{{ name }}
ipv4: {{ clustername }}-sql0
src: /mnt/slurm_state
src: /mnt/{{ name }}
fstype: nfs4
opts: "defaults,rw"
opts: "defaults,rw" {% endfor %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment