Browse Source

Add metrics exports to nfs role, move exports to /etc/exports.d/openshift-ansible.exports

Scott Dodson 8 years ago
parent
commit
7999e06a0e

+ 16 - 1
roles/openshift_storage_nfs/tasks/main.yml

@@ -30,11 +30,26 @@
 
 - name: Configure exports
   template:
-    dest: /etc/exports
+    dest: /etc/exports.d/openshift-ansible.exports
     src: exports.j2
   notify:
   - restart nfs-server
 
+# Now that we're putting our exports in our own file clean up the old ones
+- name: register exports
+  command: cat /etc/exports.d/openshift-ansible.exports
+  register: exports_out
+
+- name: remove exports from /etc/exports
+  lineinfile:
+    dest: /etc/exports
+    line: "{{ item }}"
+    state: absent
+  with_items: "{{ exports_out.stdout_lines | default([]) }}"
+  when: exports_out.rc == 0
+  notify:
+  - restart nfs-server
+
 - name: Enable and start services
   service:
     name: "{{ item }}"

+ 1 - 0
roles/openshift_storage_nfs/templates/exports.j2

@@ -1 +1,2 @@
 {{ openshift.hosted.registry.storage.nfs.directory }}/{{ openshift.hosted.registry.storage.volume.name }} {{ openshift.hosted.registry.storage.nfs.options }}
+{{ openshift.hosted.metrics.storage.nfs.directory }}/{{ openshift.hosted.metrics.storage.volume.name }} {{ openshift.hosted.metrics.storage.nfs.options }}