diff --git a/defaults/main.yml b/defaults/main.yml index 6175699..622c436 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -65,5 +65,8 @@ systemd_default_mount_options: 'defaults' # type: "fuse.s3fs" # options: "url=https://s3-{{aws_region}}.amazonaws.com,_netdev,allow_other,use_path_request_style" # credentials: "ACCESS_KEY_ID:SECRET_ACCESS_KEY" +# - what: gluster-server:gluster-volume-name +# where: /mnt/shared_storage +# type: glusterfs systemd_mounts: [] diff --git a/tasks/systemd_install.yml b/tasks/systemd_install.yml index 6d0f40b..5144d12 100644 --- a/tasks/systemd_install.yml +++ b/tasks/systemd_install.yml @@ -50,3 +50,41 @@ package: name: "{{ systemd_mount_packages }}" state: present + +# NOTE(jrosser) as we call systemd_service from inside a block: with a when: +# parameter, the when: condition must be able to be resolved inside the +# systemd_service role where role vars from systemd_mount are not in scope +- name: Make boolean flag for setting up glusterfs + set_fact: + _configure_glusterfs: "{{ 'glusterfs' in systemd_mount_types }}" + +- name: Configure fuse for glusterfs + when: + - _configure_glusterfs + block: + - name: Configure systemd-tmpfiles to create /dev/fuse at boot + copy: + content: "c /dev/fuse 0600 - - - 10:229" + dest: "/etc/tmpfiles.d/openstack-ansible-systemd_mount-glusterfs-client.conf" + register: _glusterfs_server_tmpfiles + + - name: Apply systemctl overrides + when: ansible_facts['pkg_mgr'] == 'dnf' + include_role: + name: systemd_service + vars: + systemd_services: + - service_name: systemd-tmpfiles-setup-dev + restart_changed: false + load: false + systemd_overrides_only: true + systemd_overrides: + Unit: + ConditionCapability: "" + + - name: Restart systemd-tmpfiles-setup-dev + service: + name: "systemd-tmpfiles-setup-dev" + state: restarted + when: + - _glusterfs_server_tmpfiles is changed \ No newline at end of file diff --git a/vars/debian.yml b/vars/debian.yml index b277855..e2aa73d 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -6,3 +6,6 @@ systemd_ceph_packages: systemd_s3_packages: - s3fs + +systemd_glusterfs_packages: + - glusterfs-client diff --git a/vars/main.yml b/vars/main.yml index 95e8713..360b741 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -34,4 +34,7 @@ systemd_mount_packages: |- {% if 'fuse.s3fs' in mount_types %} {% set _ = packages.extend(systemd_s3_packages) %} {% endif %} + {% if 'glusterfs' in mount_types %} + {% set _ = packages.extend(systemd_glusterfs_packages) %} + {% endif %} {{ packages }} diff --git a/vars/redhat.yml b/vars/redhat.yml index 01aae04..3f12df9 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -6,3 +6,7 @@ systemd_ceph_packages: systemd_s3_packages: - s3fs-fuse + +systemd_glusterfs_packages: + - glusterfs + - glusterfs-fuse