mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-13 08:05:19 +01:00
helps to invoke the module correctly
Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
e7f7a1533a
commit
16aca83397
5 changed files with 60 additions and 40 deletions
|
|
@ -20,7 +20,8 @@
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Get the file content
|
- name: Get the file content
|
||||||
ansible.builtin.shell: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: content
|
register: content
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,8 @@
|
||||||
- result.key_options == "no-agent-forwarding,no-X11-forwarding,permitopen=\"10.9.8.1:8080\",permitopen=\"10.9.8.1:9001\""
|
- result.key_options == "no-agent-forwarding,no-X11-forwarding,permitopen=\"10.9.8.1:8080\",permitopen=\"10.9.8.1:9001\""
|
||||||
|
|
||||||
- name: Get the file content
|
- name: Get the file content
|
||||||
ansible.builtin.shell: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: content
|
register: content
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,8 @@
|
||||||
register: bind_result_freebsd
|
register: bind_result_freebsd
|
||||||
|
|
||||||
- name: Get mount options
|
- name: Get mount options
|
||||||
ansible.builtin.shell: set -o pipefail && mount | grep mount_dest | grep -E -w '(ro|read-only)' | wc -l
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && mount | grep mount_dest | grep -E -w '(ro|read-only)' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: remount_options
|
register: remount_options
|
||||||
|
|
@ -272,7 +273,8 @@
|
||||||
state: mounted
|
state: mounted
|
||||||
|
|
||||||
- name: Get the last write time
|
- name: Get the last write time
|
||||||
ansible.builtin.shell: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
ansible.builtin.shell:
|
||||||
|
cmd: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: last_write_time
|
register: last_write_time
|
||||||
|
|
@ -287,7 +289,8 @@
|
||||||
state: remounted
|
state: remounted
|
||||||
|
|
||||||
- name: Get again the last write time
|
- name: Get again the last write time
|
||||||
ansible.builtin.shell: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
ansible.builtin.shell:
|
||||||
|
cmd: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: last_write_time2
|
register: last_write_time2
|
||||||
|
|
@ -304,7 +307,8 @@
|
||||||
opts: rw,noexec
|
opts: rw,noexec
|
||||||
|
|
||||||
- name: Get remounted options (Linux only)
|
- name: Get remounted options (Linux only)
|
||||||
ansible.builtin.shell: set -o pipefail && mount | grep myfs | grep -E -w 'noexec' | wc -l
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && mount | grep myfs | grep -E -w 'noexec' | wc -l
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: remounted_options
|
register: remounted_options
|
||||||
|
|
@ -573,7 +577,8 @@
|
||||||
register: fstab_stat_after_mount
|
register: fstab_stat_after_mount
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
ansible.builtin.shell:
|
||||||
|
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
|
||||||
|
|
@ -586,7 +591,8 @@
|
||||||
- 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: set -o pipefail && mount -v | grep '/tmp/myfs'
|
ansible.builtin.shell:
|
||||||
|
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
|
||||||
|
|
@ -601,13 +607,15 @@
|
||||||
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: set -o pipefail && mount -v | grep '/tmp/myfs'
|
ansible.builtin.shell:
|
||||||
|
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: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
ansible.builtin.shell:
|
||||||
|
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
|
||||||
|
|
@ -630,13 +638,15 @@
|
||||||
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: set -o pipefail && mount -v | grep '/tmp/myfs'
|
ansible.builtin.shell:
|
||||||
|
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: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
ansible.builtin.shell:
|
||||||
|
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
|
||||||
|
|
@ -665,7 +675,8 @@
|
||||||
register: fstab_stat_after_unmount
|
register: fstab_stat_after_unmount
|
||||||
|
|
||||||
- name: Get mountinfo
|
- name: Get mountinfo
|
||||||
ansible.builtin.shell: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
ansible.builtin.shell:
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,15 @@
|
||||||
- ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=')
|
- ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=')
|
||||||
|
|
||||||
- name: Get getsebool output preflight
|
- name: Get getsebool output preflight
|
||||||
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output_preflight
|
register: getsebool_output_preflight
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
ansible.builtin.shell: set -o pipefail && setsebool -P httpd_can_network_connect 0
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && setsebool -P httpd_can_network_connect 0
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: getsebool_output_preflight.stdout.startswith('httpd_can_network_connect --> on')
|
changed_when: getsebool_output_preflight.stdout.startswith('httpd_can_network_connect --> on')
|
||||||
|
|
||||||
|
|
@ -46,7 +48,8 @@
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Get getsebool output
|
- name: Get getsebool output
|
||||||
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
@ -65,7 +68,8 @@
|
||||||
state: false
|
state: false
|
||||||
|
|
||||||
- name: Get getsebool output
|
- name: Get getsebool output
|
||||||
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
@ -87,7 +91,8 @@
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Get getsebool output
|
- name: Get getsebool output
|
||||||
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
|
|
||||||
- name: Get file content
|
- name: Get file content
|
||||||
ansible.builtin.shell: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: sysctl_content0
|
register: sysctl_content0
|
||||||
|
|
@ -101,7 +102,8 @@
|
||||||
register: sysctl_test2
|
register: sysctl_test2
|
||||||
|
|
||||||
- name: Get file content
|
- name: Get file content
|
||||||
ansible.builtin.shell: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
ansible.builtin.shell:
|
||||||
|
cmd: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: sysctl_content2
|
register: sysctl_content2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue