summaryrefslogtreecommitdiffstats
path: root/roles/openshift_prometheus/tasks/nfs.yaml
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-09-06 10:32:39 -0400
committerGitHub <noreply@github.com>2017-09-06 10:32:39 -0400
commitbb59f5617bce05d61f594efe6e602d307bc6f200 (patch)
tree9b31d02dc5a8d8986e08901d6ea4ffd5ef07ca98 /roles/openshift_prometheus/tasks/nfs.yaml
parent5aaa24b25653cca479955eb39d353caee0fcf373 (diff)
parentec75d0ac888f3fab87f8d335224596df045e260a (diff)
downloadopenshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.gz
openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.bz2
openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.xz
openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.zip
Merge pull request #4509 from zgalor/prometheus-role
Create ansible role for deploying prometheus on openshift
Diffstat (limited to 'roles/openshift_prometheus/tasks/nfs.yaml')
-rw-r--r--roles/openshift_prometheus/tasks/nfs.yaml44
1 files changed, 44 insertions, 0 deletions
diff --git a/roles/openshift_prometheus/tasks/nfs.yaml b/roles/openshift_prometheus/tasks/nfs.yaml
new file mode 100644
index 000000000..0b45f2cee
--- /dev/null
+++ b/roles/openshift_prometheus/tasks/nfs.yaml
@@ -0,0 +1,44 @@
+---
+# Tasks to statically provision NFS volumes
+# Include if not using dynamic volume provisioning
+- name: Ensure the /exports/ directory exists
+ file:
+ path: /exports/
+ state: directory
+ mode: 0755
+ owner: root
+ group: root
+
+- name: Ensure the prom-pv0X export directories exist
+ file:
+ path: "/exports/{{ item }}"
+ state: directory
+ mode: 0777
+ owner: nfsnobody
+ group: nfsnobody
+ with_items: "{{ openshift_prometheus_pv_exports }}"
+
+- name: Ensure the NFS exports for Prometheus PVs exist
+ copy:
+ src: openshift_prometheus.exports
+ dest: /etc/exports.d/openshift_prometheus.exports
+ register: nfs_exports_updated
+
+- name: Ensure the NFS export table is refreshed if exports were added
+ command: exportfs -ar
+ when:
+ - nfs_exports_updated.changed
+
+
+######################################################################
+# Create the required Prometheus PVs. Check out these online docs if you
+# need a refresher on includes looping with items:
+# * http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes-in-2-0
+# * http://stackoverflow.com/a/35128533
+#
+# TODO: Handle the case where a PV template is updated in
+# openshift-ansible and the change needs to be landed on the managed
+# cluster.
+
+- include: create_pvs.yaml
+ with_items: "{{ openshift_prometheus_pv_data }}"