mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 15:45:20 +01:00
fix intendation mess up
Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
8b53cf594e
commit
1138e6132a
1 changed files with 148 additions and 148 deletions
|
|
@ -516,9 +516,9 @@
|
||||||
ephemeral_fstab: /etc/fstab
|
ephemeral_fstab: /etc/fstab
|
||||||
when: ansible_system == 'OpenBSD'
|
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'
|
when: ansible_system == 'Linux'
|
||||||
block:
|
block:
|
||||||
- name: Format FS A on Linux
|
- name: Format FS A on Linux
|
||||||
|
|
@ -531,32 +531,32 @@
|
||||||
fstype: ext3
|
fstype: ext3
|
||||||
dev: /tmp/myfs_B.img
|
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 }}"
|
ansible.builtin.command: "{{ ephemeral_create_loop_dev_cmd }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
when: ephemeral_create_loop_dev_cmd is defined
|
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 }}"
|
ansible.builtin.command: "{{ ephemeral_format_fs_cmd }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
when: ephemeral_format_fs_cmd is defined
|
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:
|
ansible.builtin.file:
|
||||||
path: "{{ ephemeral_fstab }}"
|
path: "{{ ephemeral_fstab }}"
|
||||||
state: touch
|
state: touch
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Get checksum of /etc/fstab before mounting anything
|
- name: Get checksum of /etc/fstab before mounting anything
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ ephemeral_fstab }}"
|
path: "{{ ephemeral_fstab }}"
|
||||||
register: fstab_stat_before_mount
|
register: fstab_stat_before_mount
|
||||||
|
|
||||||
- name: Mount the FS A with ephemeral state
|
- name: Mount the FS A with ephemeral state
|
||||||
ansible.posix.mount:
|
ansible.posix.mount:
|
||||||
path: /tmp/myfs
|
path: /tmp/myfs
|
||||||
src: "{{ ephemeral_device_a }}"
|
src: "{{ ephemeral_device_a }}"
|
||||||
|
|
@ -565,39 +565,39 @@
|
||||||
state: ephemeral
|
state: ephemeral
|
||||||
register: ephemeral_mount_info
|
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:
|
ansible.builtin.copy:
|
||||||
content: Testing
|
content: Testing
|
||||||
dest: /tmp/myfs/test_file
|
dest: /tmp/myfs/test_file
|
||||||
mode: "0644"
|
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:
|
ansible.builtin.stat:
|
||||||
path: "{{ ephemeral_fstab }}"
|
path: "{{ ephemeral_fstab }}"
|
||||||
register: fstab_stat_after_mount
|
register: fstab_stat_after_mount
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
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:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- check_mountinfo.stdout|int == 1
|
- check_mountinfo.stdout|int == 1
|
||||||
- ephemeral_mount_info['changed']
|
- ephemeral_mount_info['changed']
|
||||||
- fstab_stat_before_mount['stat']['checksum'] == fstab_stat_after_mount['stat']['checksum']
|
- 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:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: ephemeral_mount_record_1
|
register: ephemeral_mount_record_1
|
||||||
changed_when: false
|
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:
|
ansible.posix.mount:
|
||||||
path: /tmp/myfs
|
path: /tmp/myfs
|
||||||
src: "{{ ephemeral_device_a }}"
|
src: "{{ ephemeral_device_a }}"
|
||||||
|
|
@ -606,21 +606,21 @@
|
||||||
state: ephemeral
|
state: ephemeral
|
||||||
register: ephemeral_mount_info
|
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:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: ephemeral_mount_record_2
|
register: ephemeral_mount_record_2
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
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:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- check_mountinfo.stdout|int == 1
|
- check_mountinfo.stdout|int == 1
|
||||||
|
|
@ -628,7 +628,7 @@
|
||||||
- ephemeral_mount_info['changed']
|
- ephemeral_mount_info['changed']
|
||||||
- fstab_stat_before_mount['stat']['checksum'] == fstab_stat_after_mount['stat']['checksum']
|
- 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:
|
ansible.posix.mount:
|
||||||
path: /tmp/myfs
|
path: /tmp/myfs
|
||||||
src: "{{ ephemeral_device_b }}"
|
src: "{{ ephemeral_device_b }}"
|
||||||
|
|
@ -637,26 +637,26 @@
|
||||||
register: ephemeral_mount_b_info
|
register: ephemeral_mount_b_info
|
||||||
ignore_errors: true
|
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:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: ephemeral_mount_record_3
|
register: ephemeral_mount_record_3
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Try to stat our test file
|
- name: Try to stat our test file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /tmp/myfs/test_file
|
path: /tmp/myfs/test_file
|
||||||
register: test_file_stat
|
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:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- check_mountinfo.stdout|int == 1
|
- check_mountinfo.stdout|int == 1
|
||||||
|
|
@ -664,29 +664,29 @@
|
||||||
- test_file_stat['stat']['exists']
|
- test_file_stat['stat']['exists']
|
||||||
- ephemeral_mount_b_info is failed
|
- ephemeral_mount_b_info is failed
|
||||||
|
|
||||||
- name: Unmount FS with state = unmounted
|
- name: Unmount FS with state = unmounted
|
||||||
ansible.posix.mount:
|
ansible.posix.mount:
|
||||||
path: /tmp/myfs
|
path: /tmp/myfs
|
||||||
state: unmounted
|
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:
|
ansible.builtin.stat:
|
||||||
path: "{{ ephemeral_fstab }}"
|
path: "{{ ephemeral_fstab }}"
|
||||||
register: fstab_stat_after_unmount
|
register: fstab_stat_after_unmount
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Try to stat our test file
|
- name: Try to stat our test file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /tmp/myfs/test_file
|
path: /tmp/myfs/test_file
|
||||||
register: test_file_stat
|
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:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- check_mountinfo.stdout|int == 0
|
- check_mountinfo.stdout|int == 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue