From 96ced00e05b50f276841a9212ae89e018de4d92d Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 16 Feb 2018 20:54:52 +0100 Subject: Updated to OpenShift 3.7 and tested --- roles/glusterfs/files/gluster-link.service | 8 ++++++ roles/glusterfs/tasks/common.yml | 2 -- roles/glusterfs/tasks/create_domain.yml | 2 +- roles/glusterfs/tasks/create_volume.yml | 2 +- roles/glusterfs/tasks/main.yml | 27 ++++++++++++++++++--- roles/glusterfs/tasks/mount_domain.yml | 2 +- roles/glusterfs/tasks/server.yml | 31 ------------------------ roles/glusterfs/tasks/setup-client.yml | 0 roles/glusterfs/tasks/setup-external-server.yml | 28 +++++++++++++++++++++ roles/glusterfs/tasks/setup-openshift-server.yml | 9 +++++++ roles/glusterfs/tasks/volumes.yml | 4 +-- 11 files changed, 74 insertions(+), 41 deletions(-) create mode 100644 roles/glusterfs/files/gluster-link.service delete mode 100644 roles/glusterfs/tasks/server.yml create mode 100644 roles/glusterfs/tasks/setup-client.yml create mode 100644 roles/glusterfs/tasks/setup-external-server.yml create mode 100644 roles/glusterfs/tasks/setup-openshift-server.yml (limited to 'roles/glusterfs') diff --git a/roles/glusterfs/files/gluster-link.service b/roles/glusterfs/files/gluster-link.service new file mode 100644 index 0000000..ddcea10 --- /dev/null +++ b/roles/glusterfs/files/gluster-link.service @@ -0,0 +1,8 @@ +[Unit] +After=origin-node.service + +[Service] +ExecStart=/usr/bin/ln -sf /run/glusterd/glusterd.socket /run/glusterd.socket + +[Install] +WantedBy=multi-user.target diff --git a/roles/glusterfs/tasks/common.yml b/roles/glusterfs/tasks/common.yml index 7675cb9..5e8e3b6 100644 --- a/roles/glusterfs/tasks/common.yml +++ b/roles/glusterfs/tasks/common.yml @@ -7,9 +7,7 @@ with_items: - glusterfs-cli - glusterfs-fuse - - glusterfs-libs - glusterfs-rdma - - glusterfs - libsemanage-python - name: Allow fuse in SELinux configuration diff --git a/roles/glusterfs/tasks/create_domain.yml b/roles/glusterfs/tasks/create_domain.yml index b3fc89e..8f8042b 100644 --- a/roles/glusterfs/tasks/create_domain.yml +++ b/roles/glusterfs/tasks/create_domain.yml @@ -1,6 +1,6 @@ --- - name: Configure volumes - include: create_volume.yml + include_tasks: create_volume.yml with_dict: "{{ domain.volumes }}" vars: domain_servers: "{{ groups[domain.servers] | map('extract', hostvars, 'ands_storage_hostname') | list }}" diff --git a/roles/glusterfs/tasks/create_volume.yml b/roles/glusterfs/tasks/create_volume.yml index 9b955b0..ca4f39a 100644 --- a/roles/glusterfs/tasks/create_volume.yml +++ b/roles/glusterfs/tasks/create_volume.yml @@ -1,4 +1,4 @@ --- -- include: "{{ volume.value.type }}/vols{{((domain_servers | length) < 4) | ternary((domain_servers | length), 3) }}.yml" +- include_tasks: "{{ volume.value.type }}/vols{{((domain_servers | length) < 4) | ternary((domain_servers | length), 3) }}.yml" vars: name: "{{ volume.key }}" diff --git a/roles/glusterfs/tasks/main.yml b/roles/glusterfs/tasks/main.yml index dbd1aad..d7ee766 100644 --- a/roles/glusterfs/tasks/main.yml +++ b/roles/glusterfs/tasks/main.yml @@ -1,13 +1,34 @@ --- -- include: common.yml +- name: Install GlusterFS Common Software + include_tasks: common.yml when: - "'software' in glusterfs_subroles" -- include: server.yml +- name: Install GlusterFS client + include_tasks: setup-client.yml + when: + - "'software' in glusterfs_subroles" + - "'ands_storage_servers' not in group_names" + +- name: Install GlusterFS OpenShift Server + include_tasks: setup-openshift-server.yml + when: + - "'software' in glusterfs_subroles" + - "'ands_storage_servers' in group_names" + - "'glusterfs' in group_names" + +- name: Install GlusterFS External Server + include_tasks: setup-external-server.yml when: - "'software' in glusterfs_subroles" - "'ands_storage_servers' in group_names" + - "'glusterfs' not in group_names" + +- name: Configure gluster peers (on first host) + shell: gluster peer probe {{item}} + run_once: true + with_items: "{{ glusterfs_servers }}" -- include: volumes.yml +- include_tasks: volumes.yml when: - "'volumes' in glusterfs_subroles" diff --git a/roles/glusterfs/tasks/mount_domain.yml b/roles/glusterfs/tasks/mount_domain.yml index 94b6677..355ed29 100644 --- a/roles/glusterfs/tasks/mount_domain.yml +++ b/roles/glusterfs/tasks/mount_domain.yml @@ -1,6 +1,6 @@ --- - name: Mount volumes - include: mount_volume.yml + include_tasks: mount_volume.yml with_dict: "{{ domain.volumes }}" vars: name: "{{ volume.key }}" diff --git a/roles/glusterfs/tasks/server.yml b/roles/glusterfs/tasks/server.yml deleted file mode 100644 index 328a8c5..0000000 --- a/roles/glusterfs/tasks/server.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- name: Ensure GlusterFS is installed - yum: name={{item}} state=present - with_items: - - glusterfs-server - - glusterfs-rdma - -- name: Ensure GlusterFS service is running - service: name=glusterd state=started enabled=yes - -- name: Ensure firewalld is running - service: name=firewalld state=started enabled=yes - -- name: Configure firewalld - firewalld: rich_rule="rule family=ipv4 source address={{glusterfs_network}} service name=glusterfs accept" state="enabled" permanent="true" immediate="true" - when: glusterfs_network is defined - -- name: Configure firewalld - firewalld: service="glusterfs" state="enabled" permanent="true" immediate="true" - when: not glusterfs_network is defined - -- name: Reload firewalld rules - shell: firewall-cmd --reload - -- name: Create folder for GlusterFS bricks - file: dest="{{glusterfs_bricks_path}}" owner="root" group="root" mode="0755" state="directory" - -- name: Configure gluster peers (on first host) - shell: gluster peer probe {{item}} - run_once: true - with_items: "{{ glusterfs_servers }}" diff --git a/roles/glusterfs/tasks/setup-client.yml b/roles/glusterfs/tasks/setup-client.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/glusterfs/tasks/setup-external-server.yml b/roles/glusterfs/tasks/setup-external-server.yml new file mode 100644 index 0000000..cc0b2f1 --- /dev/null +++ b/roles/glusterfs/tasks/setup-external-server.yml @@ -0,0 +1,28 @@ +--- +- name: Ensure GlusterFS is installed + yum: name={{item}} state=present + with_items: + - glusterfs-server + - glusterfs-rdma + - glusterfs + +- name: Ensure GlusterFS service is running + service: name=glusterd state=started enabled=yes + +- name: Ensure firewalld is running + service: name=firewalld state=started enabled=yes + +- name: Configure firewalld + firewalld: rich_rule="rule family=ipv4 source address={{glusterfs_network}} service name=glusterfs accept" state="enabled" permanent="true" immediate="true" + when: glusterfs_network is defined + +- name: Configure firewalld + firewalld: service="glusterfs" state="enabled" permanent="true" immediate="true" + when: not glusterfs_network is defined + +- name: Reload firewalld rules + shell: firewall-cmd --reload + +- name: Create folder for GlusterFS bricks + file: dest="{{glusterfs_bricks_path}}" owner="root" group="root" mode="0755" state="directory" + diff --git a/roles/glusterfs/tasks/setup-openshift-server.yml b/roles/glusterfs/tasks/setup-openshift-server.yml new file mode 100644 index 0000000..20ebbf8 --- /dev/null +++ b/roles/glusterfs/tasks/setup-openshift-server.yml @@ -0,0 +1,9 @@ +--- +- name: Link control socket + file: src="/run/glusterd/glusterd.socket" dest="/run/glusterd.socket" state="link" + +- name: Copy systemd unit to recreate link on re-start + copy: src="gluster-link.service" dest="/etc/systemd/system/gluster-link.service" owner="root" group="root" mode="0644" + +- name: Enable systemd unit + systemd: enabled=true name=gluster-link daemon_reload=yes \ No newline at end of file diff --git a/roles/glusterfs/tasks/volumes.yml b/roles/glusterfs/tasks/volumes.yml index e393c08..c4d49ac 100644 --- a/roles/glusterfs/tasks/volumes.yml +++ b/roles/glusterfs/tasks/volumes.yml @@ -1,5 +1,5 @@ - name: Configure volume domains - include: create_domain.yml + include_tasks: create_domain.yml run_once: true delegate_to: "{{ groups[domain.servers][0] }}" with_items: "{{ glusterfs_domains }}" @@ -7,7 +7,7 @@ loop_var: domain - name: Mount volume domains - include: mount_domain.yml + include_tasks: mount_domain.yml when: ( domain.clients | default("---") ) in group_names with_items: "{{ glusterfs_domains }}" loop_control: -- cgit v1.2.3