From 8e23ee78bbd05425905b33063bb83f80dbec4d06 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 29 Sep 2020 14:27:35 +0300 Subject: [PATCH] Install required packages for NFS/CephFS mounts Currently it's deployer resposibility to install required binaries for mounts to succeed, which is not really convenient. Instead of this we can try to provide at least some basic binaries installation in case supported type is set. Depends-On: https://review.opendev.org/755484 Change-Id: I680359ca655d0f69a40e9d29dbf1694cd0aa4ca2 --- tasks/main.yml | 17 +++++++++++++++++ vars/debian.yml | 5 +++++ vars/main.yml | 11 +++++++++++ vars/redhat.yml | 5 +++++ 4 files changed, 38 insertions(+) create mode 100644 vars/debian.yml create mode 100644 vars/redhat.yml diff --git a/tasks/main.yml b/tasks/main.yml index 0de2205..2ea358a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,5 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Gather variables for each operating system + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ ansible_distribution | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml" + - "{{ ansible_os_family | lower }}.yml" + tags: + - always + +- name: Install required distro packages for mounts + package: + name: "{{ systemd_mount_packages }}" + state: present + - include_tasks: systemd_mounts.yml with_items: "{{ systemd_mounts }}" diff --git a/vars/debian.yml b/vars/debian.yml new file mode 100644 index 0000000..9d4f164 --- /dev/null +++ b/vars/debian.yml @@ -0,0 +1,5 @@ +systemd_nfs_packages: + - nfs-common + +systemd_ceph_packages: + - ceph-fuse diff --git a/vars/main.yml b/vars/main.yml index f36ae87..f587f93 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -19,3 +19,14 @@ systemd_mount_states: started: reload-or-restart stopped: stopped absent: stopped + +systemd_mount_packages: |- + {% set packages = [] %} + {% set mount_types = systemd_mounts | map(attribute='type') | list %} + {% if 'nfs' in mount_types %} + {% set _ = packages.extend(systemd_nfs_packages) %} + {% endif %} + {% if 'ceph' in mount_types %} + {% set _ = packages.extend(systemd_ceph_packages) %} + {% endif %} + {{ packages }} diff --git a/vars/redhat.yml b/vars/redhat.yml new file mode 100644 index 0000000..a2ae174 --- /dev/null +++ b/vars/redhat.yml @@ -0,0 +1,5 @@ +systemd_nfs_packages: + - nfs-utils + +systemd_ceph_packages: + - ceph-fuse