mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Update main.yml
This commit is contained in:
parent
23fadc9f02
commit
606e3cfe07
1 changed files with 10 additions and 7 deletions
|
|
@ -1,10 +1,3 @@
|
||||||
- name: System details
|
|
||||||
debug: msg="{{ item }}"
|
|
||||||
with_items:
|
|
||||||
- "{{ ansible_distribution }}"
|
|
||||||
- "{{ ansible_system }}"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create the mount point
|
- name: Create the mount point
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
|
|
@ -268,7 +261,9 @@
|
||||||
|
|
||||||
- name: Create empty file
|
- name: Create empty file
|
||||||
command: dd if=/dev/zero of=/tmp/myfs.img bs=1048576 count=20
|
command: dd if=/dev/zero of=/tmp/myfs.img bs=1048576 count=20
|
||||||
|
|
||||||
- name: Format FS
|
- name: Format FS
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
community.general.system.filesystem:
|
community.general.system.filesystem:
|
||||||
fstype: ext3
|
fstype: ext3
|
||||||
dev: /tmp/myfs.img
|
dev: /tmp/myfs.img
|
||||||
|
|
@ -279,23 +274,28 @@
|
||||||
src: /tmp/myfs.img
|
src: /tmp/myfs.img
|
||||||
fstype: ext2
|
fstype: ext2
|
||||||
state: mounted
|
state: mounted
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Get the last write time
|
- name: Get the last write time
|
||||||
shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-'
|
shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-'
|
||||||
register: last_write_time
|
register: last_write_time
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Wait 2 second
|
- name: Wait 2 second
|
||||||
pause:
|
pause:
|
||||||
seconds: 2
|
seconds: 2
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Test if the FS is remounted
|
- name: Test if the FS is remounted
|
||||||
mount:
|
mount:
|
||||||
path: /tmp/myfs
|
path: /tmp/myfs
|
||||||
state: remounted
|
state: remounted
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Get again the last write time
|
- name: Get again the last write time
|
||||||
shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-'
|
shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-'
|
||||||
register: last_write_time2
|
register: last_write_time2
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Fail if they are the same
|
- name: Fail if they are the same
|
||||||
fail:
|
fail:
|
||||||
|
|
@ -329,11 +329,13 @@
|
||||||
state: mounted
|
state: mounted
|
||||||
backup: yes
|
backup: yes
|
||||||
register: mount_backup_out
|
register: mount_backup_out
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: ensure backup_file in returned output
|
- name: ensure backup_file in returned output
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'backup_file' in mount_backup_out"
|
- "'backup_file' in mount_backup_out"
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Umount the test FS
|
- name: Umount the test FS
|
||||||
|
|
@ -342,6 +344,7 @@
|
||||||
src: /tmp/myfs.img
|
src: /tmp/myfs.img
|
||||||
opts: loop
|
opts: loop
|
||||||
state: absent
|
state: absent
|
||||||
|
when: ansible_system in ('Linux')
|
||||||
|
|
||||||
- name: Remove the test FS
|
- name: Remove the test FS
|
||||||
file:
|
file:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue