summaryrefslogtreecommitdiffstats
path: root/roles/openshift_storage_nfs_lvm/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_storage_nfs_lvm/tasks')
-rw-r--r--roles/openshift_storage_nfs_lvm/tasks/main.yml29
-rw-r--r--roles/openshift_storage_nfs_lvm/tasks/nfs.yml26
2 files changed, 55 insertions, 0 deletions
diff --git a/roles/openshift_storage_nfs_lvm/tasks/main.yml b/roles/openshift_storage_nfs_lvm/tasks/main.yml
new file mode 100644
index 000000000..49dd657b5
--- /dev/null
+++ b/roles/openshift_storage_nfs_lvm/tasks/main.yml
@@ -0,0 +1,29 @@
+---
+# TODO -- this may actually work on atomic hosts
+- fail:
+ msg: "openshift_storage_nfs_lvm is not compatible with atomic host"
+ when: openshift.common.is_atomic | bool
+
+- name: Create lvm volumes
+ lvol: vg={{osnl_volume_group}} lv={{ item }} size={{osnl_volume_size}}G
+ with_sequence: start={{osnl_volume_num_start}} count={{osnl_number_of_volumes}} format={{osnl_volume_prefix}}{{osnl_volume_size}}g%04d
+
+- name: create filesystem
+ filesystem: fstype=xfs dev=/dev/{{osnl_volume_group}}/{{ item }}
+ with_sequence: start={{osnl_volume_num_start}} count={{osnl_number_of_volumes}} format={{osnl_volume_prefix}}{{osnl_volume_size}}g%04d
+
+- name: mount volumes
+ mount: name={{osnl_mount_dir}}/{{ item }} src=/dev/{{osnl_volume_group}}/{{ item }} state=mounted fstype=xfs passno=0
+ with_sequence: start={{osnl_volume_num_start}} count={{osnl_number_of_volumes}} format={{osnl_volume_prefix}}{{osnl_volume_size}}g%04d
+
+- name: Make mounts owned by nfsnobody
+ file: path={{osnl_mount_dir}}/{{ item }} owner=nfsnobody group=nfsnobody mode=0700
+ with_sequence: start={{osnl_volume_num_start}} count={{osnl_number_of_volumes}} format={{osnl_volume_prefix}}{{osnl_volume_size}}g%04d
+
+- include: nfs.yml
+
+- name: Create volume json file
+ template: src=../templates/nfs.json.j2 dest=/root/persistent-volume.{{ item }}.json
+ with_sequence: start={{osnl_volume_num_start}} count={{osnl_number_of_volumes}} format={{osnl_volume_prefix}}{{osnl_volume_size}}g%04d
+
+# TODO - Get the json files to a master, and load them.
diff --git a/roles/openshift_storage_nfs_lvm/tasks/nfs.yml b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml
new file mode 100644
index 000000000..03f4fcec0
--- /dev/null
+++ b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml
@@ -0,0 +1,26 @@
+---
+- name: Install NFS server
+ package: name=nfs-utils state=present
+ when: not openshift.common.is_containerized | bool
+
+- name: Start rpcbind
+ systemd:
+ name: rpcbind
+ state: started
+ enabled: yes
+
+- name: Start nfs
+ systemd:
+ name: nfs-server
+ state: started
+ enabled: yes
+
+- name: Export the directories
+ lineinfile: dest=/etc/exports
+ regexp="^{{ osnl_mount_dir }}/{{ item }} "
+ line="{{ osnl_mount_dir }}/{{ item }} {{osnl_nfs_export_options}}"
+ with_sequence:
+ start: "{{osnl_volume_num_start}}"
+ count: "{{osnl_number_of_volumes}}"
+ format: "{{osnl_volume_prefix}}{{osnl_volume_size}}g%04d"
+ notify: restart nfs