Skip to content

Commit

Permalink
Added assertion to check sugroup exists
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Bolwell <[email protected]>
  • Loading branch information
uk-bolly committed Jun 9, 2021
1 parent 484fc7e commit 8fbf697
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@
- rhel7cis_set_boot_pass
- rhel7cis_rule_1_5_1

- name: "check sugroup exists if used"
block:
- name: "Check su group exists if defined"
command: grep -w "{{ rhel7cis_sugroup }}" /etc/group
register: sugroup_exists
changed_when: false
failed_when: sugroup_exists.rc >= 2
tags:
- skip_ansible_lint

- name: Check sugroup if defined exists before continuing
assert:
that: sugroup_exists.rc == '0'

This comment has been minimized.

Copy link
@shk3bq4d

shk3bq4d Jun 30, 2021

I believe you should remove the single quotes around zero

This comment has been minimized.

Copy link
@shk3bq4d

shk3bq4d Jun 30, 2021

@uk-bolly (no sure if it's important to add the forgotten handle in my previous comment)

msg: "The variable rhel7cis_sugroup is defined but does not exist please rectify"
when:
- rhel7cis_sugroup is defined
- rhel7cis_rule_5_6
tags:
- rule_5.6

- include: check_prereqs.yml
tags:
- always
Expand Down

0 comments on commit 8fbf697

Please sign in to comment.