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
This commit is contained in:
Dmitriy Rabotyagov 2020-09-29 14:27:35 +03:00
parent c703def315
commit 8e23ee78bb
4 changed files with 38 additions and 0 deletions

View File

@ -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 }}"

5
vars/debian.yml Normal file
View File

@ -0,0 +1,5 @@
systemd_nfs_packages:
- nfs-common
systemd_ceph_packages:
- ceph-fuse

View File

@ -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 }}

5
vars/redhat.yml Normal file
View File

@ -0,0 +1,5 @@
systemd_nfs_packages:
- nfs-utils
systemd_ceph_packages:
- ceph-fuse