From 496529cf4bdee0633bca388df1b1cdaa99466f0b Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 18 Oct 2023 16:22:28 -0600 Subject: [PATCH] feat: support for ostree systems Feature: Allow running and testing the role with ostree managed nodes. Reason: We have users who want to use the role to manage ostree systems. Result: Users can use the role to manage ostree managed nodes. Signed-off-by: Rich Megginson --- .ostree/README.md | 3 + .ostree/get_ostree_data.sh | 113 ++++++++++++++++++++++++++ .ostree/packages-runtime-CentOS-7.txt | 2 + .ostree/packages-runtime-CentOS-8.txt | 3 + .ostree/packages-runtime-CentOS-9.txt | 3 + .ostree/packages-runtime-Fedora.txt | 1 + .ostree/packages-runtime-RedHat-7.txt | 2 + .ostree/packages-runtime-RedHat-8.txt | 3 + .ostree/packages-runtime-RedHat-9.txt | 3 + .ostree/packages-runtime.txt | 10 +++ .ostree/packages-testing-CentOS-7.txt | 2 + .ostree/packages-testing-CentOS-8.txt | 1 + .ostree/packages-testing-CentOS-9.txt | 1 + .ostree/packages-testing-Fedora.txt | 2 + .ostree/packages-testing-RedHat-7.txt | 2 + .ostree/packages-testing-RedHat-8.txt | 1 + .ostree/packages-testing-RedHat-9.txt | 1 + .ostree/packages-testing.txt | 2 + .sanity-ansible-ignore-2.10.txt | 1 + .sanity-ansible-ignore-2.11.txt | 1 + .sanity-ansible-ignore-2.12.txt | 1 + .sanity-ansible-ignore-2.13.txt | 1 + .sanity-ansible-ignore-2.14.txt | 1 + .sanity-ansible-ignore-2.15.txt | 1 + .sanity-ansible-ignore-2.9.txt | 1 + README-ostree.md | 66 +++++++++++++++ README.md | 11 +-- meta/collection-requirements.yml | 1 + tasks/main-blivet.yml | 9 +- tasks/set_vars.yml | 18 ++++ tests/get_unused_disk.yml | 12 +++ tests/test-verify-volume-mount.yml | 12 ++- 32 files changed, 282 insertions(+), 9 deletions(-) create mode 100644 .ostree/README.md create mode 100755 .ostree/get_ostree_data.sh create mode 100644 .ostree/packages-runtime-CentOS-7.txt create mode 100644 .ostree/packages-runtime-CentOS-8.txt create mode 100644 .ostree/packages-runtime-CentOS-9.txt create mode 100644 .ostree/packages-runtime-Fedora.txt create mode 100644 .ostree/packages-runtime-RedHat-7.txt create mode 100644 .ostree/packages-runtime-RedHat-8.txt create mode 100644 .ostree/packages-runtime-RedHat-9.txt create mode 100644 .ostree/packages-runtime.txt create mode 100644 .ostree/packages-testing-CentOS-7.txt create mode 100644 .ostree/packages-testing-CentOS-8.txt create mode 100644 .ostree/packages-testing-CentOS-9.txt create mode 100644 .ostree/packages-testing-Fedora.txt create mode 100644 .ostree/packages-testing-RedHat-7.txt create mode 100644 .ostree/packages-testing-RedHat-8.txt create mode 100644 .ostree/packages-testing-RedHat-9.txt create mode 100644 .ostree/packages-testing.txt create mode 100644 README-ostree.md diff --git a/.ostree/README.md b/.ostree/README.md new file mode 100644 index 00000000..f5e6931b --- /dev/null +++ b/.ostree/README.md @@ -0,0 +1,3 @@ +*NOTE*: The `*.txt` files are used by `get_ostree_data.sh` to create the lists +of packages, and to find other system roles used by this role. DO NOT use them +directly. diff --git a/.ostree/get_ostree_data.sh b/.ostree/get_ostree_data.sh new file mode 100755 index 00000000..d0a03a3d --- /dev/null +++ b/.ostree/get_ostree_data.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +set -euo pipefail + +role_collection_dir="${ROLE_COLLECTION_DIR:-fedora/linux_system_roles}" +ostree_dir="${OSTREE_DIR:-"$(dirname "$(realpath "$0")")"}" + +if [ -z "${4:-}" ] || [ "${1:-}" = help ] || [ "${1:-}" = -h ]; then + cat <')) + else ['util-linux'] if ansible_facts['os_family'] == 'RedHat' + else ['util-linux'] }}" + - name: Find unused disks in the system find_unused_disk: min_size: "{{ min_size | d(omit) }}" diff --git a/tests/test-verify-volume-mount.yml b/tests/test-verify-volume-mount.yml index 0a2dfe90..33913cd7 100644 --- a/tests/test-verify-volume-mount.yml +++ b/tests/test-verify-volume-mount.yml @@ -19,9 +19,9 @@ selectattr('device', 'match', '^' ~ storage_test_device_path ~ '$') | list }}" storage_test_mount_point_matches: "{{ ansible_mounts | - selectattr('mount', - 'match', '^' ~ storage_test_volume.mount_point ~ '$') | - list }}" + selectattr('mount', 'match', + '^' ~ mount_prefix ~ storage_test_volume.mount_point ~ '$') | + list if storage_test_volume.mount_point else [] }}" storage_test_mount_expected_match_count: "{{ 1 if _storage_test_volume_present and storage_test_volume.mount_point and storage_test_volume.mount_point.startswith('/') @@ -29,6 +29,12 @@ storage_test_swap_expected_matches: "{{ 1 if _storage_test_volume_present and storage_test_volume.fs_type == 'swap' else 0 }}" + vars: + # assumes /opt which is /var/opt in ostree + mount_prefix: "{{ '/var' + if ansible_facts.pkg_mgr == 'ansible.posix.rhel_rpm_ostree' + and storage_test_volume.mount_point + and storage_test_volume.mount_point.startswith('/opt') else '' }}" - name: Get information about the mountpoint directory stat: