Debian Codegraph @

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

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 # By installing e2fsprogs on FreeBSD, we get a usable blkid command, but this
7 # package conflicts with util-linux, that provides blkid too, but also wipefs
8 # (required for filesystem state=absent).
9 - name: "Install filesystem tools"
10 ansible.builtin.package:
11 name: '{{ item }}'
12 state: present
13 loop:
14 - e2fsprogs
15 - xfsprogs
16
17 - name: "Install bcachefs tools"
18 ansible.builtin.package:
19 name: bcachefs-tools
20 state: present
21 when:
22 # bcachefs only on Alpine > 3.18 and Arch Linux for now
23 # other distributions have too old versions of bcachefs-tools and/or util-linux (blkid for UUID tests)
24 - ansible_facts.distribution == "Alpine" and ansible_facts.distribution_version is version("3.18", ">")
25 - ansible_facts.distribution == "Archlinux"
26
27 - name: "Install btrfs progs"
28 ansible.builtin.package:
29 name: btrfs-progs
30 state: present
31 when:
32 - ansible_facts.os_family != 'Suse'
33 - not (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version is version('16.04', '<='))
34 - ansible_facts.system != "FreeBSD"
35 - not (ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version('8', '>='))
36 - ansible_facts.os_family != 'Archlinux' # TODO
37
38 - name: "Install btrfs tools (Ubuntu <= 16.04)"
39 ansible.builtin.package:
40 name: btrfs-tools
41 state: present
42 when:
43 - ansible_facts.distribution == 'Ubuntu'
44 - ansible_facts.distribution_version is version('16.04', '<=')
45
46 - name: "Install btrfs progs (OpenSuse)"
47 ansible.builtin.package:
48 name:
49 - python3-xml
50 - btrfsprogs
51 state: present
52 when: ansible_facts.os_family == 'Suse'
53
54 - name: "Install reiserfs utils (Fedora)"
55 ansible.builtin.package:
56 name: reiserfs-utils
57 state: present
58 when:
59 - ansible_facts.distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
60
61 - name: "Install reiserfs and util-linux-systemd (for findmnt) (OpenSuse)"
62 ansible.builtin.package:
63 name:
64 - reiserfs
65 - util-linux-systemd
66 state: present
67 when:
68 - ansible_facts.os_family == 'Suse'
69
70 - name: "Install reiserfs progs (Debian and more)"
71 ansible.builtin.package:
72 name: reiserfsprogs
73 state: present
74 when:
75 - ansible_facts.system == 'Linux'
76 - ansible_facts.os_family not in ['Suse', 'RedHat', 'Alpine', 'Archlinux']
77 - ansible_facts.distribution != "Ubuntu" or (ansible_facts.distribution_major_version | int < 26)
78
79 - name: "Install reiserfs progs (FreeBSD)"
80 ansible.builtin.package:
81 name: progsreiserfs
82 state: present
83 when:
84 - ansible_facts.system == 'FreeBSD'
85
86 - name: "Install ocfs2 (Debian)"
87 ansible.builtin.package:
88 name: ocfs2-tools
89 state: present
90 when: ansible_facts.os_family == 'Debian'
91
92 - name: "Install f2fs tools and get version"
93 when:
94 - ansible_facts.os_family != 'RedHat' or ansible_facts.distribution == 'Fedora'
95 - ansible_facts.distribution != 'Ubuntu' or ansible_facts.distribution_version is version('16.04', '>=')
96 - ansible_facts.system != "FreeBSD"
97 block:
98 - name: "Install f2fs tools"
99 ansible.builtin.package:
100 name: f2fs-tools
101 state: present
102
103 - name: "Fetch f2fs version"
104 ansible.builtin.command:
105 cmd: mkfs.f2fs /dev/null
106 changed_when: false
107 ignore_errors: true
108 register: mkfs_f2fs
109
110 - name: "Record f2fs_version"
111 ansible.builtin.set_fact:
112 f2fs_version: '{{ mkfs_f2fs.stdout
113 | regex_search("F2FS-tools: mkfs.f2fs Ver:.*")
114 | regex_replace("F2FS-tools: mkfs.f2fs Ver: ([0-9.]+) .*", "\1") }}'
115
116 - name: "Install dosfstools and lvm2 (Linux)"
117 ansible.builtin.package:
118 name:
119 - dosfstools
120 - lvm2
121 when: ansible_facts.system == 'Linux'
122
123 - name: "Install fatresize and get version"
124 when:
125 - ansible_facts.system == 'Linux'
126 - ansible_facts.os_family != 'Suse'
127 - ansible_facts.os_family != 'RedHat'
128 - ansible_facts.os_family != 'Alpine'
129 block:
130 - name: "Install fatresize"
131 ansible.builtin.package:
132 name: fatresize
133 state: present
134
135 - name: "Fetch fatresize version"
136 ansible.builtin.command:
137 cmd: fatresize --help
138 changed_when: false
139 register: fatresize
140
141 - name: "Record fatresize_version"
142 ansible.builtin.set_fact:
143 fatresize_version: '{{ fatresize.stdout_lines[0] | regex_search("[0-9]+\.[0-9]+\.[0-9]+") }}'
144
145 - name: "Fetch e2fsprogs version"
146 ansible.builtin.command:
147 cmd: mke2fs -V
148 changed_when: false
149 register: mke2fs
150
151 - name: "Record e2fsprogs_version"
152 ansible.builtin.set_fact:
153 # mke2fs 1.43.6 (29-Aug-2017)
154 e2fsprogs_version: '{{ mke2fs.stderr_lines[0] | regex_search("[0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2})?") }}'
155
156 - name: "Set version-related facts to skip further tasks"
157 ansible.builtin.set_fact:
158 # http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.43
159 # Mke2fs no longer complains if the user tries to create a file system
160 # using the entire block device.
161 force_creation: "{{ e2fsprogs_version is version('1.43', '<') }}"
162 # Earlier versions have a segfault bug
163 resize_vfat: "{{ fatresize_version|default('0.0') is version('1.0.4', '>=') }}"