From 97a8f95c750314087a2358059037f01b04da785a Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Tue, 16 Jun 2015 11:48:22 -0500 Subject: Create openshift_storage_nfs_lvm based off kube_nfs_volumes initial import of openshift_storage_nfs from kube_nfs_volumes reduce total size so we do not go over Postpone making the mounts owned by nfsnobody rename openshift_storage_nfs storage_nfs_pvs Update README to latest settings have json files go to /root/ change categories from cloud to openshift, cuz this can run on bare metal storgae_nfs_lvm initial commit fixing default getting it working check these in, just cuz for lvm we do not need the library Update README to match reality adding recycle make volume_group a variable make volume_group a variable fix typo default should be /exports/openshift set owner and permissions of mount point update examples cleanup cruft fixup documentation fixup documentation rename storage_nfs_lvm to openshift_storage_nfs_lvm rename storage_nfs_lvm to openshift_storage_nfs_lvm use openshiftvg, not openshift3vg use ansible file: to set owner and permissions of mount dir change nfs_export_options to osnl_nfs_export_options change mount_dir to osnl_mount_dir change volume_group to osnl_volume_group change volume_prefix to osnl_volume_prefix change volume_size to osnl_volume_size change volume_num_start to osnl_volume_num_start change number_of_volumes to osnl_number_of_volumes replace volume_size with osnl_volume_size --- roles/openshift_storage_nfs_lvm/tasks/main.yml | 24 ++++++++++++++++++++++++ roles/openshift_storage_nfs_lvm/tasks/nfs.yml | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 roles/openshift_storage_nfs_lvm/tasks/main.yml create mode 100644 roles/openshift_storage_nfs_lvm/tasks/nfs.yml (limited to 'roles/openshift_storage_nfs_lvm/tasks') 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..e9f5814bb --- /dev/null +++ b/roles/openshift_storage_nfs_lvm/tasks/main.yml @@ -0,0 +1,24 @@ +--- +- 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 an openshift-master, and load them. \ No newline at end of file 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..65ae069df --- /dev/null +++ b/roles/openshift_storage_nfs_lvm/tasks/nfs.yml @@ -0,0 +1,16 @@ +--- +- name: Install NFS server + yum: name=nfs-utils state=present + +- name: Start rpcbind + service: name=rpcbind state=started enabled=yes + +- name: Start nfs + service: 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 -- cgit v1.2.3