Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
andyundso committed Oct 17, 2023
1 parent 38fbb2f commit b5ffc51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion molecule/deletion/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ provisioner:
all:
linux_accounts_additional_users: { "bob": "bobssshkey" }

linux_accounts_default_users: { "alice": "alicessshkey" }
linux_accounts_default_users: { "alice": "alicessshkey", "erwin": "erwinsshkey" }

linux_accounts_additional_sudo_users:
- "bob"
Expand Down
7 changes: 7 additions & 0 deletions molecule/deletion/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@
loop:
- "charlie"
- "dave"
- "erwin"

- name: Grant sudo privileges to erwin
user:
name: "erwin"
groups: sudo
append: yes
12 changes: 12 additions & 0 deletions molecule/deletion/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,15 @@
database: passwd
fail_key: true
key: dave

- name: Get sudo group members
getent:
database: group
key: sudo
register: sudo_group
changed_when: false

- name: Assert 'erwin' is not in 'sudo' group
assert:
that:
- "'erwin' not in sudo_group['ansible_facts']['getent_group']['sudo'][2].split(',')" # Index 2 typically holds the user list for the group.

0 comments on commit b5ffc51

Please sign in to comment.