From fc06d1ba9b37247c638c67bbf0def181ab47145b Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 10 Sep 2026 21:40:31 +0200 Subject: [PATCH] docs: fix the galaxy badge and describe the tests The badge referenced the role id 58433 and linked to the unrelated role networking_role, so it neither showed the download count of this role nor led anywhere useful. The heading is aligned with the galaxy role name as well. Co-authored-by: Copilot --- README.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c5f2078..8ab79e7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# sudo_users +# volker-raschek.sudo -[![Ansible Role](https://img.shields.io/ansible/role/d/58433)](https://galaxy.ansible.com/volker_raschek/networking_role) +![Ansible Role](https://img.shields.io/ansible/role/d/volker-raschek/sudo) With following role can be created sudoers files in `/etc/sudoers.d`. For example to grant a user special perimssions to execute a program as root. @@ -18,6 +18,42 @@ example to grant a user special perimssions to execute a program as root. - Installing sudo - Configuring drop-on files in `/etc/sudoers.d` +## Tests + +The role is tested with [Molecule](https://ansible.readthedocs.io/projects/molecule/). The scenario starts one docker +container per supported distribution family, applies the role, asserts that a second run reports no change and finally +verifies the created drop-in files, their permissions and content, that a rule declared as `absent` is gone again and +that `visudo` accepts the resulting configuration. + +Molecule ships only its `default` driver, therefore `docker` is required beside molecule itself. The collections are +declared in `molecule/default/collections.yml` and installed by molecule. + +```bash +pip install molecule docker +``` + +The complete sequence creates the containers, tests them and removes them afterwards. + +```bash +molecule test +``` + +While working on the role the containers are better kept alive. + +```bash +# create the containers and apply the role +molecule converge + +# run the assertions of molecule/default/verify.yml against the running containers +molecule verify + +# open a shell in one of the containers +molecule login --host sudo-debian + +# remove the containers +molecule destroy +``` + ## Configuring In the default directory are examples how to configure the network stack. Copy the