Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/filesystem/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Copyright (c) Ansible Project
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10
11 - ansible.builtin.debug:
12 msg: '{{ role_name }}'
13 - ansible.builtin.debug:
14 msg: '{{ role_path|basename }}'
15 - import_tasks: setup.yml
16
17 - include_vars: "{{ lookup('first_found', search) }}"
18 vars:
19 search:
20 files:
21 - '{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml'
22 - 'default.yml'
23 paths:
24 - '../vars/'
25
26 - include_tasks: create_device.yml
27 vars:
28 image_file: '{{ remote_tmp_dir }}/img'
29 fstype: '{{ item.0.key }}'
30 fssize: '{{ item.0.value.fssize }}'
31 grow: '{{ item.0.value.grow }}'
32 new_uuid: '{{ item.0.value.new_uuid }}'
33 action: '{{ item.1 }}'
34 when:
35 # FreeBSD limited support
36 # Not available: btrfs, lvm, f2fs, ocfs2
37 # All BSD systems use swap fs, but only Linux needs mkswap
38 # Supported: ext2/3/4 (e2fsprogs), xfs (xfsprogs), reiserfs (progsreiserfs), vfat
39 - 'not (ansible_facts.system == "FreeBSD" and item.0.key in ["bcachefs", "btrfs", "f2fs", "swap", "lvm", "ocfs2"])'
40 # Available on FreeBSD but not on testbed (util-linux conflicts with e2fsprogs): wipefs, mkfs.minix
41 - 'not (ansible_facts.system == "FreeBSD" and item.1 in ["overwrite_another_fs", "remove_fs"])'
42
43 # Linux limited support
44 # Not available: ufs (this is FreeBSD's native fs)
45 - 'not (ansible_facts.system == "Linux" and item.0.key == "ufs")'
46
47 # Other limitations and corner cases
48
49 # bcachefs only on Alpine > 3.18 and Arch Linux for now
50 # other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
51 - 'ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">") and item.0.key == "bcachefs"'
52 - 'ansible_facts.distribution == "Archlinux" and item.0.key == "bcachefs"'
53 # f2fs-tools and reiserfs-utils packages not available with RHEL/CentOS on CI
54 - 'not (ansible_facts.distribution in ["CentOS", "RedHat"] and item.0.key in ["f2fs", "reiserfs"])'
55 - 'not (ansible_facts.os_family == "RedHat" and item.0.key == "btrfs")'
56 # reiserfs-utils package not available with Fedora 35 on CI
57 - 'not (ansible_facts.distribution == "Fedora" and (ansible_facts.distribution_major_version | int >= 35) and
58 item.0.key == "reiserfs")'
59 # reiserfs packages apparently not available with Alpine
60 - 'not (ansible_facts.distribution == "Alpine" and item.0.key == "reiserfs")'
61 # reiserfsprogs packages no longer available with Arch Linux
62 - 'not (ansible_facts.distribution == "Archlinux" and item.0.key == "reiserfs")'
63 # reiserfsprogs packages no longer available with Ubuntu 26.04
64 - 'not (item.0.key == "reiserfs" and ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int >= 26))'
65 # ocfs2 only available on Debian based distributions
66 - 'not (item.0.key == "ocfs2" and ansible_facts.os_family != "Debian")'
67 # Tests use losetup which can not be used inside unprivileged container
68 - 'not (item.0.key == "lvm" and ansible_facts.virtualization_type in ["docker", "container", "containerd"])'
69 # vfat resizing fails on Debian (but not Ubuntu)
70 - 'not (item.0.key == "vfat" and ansible_facts.distribution == "Debian")' # TODO: figure out why it fails, fix it!
71 # vfat resizing fails on ArchLinux
72 - 'not (item.0.key == "vfat" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
73 # vfat resizing fails on Ubuntu 22.04
74 - 'not (item.0.key == "vfat" and ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int == 22))'
75 # TODO: figure out why it fails, fix it!
76 # btrfs-progs cannot be installed on ArchLinux
77 - 'not (item.0.key == "btrfs" and ansible_facts.distribution == "Archlinux")' # TODO: figure out why it fails, fix it!
78
79
80 # TODO: something seems to be broken on Alpine
81 - 'not (ansible_facts.distribution == "Alpine")'
82
83 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 }}"
84
85
86 # With FreeBSD extended support (util-linux is not available before 12.2)
87
88 - include_tasks: freebsd_setup.yml
89 when:
90 - 'ansible_facts.system == "FreeBSD"'
91 - 'ansible_facts.distribution_version is version("12.2", ">=")'
92
93 - include_tasks: create_device.yml
94 vars:
95 image_file: '{{ remote_tmp_dir }}/img'
96 fstype: '{{ item.0.key }}'
97 fssize: '{{ item.0.value.fssize }}'
98 grow: '{{ item.0.value.grow }}'
99 action: '{{ item.1 }}'
100 when:
101 - 'ansible_facts.system == "FreeBSD"'
102 - 'ansible_facts.distribution_version is version("12.2", ">=")'
103 - 'item.0.key in ["xfs", "vfat"]'
104 loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'overwrite_another_fs', 'remove_fs'])|list }}"