sudoers: fix handling of state: absent (#4852) (#4853) (#4858)

* sudoers: fix handling of state: absent (#4852)

* typo fixes

(cherry picked from commit 44e21dd407)

Co-authored-by: s-hamann <10639154+s-hamann@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-06-19 15:48:50 +02:00 committed by GitHub
commit c581daa48a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View file

@ -135,6 +135,18 @@
register: revoke_rule_1_stat
- name: Revoke non-existing rule
community.general.sudoers:
name: non-existing-rule
state: absent
register: revoke_non_existing_rule
- name: Stat non-existing rule
ansible.builtin.stat:
path: "{{ sudoers_path }}/non-existing-rule"
register: revoke_non_existing_rule_stat
# Run assertions
- name: Check rule 1 file stat
@ -151,6 +163,7 @@
- rule_1_again is not changed
- rule_5 is changed
- revoke_rule_1 is changed
- revoke_non_existing_rule is not changed
- name: Check contents
ansible.builtin.assert:
@ -166,3 +179,4 @@
ansible.builtin.assert:
that:
- not revoke_rule_1_stat.stat.exists
- not revoke_non_existing_rule_stat.stat.exists