collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -1,5 +1,10 @@
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1
azp/posix/vm
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/macos

View File

@@ -1,29 +1,33 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
tested_filesystems:
# key: fstype
# fssize: size (Mo)
# grow: True if resizefs is supported
# grow: true if resizefs is supported
# Other minimal sizes:
# - XFS: 20Mo
# - Btrfs: 150Mo (50Mo when "--metadata single" is used and 100Mb when on newer Fedora versions)
# - f2fs:
# - 1.2.0 requires at leat 116Mo
# - 1.2.0 requires at least 116Mo
# - 1.7.0 requires at least 30Mo
# - 1.10.0 requires at least 38Mo
# - resizefs asserts when initial fs is smaller than 60Mo and seems to require 1.10.0
ext4: {fssize: 10, grow: True}
ext4dev: {fssize: 10, grow: True}
ext3: {fssize: 10, grow: True}
ext2: {fssize: 10, grow: True}
xfs: {fssize: 20, grow: False} # grow requires a mounted filesystem
btrfs: {fssize: 150, grow: False} # grow requires a mounted filesystem
reiserfs: {fssize: 33, grow: False} # grow not implemented
vfat: {fssize: 20, grow: True}
ocfs2: {fssize: '{{ ocfs2_fssize }}', grow: False} # grow not implemented
f2fs: {fssize: '{{ f2fs_fssize|default(60) }}', grow: 'f2fs_version is version("1.10.0", ">=")'}
lvm: {fssize: 20, grow: True}
swap: {fssize: 10, grow: False} # grow not implemented
ufs: {fssize: 10, grow: True}
ext4: {fssize: 10, grow: true, new_uuid: 'random'}
ext4dev: {fssize: 10, grow: true, new_uuid: 'random'}
ext3: {fssize: 10, grow: true, new_uuid: 'random'}
ext2: {fssize: 10, grow: true, new_uuid: 'random'}
xfs: {fssize: 300, grow: false, new_uuid: 'generate'} # grow requires a mounted filesystem
btrfs: {fssize: 150, grow: false, new_uuid: null} # grow requires a mounted filesystem
reiserfs: {fssize: 33, grow: false, new_uuid: null} # grow not implemented
vfat: {fssize: 20, grow: true, new_uuid: null}
ocfs2: {fssize: '{{ ocfs2_fssize }}', grow: false, new_uuid: null} # grow not implemented
f2fs: {fssize: '{{ f2fs_fssize|default(60) }}', grow: 'f2fs_version is version("1.10.0", ">=")', new_uuid: null}
lvm: {fssize: 20, grow: true, new_uuid: 'something'}
swap: {fssize: 10, grow: false, new_uuid: null} # grow not implemented
ufs: {fssize: 10, grow: true, new_uuid: null}
get_uuid_any: "blkid -c /dev/null -o value -s UUID {{ dev }}"

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir
- setup_remote_tmp_dir_outside_tmp

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: 'Create a "disk" file'
community.general.filesize:
path: '{{ image_file }}'
@@ -10,10 +14,14 @@
block:
- when: fstype == 'lvm'
block:
- name: 'Show next free loop device'
ansible.builtin.command:
cmd: 'losetup -f'
register: loop_device_cmd
- name: 'Create a loop device for LVM'
ansible.builtin.command:
cmd: 'losetup --show -f {{ dev }}'
register: loop_device_cmd
cmd: 'losetup -f {{ dev }}'
- name: 'Switch to loop device target for further tasks'
ansible.builtin.set_fact:

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: "Create filesystem ({{ fstype }})"
community.general.filesystem:
dev: '{{ dev }}'
@@ -40,7 +44,7 @@
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
force: yes
force: true
register: fs3_result
- name: "Get UUID of the new filesystem"
@@ -80,7 +84,7 @@
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
resizefs: yes
resizefs: true
register: fs4_result
- name: "Get UUID of the filesystem"
@@ -105,7 +109,7 @@
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
resizefs: yes
resizefs: true
register: fs5_result
- name: "Assert that the state did not change"

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: "Uninstall e2fsprogs"
ansible.builtin.package:
name: e2fsprogs

View File

@@ -4,6 +4,10 @@
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- ansible.builtin.debug:
msg: '{{ role_name }}'
- ansible.builtin.debug:
@@ -25,6 +29,7 @@
fstype: '{{ item.0.key }}'
fssize: '{{ item.0.value.fssize }}'
grow: '{{ item.0.value.grow }}'
new_uuid: '{{ item.0.value.new_uuid }}'
action: '{{ item.1 }}'
when:
# FreeBSD limited support
@@ -58,6 +63,9 @@
- 'not (item.0.key == "vfat" and ansible_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!
# vfat resizing fails on Ubuntu 22.04
- 'not (item.0.key == "vfat" and ansible_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!
@@ -76,7 +84,7 @@
# TODO: something seems to be broken on Alpine
- 'not (ansible_distribution == "Alpine")'
loop: "{{ query('dict', tested_filesystems)|product(['create_fs', 'overwrite_another_fs', 'remove_fs'])|list }}"
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 }}"
# With FreeBSD extended support (util-linux is not available before 12.2)

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: 'Recreate "disk" file'
community.general.filesize:
path: '{{ image_file }}'
@@ -20,7 +24,7 @@
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs_result
ignore_errors: True
ignore_errors: true
- name: 'Get UUID of the filesystem'
ansible.builtin.shell:
@@ -38,7 +42,7 @@
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
force: yes
force: true
register: fs_result2
- name: 'Get UUID of the new filesystem'

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# We assume 'create_fs' tests have passed.
- name: "Create filesystem"
@@ -24,7 +28,7 @@
dev: '{{ dev }}'
state: absent
register: wipefs
check_mode: yes
check_mode: true
- name: "Get filesystem UUID with 'blkid' (should remain the same)"
ansible.builtin.shell:
@@ -77,7 +81,7 @@
dev: '{{ dev }}'
state: absent
register: wipefs
check_mode: yes
check_mode: true
- name: "Assert that the state did not change"
ansible.builtin.assert:

View File

@@ -0,0 +1,59 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# 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")
block:
- name: "Create filesystem ({{ fstype }})"
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs_result
- name: "Get UUID of created filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid
- name: "Reset filesystem ({{ fstype }}) UUID"
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: "{{ new_uuid }}"
register: fs_resetuuid_result
- name: "Get UUID of the filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid2
- name: "Assert that filesystem UUID is changed"
ansible.builtin.assert:
that:
- 'fs_resetuuid_result is changed'
- 'fs_resetuuid_result is success'
- 'uuid.stdout != uuid2.stdout'
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
block:
- name: "Reset filesystem ({{ fstype }}) UUID and resizefs"
ignore_errors: true
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: "{{ new_uuid }}"
resizefs: true
register: fs_resetuuid_and_resizefs_result
- name: "Assert that filesystem UUID reset and resizefs failed"
ansible.builtin.assert:
that: fs_resetuuid_and_resizefs_result is failed

View File

@@ -0,0 +1,44 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: "Generate a random UUID"
ansible.builtin.set_fact:
random_uuid: '{{ "first_random_uuid" | ansible.builtin.to_uuid }}'
# 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")
block:
- name: "Create filesystem ({{ fstype }}) with UUID"
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: '{{ random_uuid }}'
register: fs_result
- name: "Get UUID of the created filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid
- name: "Assert that filesystem UUID is the random UUID set on creation"
ansible.builtin.assert:
that: (random_uuid | replace('-','')) == ( uuid.stdout | replace('-',''))
- when: not (new_uuid | default(False))
block:
- name: "Create filesystem ({{ fstype }}) without UUID support"
ignore_errors: true
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
uuid: '{{ random_uuid }}'
register: fs_result
- name: "Assert that filesystem creation failed"
ansible.builtin.assert:
that: fs_result is failed

View File

@@ -0,0 +1,33 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# UUID set at creation with opts for XFS is not supported
- when:
- new_uuid | default(False)
- fstype != "xfs"
block:
- name: "Generate random UUIDs"
ansible.builtin.set_fact:
random_uuid: '{{ "first_random_uuid" | ansible.builtin.to_uuid }}'
random_uuid2: '{{ "second_random_uuid" | ansible.builtin.to_uuid }}'
- name: "Create filesystem ({{ fstype }}) with fix UUID as opt"
community.general.filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
opts: "{{ ((fstype == 'lvm') | ansible.builtin.ternary('--norestorefile --uuid ', '-U ')) + random_uuid2 }}"
uuid: '{{ random_uuid }}'
register: fs_result2
- name: "Get UUID of the created filesystem"
ansible.builtin.shell:
cmd: "{{ get_uuid_cmd }}"
changed_when: false
register: uuid2
- name: "Assert that filesystem UUID is the one set on creation with opt"
ansible.builtin.assert:
that: (random_uuid2 | replace('-','')) == ( uuid2.stdout | replace('-',''))

View File

@@ -1,4 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# By installing e2fsprogs on FreeBSD, we get a usable blkid command, but this
# package conflicts with util-linux, that provides blkid too, but also wipefs
# (required for filesystem state=absent).

View File

@@ -1,3 +1,7 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
ocfs2_fssize: 108
f2fs_fssize: 116

View File

@@ -1,2 +1,6 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
ocfs2_fssize: 20