diff --git a/README.md b/README.md index 94ca654..be1a9ce 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,8 @@ Ceph variables: * `os_manila_mount_ceph_release_repo`: Optional. URL for Ceph release repo. * `os_manila_mount_ceph_conf_path`: Optional. Path for Ceph configuration directory, default `/etc/ceph`. +* `os_manila_mount_fuse`: Use a FUSE driver for the filesystem, if appropriate. +Default is `False`. Example Playbook diff --git a/defaults/main.yml b/defaults/main.yml index 42a629c..f2c52ca 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -48,3 +48,6 @@ os_manila_mount_ceph_rpm_repos: baseurl: "http://download.ceph.com/rpm-{{ os_manila_mount_ceph_version }}/el{{ ansible_distribution_major_version }}/SRPMS" enabled: true gpgcheck: true + +# Default to kernel FS driver over FUSE-mounting +os_manila_mount_fuse: false diff --git a/tasks/install.yml b/tasks/install.yml index 142e9d6..2d92a69 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -31,6 +31,12 @@ - name: Install Ceph packages (dnf) dnf: name: "ceph-common-{{ os_manila_mount_ceph_version }}" + + - name: Install ceph-fuse (dnf) + dnf: + name: "ceph-fuse" + when: os_manila_mount_fuse | bool + when: ansible_distribution == 'Rocky' - block: @@ -47,4 +53,9 @@ name: "ceph-common" update_cache: true + - name: Install ceph-fuse (apt) + ansible.builtin.apt: + name: "ceph-fuse" + when: os_manila_mount_fuse | bool + when: ansible_distribution == 'Ubuntu' diff --git a/tasks/mount.yml b/tasks/mount.yml index cb82175..a3e217c 100644 --- a/tasks/mount.yml +++ b/tasks/mount.yml @@ -52,6 +52,23 @@ loop: "{{ os_manila_mount_shares | zip(os_manila_mount_share_info) }}" loop_control: label: "{{ item[0].share_name }}" + when: not os_manila_mount_fuse | bool + +- name: FUSE-mount the Ceph share + ansible.posix.mount: + path: "{{ item[0].mount_path }}" + src: "none" + fstype: fuse.ceph + opts: "ceph.id={{ item[1].share_user }},\ + ceph.conf={{ os_manila_mount_ceph_conf_path }}/ceph.conf,\ + ceph.keyring={{ os_manila_mount_ceph_conf_path }}/ceph.client.{{ item[1].share_user }}.keyring,\ + ceph.client-mountpoint={{ item[1].export }}" + # NB share_user is looked up here in case of autodetection + state: "{{ item[0].mount_state | default(os_manila_mount_state) }}" + loop: "{{ os_manila_mount_shares | zip(os_manila_mount_share_info) }}" + loop_control: + label: "{{ item[0].share_name }}" + when: os_manila_mount_fuse | bool - name: Ensure mounted directory has correct permissions ansible.builtin.file: