helps to invoke the module correctly

Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
Adam Miller 2023-12-04 17:20:23 -06:00
parent e7f7a1533a
commit 16aca83397
5 changed files with 60 additions and 40 deletions

View file

@ -20,7 +20,8 @@
register: result
- 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
changed_when: false
register: content

View file

@ -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\""
- 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
changed_when: false
register: content

View file

@ -103,7 +103,8 @@
register: bind_result_freebsd
- 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
changed_when: false
register: remount_options
@ -272,7 +273,8 @@
state: mounted
- 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
changed_when: false
register: last_write_time
@ -287,7 +289,8 @@
state: remounted
- 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
changed_when: false
register: last_write_time2
@ -304,7 +307,8 @@
opts: rw,noexec
- 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
changed_when: false
register: remounted_options
@ -573,7 +577,8 @@
register: fstab_stat_after_mount
- 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
register: check_mountinfo
changed_when: false
@ -586,7 +591,8 @@
- fstab_stat_before_mount['stat']['checksum'] == fstab_stat_after_mount['stat']['checksum']
- 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
register: ephemeral_mount_record_1
changed_when: false
@ -601,13 +607,15 @@
register: ephemeral_mount_info
- 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
register: ephemeral_mount_record_2
changed_when: false
- 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
register: check_mountinfo
changed_when: false
@ -630,13 +638,15 @@
ignore_errors: true
- 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
register: ephemeral_mount_record_3
changed_when: false
- 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
register: check_mountinfo
changed_when: false
@ -665,7 +675,8 @@
register: fstab_stat_after_unmount
- 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
register: check_mountinfo
changed_when: false

View file

@ -29,13 +29,15 @@
- ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=')
- 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
changed_when: false
register: getsebool_output_preflight
- 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
changed_when: getsebool_output_preflight.stdout.startswith('httpd_can_network_connect --> on')
@ -46,7 +48,8 @@
register: 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
changed_when: false
register: getsebool_output
@ -65,7 +68,8 @@
state: false
- 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
changed_when: false
register: getsebool_output
@ -87,7 +91,8 @@
register: 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
changed_when: false
register: getsebool_output

View file

@ -65,7 +65,8 @@
verbosity: 1
- 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
changed_when: false
register: sysctl_content0
@ -101,7 +102,8 @@
register: sysctl_test2
- 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
changed_when: false
register: sysctl_content2