Skip to content
Snippets Groups Projects
Commit 14d4978b authored by Shahaan Ayyub's avatar Shahaan Ayyub
Browse files

Added list feature to NFS, added a Zero sized certificate check.

parent 8bf30d68
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@
- easy-rsa-certificate
- OpenVPN-Client
- nfs-common
- syncExports
- { role: syncExports, group_list:['openvpn-clients'], interface_list: ['eth0','tun0'] }
- nfs-client
sudo: true
vars:
......
......@@ -27,7 +27,13 @@
- name: "set needcert if cert is missing"
set_fact: needcert=True
when: cert.stat.exists == false
when: cert.stat.exists == false and cert.stat.size == 0
- name: "Delete Zero Sized Ceritificates"
remote_user: "{{ hostvars[x509_ca_server]['ansible_ssh_user'] }}"
delegate_to: "{{ x509_ca_server }}"
shell: rm -rf /etc/easy-rsa/2.0/keys/{{ x509_common_name }}.*
when: cert.stat.size == 0
- name: "set needcert if cert doesn't match key"
set_fact: needcert=True
......
---
nfs_server: "nfsserver.edu"
nfs_type: "nfs"
nfs_options: "vers=3,noatime,rsize=16384,wsize=16384,hard,intr,tcp,nolock"
......@@ -6,13 +6,9 @@
run_once: true
delegate_to: "{{ nfs_server }}"
-
mount: "name={{ item.0 }} src={{ nfsServer['ansible_facts']['ansible_tun0']['ipv4']['address'] }}:{{ item.1 }} fstype={{ nfs_type }} opts={{ nfs_options }} state=mounted"
mount: "name={{ item.name }} src={{ nfsServer['ansible_facts']['ansible_tun0']['ipv4']['address'] }}:{{ item.src }} fstype={{ item.fstype }} opts={{ item.opts }} state=mounted"
name: "Mounting NFS mounts"
with_together:
- destDir
- srcDir
with_items: exportList
notify: "restart authentication"
notify: "restart idmap"
sudo: true
---
srcDir: ['/mnt']
destDir: ['/mnt/test-nfs']
# This is a list of exports, individual entry for each mount.
exportList:
- { name : '/mnt/test-nfs', src : '/mnt',fstype : 'nfs', opts : 'vers=3,noatime,rsize=16384,wsize=16384,hard,intr,tcp,nolock' }
......@@ -4,3 +4,8 @@
template: src=exports.j2 dest=/etc/exports owner=root group=root mode=644
delegate_to: "{{ nfs_server }}"
run_once: true
-
name : Restart the NFS Server
service: name=nfs state=restarted
delegate_to: "{{ nfs_server }}"
run_once: true
{% for src in srcDir %}
{{ src }} {% for node in groups['openvpn-clients'] %}{% for ip in hostvars[node]['ansible_all_ipv4_addresses'] %}{{ ip }}(rw,sync,root_squash) {% endfor %}{% endfor %}
{% for export in exportList %}
{{ export.src }} {% for group_name in group_list %}{% for node in groups[group_name] %}{% for interface_name in interface_list %}{{ hostvars[node]['ansible_'+interface_name]['ipv4']['address'] }}(rw,sync,root_squash) {% endfor %}{% endfor %}{% endfor %}
{% endfor %}
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