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.

NOTE: The .ostree/packages-*.txt are generated by running the
script https://github.com/linux-system-roles/auto-maintenance/blob/main/check-logs-for-packages.sh
which is used with an integration test CI run with the
https://github.com/linux-system-roles/auto-maintenance/blob/main/callback_plugins/dump_packages.py
plugin.  An example of such a CI run is
https://github.com/linux-system-roles/network/pull/647

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
Rich Megginson 2023-04-03 14:58:36 -06:00 committed by Richard Megginson
parent 712f1dfcf4
commit 9a16583783
48 changed files with 464 additions and 93 deletions

View file

@ -25,3 +25,5 @@ exclude_paths:
- examples/roles/
mock_roles:
- linux-system-roles.network
mock_modules:
- ansible.utils.update_fact

8
.github/run_test.sh vendored
View file

@ -155,6 +155,14 @@ podman exec -i "$CONTAINER_ID" \
'cat /dev/zero | ssh-keygen -q -N "";
cp -v /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys'
for req in meta/collection-requirements.yml tests/collection-requirements.yml; do
podman exec -i "$CONTAINER_ID" \
/bin/bash -c \
"if [ -f $TEST_SOURCE_DIR/$req ]; then \
ansible-galaxy collection install -vv -r $TEST_SOURCE_DIR/$req; \
fi"
done
for test_file in $TEST_FILES; do
podman exec -i "$CONTAINER_ID" \
/bin/bash -c \

3
.ostree/README.md Normal file
View file

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

123
.ostree/get_ostree_data.sh Executable file
View file

@ -0,0 +1,123 @@
#!/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 <<EOF
Usage: $0 packages [runtime|testing] DISTRO-MAJOR[.MINOR] [json|yaml|raw|toml]
The script will use the packages and roles files in $ostree_dir to
construct the list of packages needed to build the ostree image. The script
will output the list of packages in the given format
- json is a JSON list like ["pkg1","pkg2",....,"pkgN"]
- yaml is the YAML list format
- raw is the list of packages, one per line
- toml is a list of [[packages]] elements as in https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/composing_installing_and_managing_rhel_for_edge_images/index#creating-an-image-builder-blueprint-for-a-rhel-for-edge-image-using-the-command-line-interface_composing-a-rhel-for-edge-image-using-image-builder-command-line
The DISTRO-MAJOR.MINOR is the same format used by Ansible for distribution e.g. CentOS-8, RedHat-8.9, etc.
EOF
exit 1
fi
category="$1"
pkgtype="$2"
distro_ver="$3"
format="$4"
pkgtypes=("$pkgtype")
if [ "$pkgtype" = testing ]; then
pkgtypes+=(runtime)
fi
get_rolepath() {
local ostree_dir role rolesdir roles_parent_dir
ostree_dir="$1"
role="$2"
roles_parent_dir="$(dirname "$(dirname "$ostree_dir")")"
rolesdir="$roles_parent_dir/$role/.ostree"
# assumes collection format
if [ -d "$rolesdir" ]; then
echo "$rolesdir"
return 0
fi
# assumes legacy role format like linux-system-roles.$role/
for rolesdir in "$roles_parent_dir"/*-system-roles."$role"/.ostree; do
if [ -d "$rolesdir" ]; then
echo "$rolesdir"
return 0
fi
done
# look elsewhere
if [ -n "${ANSIBLE_COLLECTIONS_PATHS:-}" ]; then
for pth in ${ANSIBLE_COLLECTIONS_PATHS//:/ }; do
rolesdir="$pth/ansible_collections/$role_collection_dir/roles/$role/.ostree"
if [ -d "$rolesdir" ]; then
echo "$rolesdir"
return 0
fi
done
fi
return 1
}
get_packages() {
local ostree_dir pkgtype pkgfile rolefile
ostree_dir="$1"
for pkgtype in "${pkgtypes[@]}"; do
for suff in "" "-$distro" "-${distro}-${major_ver}" "-${distro}-${ver}"; do
pkgfile="$ostree_dir/packages-${pkgtype}${suff}.txt"
if [ -f "$pkgfile" ]; then
cat "$pkgfile"
fi
done
rolefile="$ostree_dir/roles-${pkgtype}.txt"
if [ -f "$rolefile" ]; then
local roles role rolepath
roles="$(cat "$rolefile")"
for role in $roles; do
rolepath="$(get_rolepath "$ostree_dir" "$role")"
get_packages "$rolepath"
done
fi
done | sort -u
}
format_packages_json() {
local comma pkgs pkg
comma=""
pkgs="["
while read -r pkg; do
pkgs="${pkgs}${comma}\"${pkg}\""
comma=,
done
pkgs="${pkgs}]"
echo "$pkgs"
}
format_packages_raw() {
cat
}
format_packages_yaml() {
while read -r pkg; do
echo "- $pkg"
done
}
format_packages_toml() {
while read -r pkg; do
echo "[[packages]]"
echo "name = \"$pkg\""
echo "version = \"*\""
done
}
distro="${distro_ver%%-*}"
ver="${distro_ver##*-}"
if [[ "$ver" =~ ^([0-9]*) ]]; then
major_ver="${BASH_REMATCH[1]}"
else
echo ERROR: cannot parse major version number from version "$ver"
exit 1
fi
"get_$category" "$ostree_dir" | "format_${category}_$format"

View file

@ -0,0 +1,4 @@
bridge-utils
dhclient
initscripts
python-gobject-base

View file

@ -0,0 +1,4 @@
dhcp-client
network-scripts
nmstate
python3-gobject-base

View file

@ -0,0 +1,3 @@
nmstate
python3-gobject-base
python3-libnmstate

View file

@ -0,0 +1,5 @@
dhcp-client
network-scripts
nmstate
python3-gobject-base
python3-libnmstate

View file

@ -0,0 +1,4 @@
bridge-utils
dhclient
initscripts
python-gobject-base

View file

@ -0,0 +1,4 @@
dhcp-client
network-scripts
nmstate
python3-gobject-base

View file

@ -0,0 +1,3 @@
nmstate
python3-gobject-base
python3-libnmstate

View file

@ -0,0 +1,4 @@
NetworkManager
NetworkManager-team
NetworkManager-wifi
wpa_supplicant

View file

@ -0,0 +1 @@
yum-utils

View file

@ -0,0 +1,5 @@
dbus-tools
git
network-scripts
python3-pip
rsync

View file

@ -0,0 +1,4 @@
ethtool
NetworkManager
procps-ng
systemd-resolved

View file

@ -0,0 +1,6 @@
ethtool
hostapd
NetworkManager
openssl
procps-ng
wpa_supplicant

View file

@ -0,0 +1,12 @@
dbus-tools
ethtool
git
hostapd
NetworkManager
network-scripts
openssl
procps-ng
python3-pip
rsync
systemd-resolved
wpa_supplicant

View file

@ -0,0 +1 @@
procps

View file

@ -0,0 +1,7 @@
ethtool
hostapd
NetworkManager
openssl
procps-ng
wpa_supplicant
yum-utils

View file

@ -0,0 +1,10 @@
dbus-tools
ethtool
git
hostapd
NetworkManager
network-scripts
openssl
procps-ng
python3-pip
rsync

View file

@ -0,0 +1,4 @@
ethtool
NetworkManager
procps-ng
systemd-resolved

View file

@ -0,0 +1,3 @@
dnsmasq
iproute
iputils

View file

@ -76,3 +76,4 @@ tests/network/unit/test_network_connections.py future-import-boilerplate!skip
tests/network/unit/test_network_connections.py metaclass-boilerplate!skip
tests/network/unit/test_nm_provider.py future-import-boilerplate!skip
tests/network/unit/test_nm_provider.py metaclass-boilerplate!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

View file

@ -75,3 +75,4 @@ tests/network/get_total_coverage.sh shebang!skip
tests/network/git-pre-commit.sh shebang!skip
tests/network/git-post-commit.sh shebang!skip
tests/network/merge_coverage.sh shebang!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

View file

@ -75,3 +75,4 @@ tests/network/get_total_coverage.sh shebang!skip
tests/network/git-pre-commit.sh shebang!skip
tests/network/git-post-commit.sh shebang!skip
tests/network/merge_coverage.sh shebang!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

View file

@ -75,3 +75,4 @@ tests/network/get_total_coverage.sh shebang!skip
tests/network/git-pre-commit.sh shebang!skip
tests/network/git-post-commit.sh shebang!skip
tests/network/merge_coverage.sh shebang!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

View file

@ -75,3 +75,4 @@ tests/network/get_total_coverage.sh shebang!skip
tests/network/git-pre-commit.sh shebang!skip
tests/network/git-post-commit.sh shebang!skip
tests/network/merge_coverage.sh shebang!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

View file

@ -48,3 +48,4 @@ tests/network/unit/test_network_connections.py future-import-boilerplate!skip
tests/network/unit/test_network_connections.py metaclass-boilerplate!skip
tests/network/unit/test_nm_provider.py future-import-boilerplate!skip
tests/network/unit/test_nm_provider.py metaclass-boilerplate!skip
roles/network/.ostree/get_ostree_data.sh shebang!skip

66
README-ostree.md Normal file
View file

@ -0,0 +1,66 @@
# rpm-ostree
The role supports running on [rpm-ostree](https://coreos.github.io/rpm-ostree/)
systems. The primary issue is that the `/usr` filesystem is read-only, and the
role cannot install packages. Instead, it will just verify that the necessary
packages and any other `/usr` files are pre-installed. The role will change the
package manager to one that is compatible with `rpm-ostree` systems.
## Building
To build an ostree image for a particular operating system distribution and
version, use the script `.ostree/get_ostree_data.sh` to get the list of
packages. If the role uses other system roles, then the script will include the
packages for the other roles in the list it outputs. The list of packages will
be sorted in alphanumeric order.
Usage:
```bash
.ostree/get_ostree_data.sh packages runtime DISTRO-VERSION FORMAT
```
`DISTRO-VERSION` is in the format that Ansible uses for `ansible_distribution`
and `ansible_distribution_version` - for example, `Fedora-38`, `CentOS-8`,
`RedHat-9.4`
`FORMAT` is one of `toml`, `json`, `yaml`, `raw`
* `toml` - each package in a TOML `[[packages]]` element
```toml
[[packages]]
name = "package-a"
version = "*"
[[packages]]
name = "package-b"
version = "*"
...
```
* `yaml` - a YAML list of packages
```yaml
- package-a
- package-b
...
```
* `json` - a JSON list of packages
```json
["package-a","package-b",...]
```
* `raw` - a plain text list of packages, one per line
```bash
package-a
package-b
...
```
What format you choose depends on which image builder you are using. For
example, if you are using something based on
[osbuild-composer](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/composing_installing_and_managing_rhel_for_edge_images/index#creating-an-image-builder-blueprint-for-a-rhel-for-edge-image-using-the-command-line-interface_composing-a-rhel-for-edge-image-using-image-builder-command-line),
you will probably want to use the `toml` output format.

View file

@ -63,6 +63,20 @@ Exceptions are mentioned below. However, the partial networking configuration ca
achieved via specifying the network state configuration in the `network_state`
variable.
## Requirements
See below
### Collection requirements
The role requires external collections only for management of `rpm-ostree`
nodes. Please run the following command to install them if you need to manage
`rpm-ostree` nodes:
```bash
ansible-galaxy collection install -vv -r meta/collection-requirements.yml
```
## Variables
The `network` role is configured via variables starting with `network_` as
@ -1407,3 +1421,7 @@ it is not clear that rollback will result in a working configuration.
*Want to contribute? Take a look at our [contributing
guidelines](https://github.com/linux-system-roles/network/blob/main/contributing.md)!*
## rpm-ostree
See README-ostree.md

View file

@ -0,0 +1,4 @@
---
collections:
- name: ansible.posix
- name: ansible.utils

View file

@ -7,6 +7,24 @@
difference(ansible_facts.keys() | list) | length > 0
no_log: true
- name: Ensure correct package manager for ostree systems
vars:
ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree
ostree_booted_file: /run/ostree-booted
when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr
block:
- name: Check if system is ostree
stat:
path: "{{ ostree_booted_file }}"
register: __ostree_booted_stat
- name: Set package manager to use for ostree
ansible.utils.update_fact:
updates:
- path: ansible_facts.pkg_mgr
value: "{{ ostree_pkg_mgr }}"
when: __ostree_booted_stat.stat.exists
- name: Check which services are running
service_facts:
no_log: true

View file

@ -21,17 +21,12 @@ GET_NM_VERSION = """
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
"""
MINIMUM_NM_VERSION_CHECK = """

View file

@ -38,6 +38,10 @@
- none
client_cert: /etc/pki/tls/client.pem
ca_cert: /etc/pki/tls/cacert.pem
- name: Ensure ping command is present
package:
name: iputils
state: present
- name: "TEST: I can ping the EAP server"
command: ping -c1 203.0.113.1
changed_when: false

View file

@ -79,6 +79,10 @@
- >-
"default via 2001:db8::1 dev {{ interface }}"
in ipv6_route.stdout
- name: Ensure ping6 command is present
package:
name: iputils
state: present
- name: Test gateway can be pinged
command: ping6 -c1 2001:db8::1
when:

View file

@ -3,6 +3,10 @@
- name: Play for testing team plugin installation
hosts: all
tasks:
- name: Check if rpm ostree system - cannot test
meta: end_host
when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree"
- name: Remove the NetworkManager-team package
package:
name: "NetworkManager-team"

View file

@ -3,6 +3,10 @@
- name: Play for testing wireless plugin installation
hosts: all
tasks:
- name: Check if rpm ostree system - cannot test
meta: end_host
when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree"
- name: Remove the NetworkManager-wifi package
package:
name: "NetworkManager-wifi"

View file

@ -13,6 +13,24 @@
- distribution_version
- os_family
- name: Ensure correct package manager for ostree systems
vars:
ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree
ostree_booted_file: /run/ostree-booted
when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr
block:
- name: Check if system is ostree
stat:
path: "{{ ostree_booted_file }}"
register: __ostree_booted_stat
- name: Set package manager to use for ostree
ansible.utils.update_fact:
updates:
- path: ansible_facts.pkg_mgr
value: "{{ ostree_pkg_mgr }}"
when: __ostree_booted_stat.stat.exists
- name: Fix CentOS6 Base repo
copy:
dest: /etc/yum.repos.d/CentOS-Base.repo
@ -40,3 +58,4 @@
- ansible_distribution_major_version == '6'
- name: Include the task 'enable_epel.yml'
include_tasks: enable_epel.yml
when: ansible_facts["pkg_mgr"] != "ansible.posix.rhel_rpm_ostree"

View file

@ -7,25 +7,33 @@
- wpa_supplicant
state: present
# yamllint disable rule:line-length
# Even though hostapd can be installed via EPEL 8, Opportunistic Wireless Encryption
# (OWE) has not been enabled by default. To warrant the test support on RHEL(dist-tag),
# we setup hostapd copr repo to enable OWE option.
- name: Install hostapd and mac80211_hwsim kernel module in CentOS 8
shell: |
dnf -y copr enable liangwen12year/hostapd-owe
dnf -y install hostapd
release=$(uname -r)
tmp="${release/-//}"
tmp="${tmp/.x//x}"
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-core-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-internal-$release.rpm
- name: Check if can test on CentOS 8 and setup if possible
when:
- ansible_distribution_major_version == '8'
- ansible_distribution == 'CentOS'
changed_when: false
# yamllint enable rule:line-length
block:
# It is currently too difficult to install the required kernel
# if using rpm ostree - so just skip this test
- name: Check if rpm ostree system - cannot test
meta: end_host
when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree"
# yamllint disable rule:line-length
# Even though hostapd can be installed via EPEL 8, Opportunistic Wireless Encryption
# (OWE) has not been enabled by default. To warrant the test support on RHEL(dist-tag),
# we setup hostapd copr repo to enable OWE option.
- name: Install hostapd and mac80211_hwsim kernel module in CentOS 8
shell: |
dnf -y copr enable liangwen12year/hostapd-owe
dnf -y install hostapd
release=$(uname -r)
tmp="${release/-//}"
tmp="${tmp/.x//x}"
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-core-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-internal-$release.rpm
changed_when: false
# yamllint enable rule:line-length
- name: Install hostapd in Fedora
shell: |

View file

@ -7,25 +7,33 @@
- wpa_supplicant
state: present
# yamllint disable rule:line-length
# Even though hostapd can be installed via EPEL 8, Simultaneous Authentication
# of Equals (SAE) has not been enabled by default. To warrant the test support
# on CentOS 8, we setup hostapd copr repo to enable SAE option.
- name: Install hostapd and mac80211_hwsim kernel module in CentOS 8
shell: |
dnf -y copr enable liangwen12year/hostapd-owe
dnf -y install hostapd
release=$(uname -r)
tmp="${release/-//}"
tmp="${tmp/.x//x}"
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-core-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-internal-$release.rpm
- name: Configure CentOS 8 system for testing, if possible
when:
- ansible_distribution_major_version == '8'
- ansible_distribution == 'CentOS'
changed_when: false
# yamllint enable rule:line-length
block:
# It is currently too difficult to install the required kernel
# if using rpm ostree - so just skip this test
- name: Check if rpm ostree system - cannot test
meta: end_host
when: ansible_facts.pkg_mgr == "ansible.posix.rhel_rpm_ostree"
# yamllint disable rule:line-length
# Even though hostapd can be installed via EPEL 8, Simultaneous Authentication
# of Equals (SAE) has not been enabled by default. To warrant the test support
# on CentOS 8, we setup hostapd copr repo to enable SAE option.
- name: Install hostapd and mac80211_hwsim kernel module in CentOS 8
shell: |
dnf -y copr enable liangwen12year/hostapd-owe
dnf -y install hostapd
release=$(uname -r)
tmp="${release/-//}"
tmp="${tmp/.x//x}"
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-core-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-$release.rpm
dnf -y install https://koji.mbox.centos.org/pkgs/packages/kernel/$tmp/kernel-modules-internal-$release.rpm
changed_when: false
# yamllint enable rule:line-length
- name: Install hostapd in Fedora
package:

View file

@ -73,6 +73,10 @@
private_key_password_flags:
- not-required
ca_path: /etc/pki/tls/my_ca_certs
- name: Ensure ping command is present
package:
name: iputils
state: present
- name: "TEST: I can ping the EAP server"
command: ping -c1 203.0.113.1
changed_when: false

View file

@ -7,6 +7,23 @@
type: veth
name: Test change indication on repeat run
tasks:
- name: Ensure correct package manager for ostree systems
vars:
ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree
ostree_booted_file: /run/ostree-booted
when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr
block:
- name: Check if system is ostree
stat:
path: "{{ ostree_booted_file }}"
register: __ostree_booted_stat
- name: Set package manager to use for ostree
ansible.utils.update_fact:
updates:
- path: ansible_facts.pkg_mgr
value: "{{ ostree_pkg_mgr }}"
when: __ostree_booted_stat.stat.exists
- name: Include the task 'manage_test_interface.yml'
include_tasks: tasks/manage_test_interface.yml
vars:

View file

@ -24,17 +24,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# The test requires or should run with NetworkManager, therefore it cannot run

View file

@ -24,17 +24,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# The test requires or should run with NetworkManager, therefore it cannot run

View file

@ -24,17 +24,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# The test requires or should run with NetworkManager, therefore it cannot run

View file

@ -24,17 +24,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# The test requires or should run with NetworkManager, therefore it cannot run

View file

@ -24,17 +24,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
when: true
changed_when: false
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# The test requires or should run with NetworkManager, therefore it cannot run

View file

@ -15,15 +15,12 @@
package:
name: NetworkManager
state: present
- name: Get NetworkManager package info
yum:
list: NetworkManager
register: networkmanager_info
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{ networkmanager_info.results |
selectattr('yumstate', 'match', '^installed$') |
map(attribute='version') | list | first }}"
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"
# workaround for: https://github.com/ansible/ansible/issues/27973
# There is no way in Ansible to abort a playbook hosts with specific OS