From 51ff83de30db6934e243226ce05c6394b8986a12 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 6 Feb 2019 14:53:10 +1100 Subject: Add Ansible playbook for node configuration This will replace all of the existing node provisioning/configuration. CentOS 7 nodes are currently supported. Signed-off-by: Martin Schwenke --- .../storage/tasks/generic/clusterfs-gpfs-once.yml | 135 +++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 ansible/node/roles/storage/tasks/generic/clusterfs-gpfs-once.yml (limited to 'ansible/node/roles/storage/tasks/generic/clusterfs-gpfs-once.yml') diff --git a/ansible/node/roles/storage/tasks/generic/clusterfs-gpfs-once.yml b/ansible/node/roles/storage/tasks/generic/clusterfs-gpfs-once.yml new file mode 100644 index 0000000..5ed26eb --- /dev/null +++ b/ansible/node/roles/storage/tasks/generic/clusterfs-gpfs-once.yml @@ -0,0 +1,135 @@ +--- +- name: generate GPFS nodes file + template: + src: gpfs_nodes.j2 + dest: /root/.autocluster/gpfs_nodes + +- name: generate file containing GPFS primary and secondary nodes + template: + src: gpfs_primary_secondary.j2 + dest: /root/.autocluster/gpfs_primary_secondary + +- name: check if GPFS active flag file exists + stat: + path: /root/.autocluster/gpfs_active + register: gpfs_active + +- name: create GPFS cluster + shell: | + mmlscluster || { + read primary secondary 1 && $9 != "active" { exit(1) }' + register: result + until: result.rc == 0 + retries: 12 + delay: 5 + when: not gpfs_active.stat.exists + +- name: flag GPFS as active + file: + path: /root/.autocluster/gpfs_active + state: touch + +- name: generate NSD file + shell: > + ls /dev/disk/by-id/virtio-AUTO-* | + xargs -n 1 realpath | + awk '{printf "%nsd:\n device=%s\n usage=dataAndMetadata\n failureGroup=1\n\n", $1}' | + tee gpfs_nsds + args: + chdir: /root/.autocluster/ + creates: gpfs_nsds + +- name: check if GPFS NSDs created file exists + stat: + path: /root/.autocluster/gpfs_nsds_created + register: gpfs_nsds_created + +- name: create GPFS NSDs + command: mmcrnsd -F gpfs_nsds + args: + chdir: /root/.autocluster/ + when: not gpfs_nsds_created.stat.exists + +- name: flag GPFS NSDs as created + file: + path: /root/.autocluster/gpfs_nsds_created + state: touch + +- name: check if GPFS filesystem created file exists + stat: + path: /root/.autocluster/gpfs_fs_created + register: gpfs_fs_created + +- name: create GPFS filesystem + command: > + mmcrfs gpfs0 -F gpfs_nsds + -A yes -Q yes -D nfs4 -B 64k -k nfs4 -n 32 -E yes -S no + -T {{ clusterfs.mountpoint}} -i 512 + args: + chdir: /root/.autocluster/ + when: not gpfs_fs_created.stat.exists + +- name: flag GPFS filesystem as created + file: + path: /root/.autocluster/gpfs_fs_created + state: touch + +- name: check if GPFS filesystem mounted file exists + stat: + path: /root/.autocluster/gpfs_fs_mounted + register: gpfs_fs_mounted + +- name: mount GPFS filesystem + command: mmmount gpfs0 -a + when: not gpfs_fs_mounted.stat.exists + +- name: wait until GPFS filesystem is mounted + command: findmnt {{ clusterfs.mountpoint }} + register: result + until: result.rc == 0 + retries: 12 + delay: 5 + when: not gpfs_fs_mounted.stat.exists + +- name: flag GPFS filesystem as mounted + file: + path: /root/.autocluster/gpfs_fs_mounted + state: touch -- cgit