mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 13:44:24 -07:00
parent
bc99432f89
commit
eaa5e07b28
247 changed files with 7318 additions and 7375 deletions
|
@ -8,52 +8,52 @@
|
|||
- 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: "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: "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
|
||||
- name: "Reset filesystem ({{ fstype }}) UUID"
|
||||
community.general.filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
uuid: "{{ new_uuid }}"
|
||||
resizefs: true
|
||||
register: fs_resetuuid_and_resizefs_result
|
||||
register: fs_resetuuid_result
|
||||
|
||||
- name: "Assert that filesystem UUID reset and resizefs failed"
|
||||
- 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_and_resizefs_result is failed
|
||||
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
|
||||
|
|
|
@ -12,33 +12,33 @@
|
|||
- 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: "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: "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('-',''))
|
||||
- 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: "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
|
||||
- name: "Assert that filesystem creation failed"
|
||||
ansible.builtin.assert:
|
||||
that: fs_result is failed
|
||||
|
|
|
@ -9,25 +9,25 @@
|
|||
- 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: "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: "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: "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('-',''))
|
||||
- name: "Assert that filesystem UUID is the one set on creation with opt"
|
||||
ansible.builtin.assert:
|
||||
that: (random_uuid2 | replace('-','')) == ( uuid2.stdout | replace('-',''))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue