Skip to content

Commit

Permalink
Create vars files
Browse files Browse the repository at this point in the history
This enables us to install different versions of aws/efs-utils with
different prerequisites depending on the platform.

Also move the installation of prerequisites to install_common.yml.
jsf9k committed Apr 16, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
jsf9k Shane Frasier
1 parent 726b7ab commit 6b8c13b
Showing 10 changed files with 53 additions and 20 deletions.
10 changes: 7 additions & 3 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
@@ -15,10 +15,14 @@
def test_packages(host):
"""Test that the appropriate packages were installed."""
distribution = host.system_info.distribution
codename = host.system_info.codename
if distribution in ["fedora"]:
pkgs = ["make", "rpm-build", "amazon-efs-utils"]
elif distribution in ["debian", "ubuntu", "kali"]:
pkgs = ["make", "binutils", "amazon-efs-utils"]
pkgs = ["amazon-efs-utils", "cargo", "make", "openssl-devel", "rpm-build"]
elif distribution in ["debian", "kali", "ubuntu"]:
if codename in ["buster", "bullseye", "bookworm"]:
pkgs = ["amazon-efs-utils", "binutils", "make"]
else:
pkgs = ["amazon-efs-utils", "binutils", "cargo", "make", "pkgconf"]
elif distribution in ["amzn"]:
pkgs = ["amazon-efs-utils"]
else:
8 changes: 0 additions & 8 deletions tasks/install_Debian.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
- name: Install amazon-efs-utils prerequisites
ansible.builtin.package:
name:
- binutils
- cargo
- make
- pkgconf

- name: Load tasks file with common install tasks
ansible.builtin.include_tasks: install_common.yml

8 changes: 0 additions & 8 deletions tasks/install_RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
- name: Install amazon-efs-utils prerequisites
ansible.builtin.package:
name:
- cargo
- make
- openssl-devel
- rpm-build

- name: Load tasks file with common install tasks
ansible.builtin.include_tasks: install_common.yml

6 changes: 5 additions & 1 deletion tasks/install_common.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Install amazon-efs-utils prerequisites
ansible.builtin.package:
name: "{{ package_names }}"

- name: Create the /tmp/efs-utils directory
ansible.builtin.file:
mode: 0755
@@ -7,7 +11,7 @@

- name: Download a tarball of the aws/efs-utils repository
ansible.builtin.unarchive:
src: https://github.com/aws/efs-utils/tarball/master
src: https://github.com/aws/efs-utils/archive/refs/tags/v{{ version }}.tar.gz
dest: /tmp/efs-utils
remote_src: true
extra_opts:
11 changes: 11 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
- name: Load vars file with values based on the OS type
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
paths:
- "{{ role_path }}/vars"

- name: Load tasks file with install tasks based on the OS type
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
10 changes: 10 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# The system packages to install.
package_names:
- binutils
- cargo
- make
- pkgconf

# The version of amazon-efs-utils to install.
version: 2.0.0
8 changes: 8 additions & 0 deletions vars/Debian_bookworm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# The system packages to install.
package_names:
- binutils
- make

# The version of amazon-efs-utils to install.
version: 1.36.0
1 change: 1 addition & 0 deletions vars/Debian_bullseye.yml
1 change: 1 addition & 0 deletions vars/Debian_buster.yml
10 changes: 10 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# The system packages to install.
package_names:
- cargo
- make
- openssl-devel
- rpm-build

# The version of amazon-efs-utils to install.
version: 2.0.0

0 comments on commit 6b8c13b

Please sign in to comment.