Skip to content
Snippets Groups Projects
Commit a16721e0 authored by Jupiter Hu's avatar Jupiter Hu
Browse files

restore export template

parent 71efd97b
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@
- { role: slurm-build }
- { role: nfs-server, configDiskDevice: false }
- { role: slurm, slurm_use_vpn: true}
- { role: installPackage, cliAction: "{'command': 'cp -r /usr/local/Modules/modulefiles/cvl /usr/local/Modules/modulefiles/massive', 'check': '/usr/local/Modules/modulefiles/massive' }"
- { role: installPackage, cliCopy: {'run': 'cp -r /usr/local/Modules/modulefiles/cvl /usr/local/Modules/modulefiles/massive', 'check': '/usr/local/Modules/modulefiles/massive'} }
tasks:
setup:
......@@ -53,11 +53,13 @@
slurmqueues:
- {name: batch, group: ComputeNodes, default: true}
nfs_server: "{{ groups['OpenvpnServer'][0] }}"
groupList:
- { name : 'ComputeNodes', interface : 'tun0' }
roles:
- { role: OpenVPN-Client, x509_ca_server: "cvl23server" }
- { role: ntp }
- { role: openLdapClient }
- { role: syncExports, nfs_server: "cvl23server", nfsExportFile: "/etc/exports", nfsClientIp: "{{ ansible_tun0.ipv4.address }}", nfsServerOption: "ro,fsid=0,sync" }
- { role: syncExports, nfs_server: "cvl23server", exportList: [{ name: '/', src: '/usr/local', fstype: 'nfs4', opts: 'defaults,ro,nofail', nfsServerIp: "{{ hostvars['cvl23server']['ansible_tun0']['ipv4']['address'] }}", srvopts: 'ro,fsid=0,sync' }] }
- { role: nfs-client, exportList: "[{ 'name': '/home', 'src': '/', 'fstype': 'nfs4', 'opts': 'defaults,nofail', 'nfsServerIp': '{{ nfsServerIpAddress }}', 'nfsClientIp': '{{ ansible_tun0.ipv4.address }}', 'srvopts': 'rw,root_squash,fsid=0,sync' }]" }
- { role: nfs-client, exportList: "[ { 'name': '/usr/local', 'src': '/', 'fstype': 'nfs4', 'opts': 'defaults,ro,nofail', 'nfsServerIp': '{{ hostvars[nfs_server]['ansible_tun0']['ipv4']['address'] }}', 'srvopts': 'ro,fsid=0,sync' }]" }
- { role: slurm, slurm_use_vpn: true}
......@@ -88,5 +90,5 @@
- { role: openLdapClient }
- { role: nfs-client, exportList: "[{ 'name': '/home', 'src': '/', 'fstype': 'nfs4', 'opts': 'defaults,nofail', 'nfsServerIp': '{{ nfsServerIpAddress }}', 'nfsClientIp': '{{ ansible_tun0.ipv4.address }}', 'srvopts': 'rw,root_squash,fsid=0,sync' }]" }
- { role: slurm, slurm_use_vpn: true}
- { role: installPackage, importRepo: { command: "wget http://cvlrepo.massive.org.au/repo/cvl.repo -O", destination: "/etc/yum.repos.d/cvl.repo" }, yumGroupPackageList: ['CVL Pre-installation', 'CVL Base Packages', 'CVL System', 'CVL System Extension'], cliAction: {'run': 'cp -r /usr/local/Modules/modulefiles/cvl /usr/local/Modules/modulefiles/massive', 'check': '/usr/local/Modules/modulefiles/massive'} }
- { role: installPackage, importRepo: { command: "wget http://cvlrepo.massive.org.au/repo/cvl.repo -O", destination: "/etc/yum.repos.d/cvl.repo" }, yumGroupPackageList: ['CVL Pre-installation', 'CVL Base Packages', 'CVL System', 'CVL System Extension'], cliCopy: {'run': 'cp -r /usr/local/Modules/modulefiles/cvl /usr/local/Modules/modulefiles/massive', 'check': '/usr/local/Modules/modulefiles/massive'} }
......@@ -30,11 +30,11 @@
when: ansible_distribution == 'CentOS' and postInstallation is defined
- name: conditional shell copy command
shell: "{{ cliAction.run }}"
shell: "{{ cliCopy.run }}"
sudo: true
run_once: true
args:
creates: "{{ cliAction.check }}"
creates: "{{ cliCopy.check }}"
when: ansible_distribution == 'CentOS' and cliAction is defined
---
- name: "Add hosts to /etc/exports"
script: ./scripts/makeexports.py "{{ nfsExportFile }}" "{{ nfsClientIp }}" "{{ nfsServerOption }}" "/usr/local"
- name: "Templating /etc/exports"
template: src=exports.j2 dest=/etc/exports owner=root group=root mode=644
delegate_to: "{{ nfs_server }}"
run_once: true
sudo: true
notify: "Reload exports"
#!/usr/bin/python
import sys, os
def config(source, host, option, input = None):
content = None
if input:
if not host in input:
content = input + " " + host + "(" + option + ")"
else:
content = source + " " + host + "(" + option + ")"
return content
path = sys.argv[1]
host = sys.argv[2]
option = sys.argv[3]
source = sys.argv[4]
io = open(path, 'r')
input = io.read()
io.close()
content = config(source, host, option, input)
if content:
io = open(path, 'w')
io.write(content)
io.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment