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,8 +20,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: content
|
register: content
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,8 +240,9 @@
|
||||||
- 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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: content
|
register: content
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount | grep mount_dest | grep -E -w '(ro|read-only)' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: remount_options
|
register: remount_options
|
||||||
|
|
||||||
|
|
@ -272,8 +273,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: last_write_time
|
register: last_write_time
|
||||||
|
|
||||||
|
|
@ -287,8 +289,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: "set -o pipefail && dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-"
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: last_write_time2
|
register: last_write_time2
|
||||||
|
|
||||||
|
|
@ -304,8 +307,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount | grep myfs | grep -E -w 'noexec' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: remounted_options
|
register: remounted_options
|
||||||
|
|
||||||
|
|
@ -573,8 +577,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
@ -586,8 +591,9 @@
|
||||||
- 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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
|
executable: /bin/bash
|
||||||
register: ephemeral_mount_record_1
|
register: ephemeral_mount_record_1
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
@ -601,14 +607,16 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
|
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
@ -630,14 +638,16 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
|
||||||
|
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
@ -665,8 +675,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
|
||||||
|
executable: /bin/bash
|
||||||
register: check_mountinfo
|
register: check_mountinfo
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,16 @@
|
||||||
- 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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
|
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && setsebool -P httpd_can_network_connect 0
|
||||||
|
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')
|
||||||
|
|
||||||
- name: Set flag and don't keep it persistent
|
- name: Set flag and don't keep it persistent
|
||||||
|
|
@ -46,8 +48,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
||||||
|
|
@ -65,8 +68,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
||||||
|
|
@ -87,8 +91,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: getsebool_output
|
register: getsebool_output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: sysctl_content0
|
register: sysctl_content0
|
||||||
|
|
||||||
|
|
@ -101,8 +102,9 @@
|
||||||
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:
|
||||||
executable: /bin/bash
|
cmd: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: sysctl_content2
|
register: sysctl_content2
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue