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