summaryrefslogtreecommitdiffstats
path: root/roles/kube_nfs_volumes/tasks/main.yml
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2015-05-20 11:40:35 +0200
committerJan Safranek <jsafrane@redhat.com>2015-05-20 11:40:35 +0200
commit98acbb6d24921ded065fca3b57943ef1ae7fb15f (patch)
tree17571cd1d1ef49cc81b9dcd8f1684ff65c30e37f /roles/kube_nfs_volumes/tasks/main.yml
parent8dedb32348549d8aa279201cfb89c50d5dc83ba5 (diff)
downloadopenshift-98acbb6d24921ded065fca3b57943ef1ae7fb15f.tar.gz
openshift-98acbb6d24921ded065fca3b57943ef1ae7fb15f.tar.bz2
openshift-98acbb6d24921ded065fca3b57943ef1ae7fb15f.tar.xz
openshift-98acbb6d24921ded065fca3b57943ef1ae7fb15f.zip
Add nfs-volumes role.
This role is useful to use (physical) disks as persistent volumes in Kubernetes. It partitions the disks, exports the partitions as NFS shares and registers the shares as physical volumes at remote Kubernetes installation.
Diffstat (limited to 'roles/kube_nfs_volumes/tasks/main.yml')
-rw-r--r--roles/kube_nfs_volumes/tasks/main.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/kube_nfs_volumes/tasks/main.yml b/roles/kube_nfs_volumes/tasks/main.yml
new file mode 100644
index 000000000..23b228d32
--- /dev/null
+++ b/roles/kube_nfs_volumes/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+- name: Install pyparted (RedHat/Fedora)
+ yum: name=pyparted,python-httplib2 state=installed
+
+- name: partition the drives
+ partitionpool: disks={{ disks }} force={{ force }} sizes={{ sizes }}
+
+- name: create filesystem
+ filesystem: fstype=ext4 dev=/dev/{{ item.name }}
+ with_items: partition_pool
+
+- name: mount
+ mount: name={{mount_dir}}/{{ item.name }} src=/dev/{{ item.name }} state=mounted fstype=ext4 passno=2
+ with_items: partition_pool
+
+- include: nfs.yml
+
+- name: export physical volumes
+ uri: url={{ kubernetes_url }}/api/v1beta3/persistentvolumes
+ method=POST
+ body='{{ lookup("template", "../templates/nfs.json.j2") }}'
+ body_format=json
+ status_code=201
+ HEADER_Authorization="Bearer {{ kubernetes_token }}"
+ with_items: partition_pool