fix intendation mess up

Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
Adam Miller 2023-12-04 17:57:02 -06:00
parent 8b53cf594e
commit 1138e6132a

View file

@ -516,9 +516,9 @@
ephemeral_fstab: /etc/fstab
when: ansible_system == 'OpenBSD'
##### FORMAT FS ON LINUX
##### FORMAT FS ON LINUX
- name: Block to format FS on Linux
- name: Block to format FS on Linux
when: ansible_system == 'Linux'
block:
- name: Format FS A on Linux
@ -531,32 +531,32 @@
fstype: ext3
dev: /tmp/myfs_B.img
##### FORMAT FS ON SOLARIS AND BSD
##### FORMAT FS ON SOLARIS AND BSD
- name: Create loop devices on Solaris and BSD
- name: Create loop devices on Solaris and BSD
ansible.builtin.command: "{{ ephemeral_create_loop_dev_cmd }}"
changed_when: true
when: ephemeral_create_loop_dev_cmd is defined
- name: Format FS A and B on Solaris and BSD
- name: Format FS A and B on Solaris and BSD
ansible.builtin.command: "{{ ephemeral_format_fs_cmd }}"
changed_when: true
when: ephemeral_format_fs_cmd is defined
##### TESTS
##### TESTS
- name: Create fstab if it does not exist
- name: Create fstab if it does not exist
ansible.builtin.file:
path: "{{ ephemeral_fstab }}"
state: touch
mode: "0644"
- name: Get checksum of /etc/fstab before mounting anything
- name: Get checksum of /etc/fstab before mounting anything
ansible.builtin.stat:
path: "{{ ephemeral_fstab }}"
register: fstab_stat_before_mount
- name: Mount the FS A with ephemeral state
- name: Mount the FS A with ephemeral state
ansible.posix.mount:
path: /tmp/myfs
src: "{{ ephemeral_device_a }}"
@ -565,39 +565,39 @@
state: ephemeral
register: ephemeral_mount_info
- name: Put something in the directory so we can do additional checks later on
- name: Put something in the directory so we can do additional checks later on
ansible.builtin.copy:
content: Testing
dest: /tmp/myfs/test_file
mode: "0644"
- name: Get checksum of /etc/fstab after an ephemeral mount
- name: Get checksum of /etc/fstab after an ephemeral mount
ansible.builtin.stat:
path: "{{ ephemeral_fstab }}"
register: fstab_stat_after_mount
- name: Get mountinfo
- name: Get mountinfo
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
register: check_mountinfo
changed_when: false
- name: Assert the mount occured and the fstab is unchanged
- name: Assert the mount occured and the fstab is unchanged
ansible.builtin.assert:
that:
- check_mountinfo.stdout|int == 1
- ephemeral_mount_info['changed']
- fstab_stat_before_mount['stat']['checksum'] == fstab_stat_after_mount['stat']['checksum']
- name: Get first mount record
- name: Get first mount record
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
executable: /bin/bash
register: ephemeral_mount_record_1
changed_when: false
- name: Try to mount FS A where FS A is already mounted (should trigger remount and changed)
- name: Try to mount FS A where FS A is already mounted (should trigger remount and changed)
ansible.posix.mount:
path: /tmp/myfs
src: "{{ ephemeral_device_a }}"
@ -606,21 +606,21 @@
state: ephemeral
register: ephemeral_mount_info
- name: Get second mount record (should be different than the first)
- name: Get second mount record (should be different than the first)
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
executable: /bin/bash
register: ephemeral_mount_record_2
changed_when: false
- name: Get mountinfo
- name: Get mountinfo
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
register: check_mountinfo
changed_when: false
- name: Assert the FS A is still mounted, the options changed and the fstab unchanged
- name: Assert the FS A is still mounted, the options changed and the fstab unchanged
ansible.builtin.assert:
that:
- check_mountinfo.stdout|int == 1
@ -628,7 +628,7 @@
- ephemeral_mount_info['changed']
- fstab_stat_before_mount['stat']['checksum'] == fstab_stat_after_mount['stat']['checksum']
- name: Try to mount file B on file A mountpoint (should fail)
- name: Try to mount file B on file A mountpoint (should fail)
ansible.posix.mount:
path: /tmp/myfs
src: "{{ ephemeral_device_b }}"
@ -637,26 +637,26 @@
register: ephemeral_mount_b_info
ignore_errors: true
- name: Get third mount record (should be the same than the second)
- name: Get third mount record (should be the same than the second)
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
executable: /bin/bash
register: ephemeral_mount_record_3
changed_when: false
- name: Get mountinfo
- name: Get mountinfo
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
register: check_mountinfo
changed_when: false
- name: Try to stat our test file
- name: Try to stat our test file
ansible.builtin.stat:
path: /tmp/myfs/test_file
register: test_file_stat
- name: Assert that mounting FS B over FS A failed
- name: Assert that mounting FS B over FS A failed
ansible.builtin.assert:
that:
- check_mountinfo.stdout|int == 1
@ -664,29 +664,29 @@
- test_file_stat['stat']['exists']
- ephemeral_mount_b_info is failed
- name: Unmount FS with state = unmounted
- name: Unmount FS with state = unmounted
ansible.posix.mount:
path: /tmp/myfs
state: unmounted
- name: Get fstab checksum after unmounting an ephemeral mount with state = unmounted
- name: Get fstab checksum after unmounting an ephemeral mount with state = unmounted
ansible.builtin.stat:
path: "{{ ephemeral_fstab }}"
register: fstab_stat_after_unmount
- name: Get mountinfo
- name: Get mountinfo
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
register: check_mountinfo
changed_when: false
- name: Try to stat our test file
- name: Try to stat our test file
ansible.builtin.stat:
path: /tmp/myfs/test_file
register: test_file_stat
- name: Assert that fstab is unchanged after unmounting an ephemeral mount with state = unmounted
- name: Assert that fstab is unchanged after unmounting an ephemeral mount with state = unmounted
ansible.builtin.assert:
that:
- check_mountinfo.stdout|int == 0