From 96947faa0af0c4aa0c2e6a26641ff704bd13934d Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Tue, 17 Oct 2023 17:23:32 +0200 Subject: [PATCH] Add failing test --- molecule/deletion/molecule.yml | 2 +- molecule/deletion/prepare.yml | 7 +++++++ molecule/deletion/verify.yml | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/molecule/deletion/molecule.yml b/molecule/deletion/molecule.yml index 86935c6..5e503eb 100644 --- a/molecule/deletion/molecule.yml +++ b/molecule/deletion/molecule.yml @@ -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" diff --git a/molecule/deletion/prepare.yml b/molecule/deletion/prepare.yml index 691e8cb..7ca63e9 100644 --- a/molecule/deletion/prepare.yml +++ b/molecule/deletion/prepare.yml @@ -16,3 +16,10 @@ loop: - "charlie" - "dave" + - "erwin" + + - name: Grant sudo privileges to erwin + user: + name: "erwin" + groups: sudo + append: yes diff --git a/molecule/deletion/verify.yml b/molecule/deletion/verify.yml index 3a553ce..4470b43 100644 --- a/molecule/deletion/verify.yml +++ b/molecule/deletion/verify.yml @@ -18,3 +18,13 @@ database: passwd fail_key: true key: dave + + - name: Get sudo group members + command: getent group sudo + register: sudo_group + changed_when: false + + - name: Assert 'erwin' is not in 'sudo' group + assert: + that: + - "'erwin' not in sudo_group.stdout"