mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Integration tests: replace ansible_xxx with ansible_facts.xxx (#11479)
Replace ansible_xxx with ansible_facts.xxx.
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
|
||||
- name: "Assert that filesystem UUID is changed"
|
||||
# libblkid gets no UUID at all for this fstype on FreeBSD
|
||||
when: not (ansible_system == 'FreeBSD' and fstype == 'reiserfs')
|
||||
when: not (ansible_facts.system == 'FreeBSD' and fstype == 'reiserfs')
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- 'fs3_result is changed'
|
||||
@@ -102,8 +102,8 @@
|
||||
|
||||
- when:
|
||||
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
|
||||
(fstype == "xfs" and ansible_system == "Linux" and
|
||||
ansible_distribution not in ["CentOS", "Ubuntu"])
|
||||
(fstype == "xfs" and ansible_facts.system == "Linux" and
|
||||
ansible_facts.distribution not in ["CentOS", "Ubuntu"])
|
||||
block:
|
||||
- name: "Check that resizefs does nothing if device size is not changed"
|
||||
community.general.filesystem:
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
vars:
|
||||
search:
|
||||
files:
|
||||
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
|
||||
- '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
|
||||
- 'default.yml'
|
||||
paths:
|
||||
- '../vars/'
|
||||
@@ -36,54 +36,54 @@
|
||||
# Not available: btrfs, lvm, f2fs, ocfs2
|
||||
# All BSD systems use swap fs, but only Linux needs mkswap
|
||||
# Supported: ext2/3/4 (e2fsprogs), xfs (xfsprogs), reiserfs (progsreiserfs), vfat
|
||||
- 'not (ansible_system == "FreeBSD" and item.0.key in ["bcachefs", "btrfs", "f2fs", "swap", "lvm", "ocfs2"])'
|
||||
- 'not (ansible_facts.system == "FreeBSD" and item.0.key in ["bcachefs", "btrfs", "f2fs", "swap", "lvm", "ocfs2"])'
|
||||
# Available on FreeBSD but not on testbed (util-linux conflicts with e2fsprogs): wipefs, mkfs.minix
|
||||
- 'not (ansible_system == "FreeBSD" and item.1 in ["overwrite_another_fs", "remove_fs"])'
|
||||
- 'not (ansible_facts.system == "FreeBSD" and item.1 in ["overwrite_another_fs", "remove_fs"])'
|
||||
|
||||
# Linux limited support
|
||||
# Not available: ufs (this is FreeBSD's native fs)
|
||||
- 'not (ansible_system == "Linux" and item.0.key == "ufs")'
|
||||
- 'not (ansible_facts.system == "Linux" and item.0.key == "ufs")'
|
||||
|
||||
# Other limitations and corner cases
|
||||
|
||||
# bcachefs only on Alpine > 3.18 and Arch Linux for now
|
||||
# other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
|
||||
- 'ansible_distribution == "Alpine" and ansible_distribution_version is version("3.18", ">") and item.0.key == "bcachefs"'
|
||||
- 'ansible_distribution == "Archlinux" and item.0.key == "bcachefs"'
|
||||
- 'ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">") and item.0.key == "bcachefs"'
|
||||
- 'ansible_facts.distribution == "Archlinux" and item.0.key == "bcachefs"'
|
||||
# f2fs-tools and reiserfs-utils packages not available with RHEL/CentOS on CI
|
||||
- 'not (ansible_distribution in ["CentOS", "RedHat"] and item.0.key in ["f2fs", "reiserfs"])'
|
||||
- 'not (ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", ">=") and
|
||||
- 'not (ansible_facts.distribution in ["CentOS", "RedHat"] and item.0.key in ["f2fs", "reiserfs"])'
|
||||
- 'not (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version("8", ">=") and
|
||||
item.0.key == "btrfs")'
|
||||
# reiserfs-utils package not available with Fedora 35 on CI
|
||||
- 'not (ansible_distribution == "Fedora" and (ansible_facts.distribution_major_version | int >= 35) and
|
||||
- 'not (ansible_facts.distribution == "Fedora" and (ansible_facts.distribution_major_version | int >= 35) and
|
||||
item.0.key == "reiserfs")'
|
||||
# reiserfs packages apparently not available with Alpine
|
||||
- 'not (ansible_distribution == "Alpine" and item.0.key == "reiserfs")'
|
||||
- 'not (ansible_facts.distribution == "Alpine" and item.0.key == "reiserfs")'
|
||||
# reiserfsprogs packages no longer available with Arch Linux
|
||||
- 'not (ansible_distribution == "Archlinux" and item.0.key == "reiserfs")'
|
||||
- 'not (ansible_facts.distribution == "Archlinux" and item.0.key == "reiserfs")'
|
||||
# ocfs2 only available on Debian based distributions
|
||||
- 'not (item.0.key == "ocfs2" and ansible_os_family != "Debian")'
|
||||
- 'not (item.0.key == "ocfs2" and ansible_facts.os_family != "Debian")'
|
||||
# Tests use losetup which can not be used inside unprivileged container
|
||||
- 'not (item.0.key == "lvm" and ansible_virtualization_type in ["docker", "container", "containerd"])'
|
||||
- 'not (item.0.key == "lvm" and ansible_facts.virtualization_type in ["docker", "container", "containerd"])'
|
||||
# vfat resizing fails on Debian (but not Ubuntu)
|
||||
- 'not (item.0.key == "vfat" and ansible_distribution == "Debian")' # TODO: figure out why it fails, fix it!
|
||||
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Debian")' # TODO: figure out why it fails, fix it!
|
||||
# vfat resizing fails on ArchLinux
|
||||
- 'not (item.0.key == "vfat" and ansible_distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
|
||||
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
|
||||
# vfat resizing fails on Ubuntu 22.04
|
||||
- 'not (item.0.key == "vfat" and ansible_distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int == 22))'
|
||||
- 'not (item.0.key == "vfat" and ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int == 22))'
|
||||
# TODO: figure out why it fails, fix it!
|
||||
# btrfs-progs cannot be installed on ArchLinux
|
||||
- 'not (item.0.key == "btrfs" and ansible_distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
|
||||
- 'not (item.0.key == "btrfs" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
|
||||
|
||||
# On CentOS 6 shippable containers, wipefs seems unable to remove vfat signatures
|
||||
- 'not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<") and
|
||||
- 'not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_version is version("7.0", "<") and
|
||||
item.1 == "remove_fs" and item.0.key == "vfat")'
|
||||
# On same systems, mkfs.minix (unhandled by the module) can't find the device/file
|
||||
- 'not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<") and
|
||||
- 'not (ansible_facts.distribution == "CentOS" and ansible_facts.distribution_version is version("7.0", "<") and
|
||||
item.1 == "overwrite_another_fs")'
|
||||
|
||||
# TODO: something seems to be broken on Alpine
|
||||
- 'not (ansible_distribution == "Alpine")'
|
||||
- 'not (ansible_facts.distribution == "Alpine")'
|
||||
|
||||
loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'reset_fs_uuid', 'overwrite_another_fs', 'remove_fs', 'set_fs_uuid_on_creation', 'set_fs_uuid_on_creation_with_opts'])|list }}"
|
||||
|
||||
@@ -92,8 +92,8 @@
|
||||
|
||||
- include_tasks: freebsd_setup.yml
|
||||
when:
|
||||
- 'ansible_system == "FreeBSD"'
|
||||
- 'ansible_distribution_version is version("12.2", ">=")'
|
||||
- 'ansible_facts.system == "FreeBSD"'
|
||||
- 'ansible_facts.distribution_version is version("12.2", ">=")'
|
||||
|
||||
- include_tasks: create_device.yml
|
||||
vars:
|
||||
@@ -103,7 +103,7 @@
|
||||
grow: '{{ item.0.value.grow }}'
|
||||
action: '{{ item.1 }}'
|
||||
when:
|
||||
- 'ansible_system == "FreeBSD"'
|
||||
- 'ansible_distribution_version is version("12.2", ">=")'
|
||||
- 'ansible_facts.system == "FreeBSD"'
|
||||
- 'ansible_facts.distribution_version is version("12.2", ">=")'
|
||||
- 'item.0.key in ["xfs", "vfat"]'
|
||||
loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'overwrite_another_fs', 'remove_fs'])|list }}"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Skip UUID reset tests for FreeBSD due to "xfs_admin: only 'rewrite' supported on V5 fs"
|
||||
- when:
|
||||
- new_uuid | default(False)
|
||||
- not (ansible_system == "FreeBSD" and fstype == "xfs")
|
||||
- not (ansible_facts.system == "FreeBSD" and fstype == "xfs")
|
||||
block:
|
||||
- name: "Create filesystem ({{ fstype }})"
|
||||
community.general.filesystem:
|
||||
@@ -42,8 +42,8 @@
|
||||
|
||||
- when:
|
||||
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
|
||||
(fstype == "xfs" and ansible_system == "Linux" and
|
||||
ansible_distribution not in ["CentOS", "Ubuntu"])
|
||||
(fstype == "xfs" and ansible_facts.system == "Linux" and
|
||||
ansible_facts.distribution not in ["CentOS", "Ubuntu"])
|
||||
block:
|
||||
- name: "Reset filesystem ({{ fstype }}) UUID and resizefs"
|
||||
ignore_errors: true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# Skip UUID set at creation tests for FreeBSD due to "xfs_admin: only 'rewrite' supported on V5 fs"
|
||||
- when:
|
||||
- new_uuid | default(False)
|
||||
- not (ansible_system == "FreeBSD" and fstype == "xfs")
|
||||
- not (ansible_facts.system == "FreeBSD" and fstype == "xfs")
|
||||
block:
|
||||
- name: "Create filesystem ({{ fstype }}) with UUID"
|
||||
community.general.filesystem:
|
||||
|
||||
@@ -21,27 +21,27 @@
|
||||
when:
|
||||
# bcachefs only on Alpine > 3.18 and Arch Linux for now
|
||||
# other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
|
||||
- ansible_distribution == "Alpine" and ansible_distribution_version is version("3.18", ">")
|
||||
- ansible_distribution == "Archlinux"
|
||||
- ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">")
|
||||
- ansible_facts.distribution == "Archlinux"
|
||||
|
||||
- name: "Install btrfs progs"
|
||||
ansible.builtin.package:
|
||||
name: btrfs-progs
|
||||
state: present
|
||||
when:
|
||||
- ansible_os_family != 'Suse'
|
||||
- not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('16.04', '<='))
|
||||
- ansible_system != "FreeBSD"
|
||||
- ansible_facts.os_family != 'Suse'
|
||||
- not (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version is version('16.04', '<='))
|
||||
- ansible_facts.system != "FreeBSD"
|
||||
- not (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version('8', '>='))
|
||||
- ansible_os_family != 'Archlinux' # TODO
|
||||
- ansible_facts.os_family != 'Archlinux' # TODO
|
||||
|
||||
- name: "Install btrfs tools (Ubuntu <= 16.04)"
|
||||
ansible.builtin.package:
|
||||
name: btrfs-tools
|
||||
state: present
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- ansible_distribution_version is version('16.04', '<=')
|
||||
- ansible_facts.distribution == 'Ubuntu'
|
||||
- ansible_facts.distribution_version is version('16.04', '<=')
|
||||
|
||||
- name: "Install btrfs progs (OpenSuse)"
|
||||
ansible.builtin.package:
|
||||
@@ -49,14 +49,14 @@
|
||||
- python3-xml
|
||||
- btrfsprogs
|
||||
state: present
|
||||
when: ansible_os_family == 'Suse'
|
||||
when: ansible_facts.os_family == 'Suse'
|
||||
|
||||
- name: "Install reiserfs utils (Fedora)"
|
||||
ansible.builtin.package:
|
||||
name: reiserfs-utils
|
||||
state: present
|
||||
when:
|
||||
- ansible_distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
|
||||
- ansible_facts.distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
|
||||
|
||||
- name: "Install reiserfs and util-linux-systemd (for findmnt) (OpenSuse)"
|
||||
ansible.builtin.package:
|
||||
@@ -65,34 +65,34 @@
|
||||
- util-linux-systemd
|
||||
state: present
|
||||
when:
|
||||
- ansible_os_family == 'Suse'
|
||||
- ansible_facts.os_family == 'Suse'
|
||||
|
||||
- name: "Install reiserfs progs (Debian and more)"
|
||||
ansible.builtin.package:
|
||||
name: reiserfsprogs
|
||||
state: present
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ansible_os_family not in ['Suse', 'RedHat', 'Alpine', 'Archlinux']
|
||||
- ansible_facts.system == 'Linux'
|
||||
- ansible_facts.os_family not in ['Suse', 'RedHat', 'Alpine', 'Archlinux']
|
||||
|
||||
- name: "Install reiserfs progs (FreeBSD)"
|
||||
ansible.builtin.package:
|
||||
name: progsreiserfs
|
||||
state: present
|
||||
when:
|
||||
- ansible_system == 'FreeBSD'
|
||||
- ansible_facts.system == 'FreeBSD'
|
||||
|
||||
- name: "Install ocfs2 (Debian)"
|
||||
ansible.builtin.package:
|
||||
name: ocfs2-tools
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian'
|
||||
when: ansible_facts.os_family == 'Debian'
|
||||
|
||||
- name: "Install f2fs tools and get version"
|
||||
when:
|
||||
- ansible_os_family != 'RedHat' or ansible_distribution == 'Fedora'
|
||||
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('16.04', '>=')
|
||||
- ansible_system != "FreeBSD"
|
||||
- ansible_facts.os_family != 'RedHat' or ansible_facts.distribution == 'Fedora'
|
||||
- ansible_facts.distribution != 'Ubuntu' or ansible_facts.distribution_version is version('16.04', '>=')
|
||||
- ansible_facts.system != "FreeBSD"
|
||||
block:
|
||||
- name: "Install f2fs tools"
|
||||
ansible.builtin.package:
|
||||
@@ -117,14 +117,14 @@
|
||||
name:
|
||||
- dosfstools
|
||||
- lvm2
|
||||
when: ansible_system == 'Linux'
|
||||
when: ansible_facts.system == 'Linux'
|
||||
|
||||
- name: "Install fatresize and get version"
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ansible_os_family != 'Suse'
|
||||
- ansible_os_family != 'RedHat' or (ansible_distribution == 'CentOS' and ansible_distribution_version is version('7.0', '=='))
|
||||
- ansible_os_family != 'Alpine'
|
||||
- ansible_facts.system == 'Linux'
|
||||
- ansible_facts.os_family != 'Suse'
|
||||
- ansible_facts.os_family != 'RedHat' or (ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_version is version('7.0', '=='))
|
||||
- ansible_facts.os_family != 'Alpine'
|
||||
block:
|
||||
- name: "Install fatresize"
|
||||
ansible.builtin.package:
|
||||
|
||||
Reference in New Issue
Block a user