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,8 +20,9 @@
register: result
- name: Get the file content
ansible.builtin.shell: set -o pipefail && cat "{{ output_dir | expanduser }}/authorized_keys" | fgrep DATA_BASIC
executable: /bin/bash
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,8 +240,9 @@
- 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
executable: /bin/bash
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,8 +103,9 @@
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
executable: /bin/bash
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,8 +273,9 @@
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-"
executable: /bin/bash
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,8 +289,9 @@
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-"
executable: /bin/bash
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,8 +307,9 @@
opts: rw,noexec
- name: Get remounted options (Linux only)
ansible.builtin.shell: set -o pipefail && mount | grep myfs | grep -E -w 'noexec' | wc -l
executable: /bin/bash
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,8 +577,9 @@
register: fstab_stat_after_mount
- name: Get mountinfo
ansible.builtin.shell: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
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,8 +591,9 @@
- 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'
executable: /bin/bash
ansible.builtin.shell:
cmd: set -o pipefail && mount -v | grep '/tmp/myfs'
executable: /bin/bash
register: ephemeral_mount_record_1
changed_when: false
@ -601,14 +607,16 @@
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'
executable: /bin/bash
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
executable: /bin/bash
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,14 +638,16 @@
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'
executable: /bin/bash
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
executable: /bin/bash
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,8 +675,9 @@
register: fstab_stat_after_unmount
- name: Get mountinfo
ansible.builtin.shell: set -o pipefail && mount -v | awk '{print $3}' | grep '^/tmp/myfs$' | wc -l
executable: /bin/bash
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,14 +29,16 @@
- 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'
executable: /bin/bash
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
executable: /bin/bash
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')
- name: Set flag and don't keep it persistent
@ -46,8 +48,9 @@
register: output
- name: Get getsebool output
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
executable: /bin/bash
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,8 +68,9 @@
state: false
- name: Get getsebool output
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
executable: /bin/bash
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,8 +91,9 @@
register: output
- name: Get getsebool output
ansible.builtin.shell: set -o pipefail && semanage boolean -l | grep 'httpd_can_network_connect\W'
executable: /bin/bash
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,8 +65,9 @@
verbosity: 1
- name: Get file content
ansible.builtin.shell: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
executable: /bin/bash
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,8 +102,9 @@
register: sysctl_test2
- name: Get file content
ansible.builtin.shell: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
executable: /bin/bash
ansible.builtin.shell:
cmd: set -o pipefail && cat {{ output_dir_test }}/sysctl.conf | egrep -v ^\#
executable: /bin/bash
changed_when: false
register: sysctl_content2