94 Commits
Author SHA1 Message Date
volker.raschekandCopilot efc8ac8f0b fix(molecule): avoid partial upgrades on Arch
Ansible Linter / ansible-lint (push) Successful in 1m1s
Lint Markdown files / markdown-lint (push) Successful in 6s
Molecule / Molecule (push) Successful in 4m12s
Release Ansible Role / Release Ansible Role (push) Successful in 1m25s
Upgrade installed packages with the bootstrap dependencies to avoid
OpenSSL file conflicts on the Arch base image.

Co-authored-by: Copilot <copilot@github.com>
2026-11-19 15:54:17 +01:00
volker.raschekandCopilot 6940ec8465 test: verify unmanaged sudoers files survive
Ansible Linter / ansible-lint (push) Successful in 1m18s
Lint Markdown files / markdown-lint (push) Successful in 6s
Molecule / Molecule (push) Failing after 2m41s
Release Ansible Role / Release Ansible Role (push) Successful in 1m20s
Guard against regressions that remove the login user’s sudo access.
Verify that only a drop-in marked state: absent is removed.

Co-authored-by: Copilot <copilot@github.com>
2026-11-19 15:42:26 +01:00
CSRBot 404cf6057c Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.11.0' (#45) from renovate/ansible-ansible-lint-26.x into master
Ansible Linter / ansible-lint (push) Successful in 3m2s
Lint Markdown files / markdown-lint (push) Successful in 12s
Molecule / Molecule (push) Canceled after 0s
2026-11-09 17:52:10 +00:00
CSRBot 6b1b375510 chore(deps): update ansible/ansible-lint action to v26.11.0
Ansible Linter / ansible-lint (push) Successful in 1m21s
Ansible Linter / ansible-lint (pull_request) Successful in 1m5s
Lint Markdown files / markdown-lint (push) Successful in 6s
Lint Markdown files / markdown-lint (pull_request) Successful in 6s
Molecule / Molecule (push) Successful in 3m57s
Molecule / Molecule (pull_request) Successful in 3m51s
2026-11-09 17:16:25 +00:00
volker.raschekandCopilot 851d57e6a2 fix(ci): use renamed ansible-lint configuration
Ansible Linter / ansible-lint (push) Successful in 3m4s
Lint Markdown files / markdown-lint (push) Successful in 13s
Molecule / Molecule (push) Successful in 4m20s
Point the Gitea lint workflow at .ansible-lint.yml so it can load the renamed configuration.

Co-authored-by: Copilot <copilot@github.com>
2026-10-18 14:51:01 +02:00
volker.raschekandCopilot f22699732a chore: rename ansible-lint configuration
Lint Markdown files / markdown-lint (push) Successful in 6s
Ansible Linter / ansible-lint (push) Failing after 1m48s
Molecule / Molecule (push) Successful in 4m17s
Use a YAML extension for explicit file type detection.

Co-authored-by: Copilot <copilot@github.com>
2026-10-18 14:44:41 +02:00
CSRBot 39767a661d Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.10.1' (#44) from renovate/ansible-ansible-lint-26.x into master
Ansible Linter / ansible-lint (push) Successful in 4m28s
Lint Markdown files / markdown-lint (push) Successful in 15s
Molecule / Molecule (push) Successful in 5m35s
2026-10-13 13:49:20 +00:00
CSRBot eb4e80cc9a chore(deps): update ansible/ansible-lint action to v26.10.1
Ansible Linter / ansible-lint (pull_request) Successful in 6m14s
Lint Markdown files / markdown-lint (pull_request) Successful in 9s
Lint Markdown files / markdown-lint (push) Successful in 12s
Ansible Linter / ansible-lint (push) Successful in 4m44s
Molecule / Molecule (pull_request) Successful in 14m50s
Molecule / Molecule (push) Successful in 29m25s
2026-10-13 13:20:53 +00:00
CSRBot cdd99498a2 Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.10.0' (#43) from renovate/ansible-ansible-lint-26.x into master
Ansible Linter / ansible-lint (push) Successful in 6m20s
Lint Markdown files / markdown-lint (push) Successful in 18s
Molecule / Molecule (push) Successful in 5m42s
2026-10-12 10:45:55 +00:00
CSRBot d7775bbbf9 chore(deps): update ansible/ansible-lint action to v26.10.0
Ansible Linter / ansible-lint (pull_request) Successful in 4m15s
Ansible Linter / ansible-lint (push) Successful in 3m36s
Lint Markdown files / markdown-lint (pull_request) Successful in 12s
Lint Markdown files / markdown-lint (push) Successful in 14s
Molecule / Molecule (pull_request) Successful in 6m7s
Molecule / Molecule (push) Successful in 5m42s
2026-10-12 10:13:04 +00:00
CSRBot 0a4207cc8f Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.9.0' (#42) from renovate/ansible-ansible-lint-26.x into master
Ansible Linter / ansible-lint (push) Successful in 2m1s
Lint Markdown files / markdown-lint (push) Successful in 12s
Molecule / Molecule (push) Successful in 3m59s
2026-09-22 19:24:28 +00:00
CSRBot c5cd0676e5 chore(deps): update ansible/ansible-lint action to v26.9.0
Ansible Linter / ansible-lint (pull_request) Successful in 2m27s
Lint Markdown files / markdown-lint (push) Successful in 12s
Lint Markdown files / markdown-lint (pull_request) Successful in 12s
Ansible Linter / ansible-lint (push) Successful in 1m41s
Molecule / Molecule (push) Successful in 3m50s
Molecule / Molecule (pull_request) Successful in 3m54s
2026-09-22 19:11:37 +00:00
CSRBot a7c07b143e Merge pull request 'chore(deps): update actions/checkout action to v7' (#41) from renovate/actions-checkout-7.x into master
Lint Markdown files / markdown-lint (push) Successful in 7s
Ansible Linter / ansible-lint (push) Successful in 3m24s
Molecule / Molecule (push) Successful in 5m30s
2026-09-15 19:31:34 +00:00
CSRBot c69f4357bc chore(deps): update actions/checkout action to v7
Ansible Linter / ansible-lint (pull_request) Successful in 3m24s
Lint Markdown files / markdown-lint (pull_request) Successful in 13s
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 3m21s
Molecule / Molecule (pull_request) Successful in 6m3s
Molecule / Molecule (push) Successful in 5m52s
2026-09-15 19:15:03 +00:00
volker.raschekandCopilot f665e0044a refactor: use the yml extension for every yaml file
Lint Markdown files / markdown-lint (push) Successful in 6s
Ansible Linter / ansible-lint (push) Canceled after 1h1m39s
Molecule / Molecule (push) Successful in 6m18s
The repository mixed both extensions, the molecule scenario used yml while the role itself used yaml. The yml
extension is the one ansible-galaxy and molecule generate and the one the sibling roles use, so it is applied
throughout.

The first_found lookups in tasks/main.yml name the candidate files explicitly and were adjusted accordingly, otherwise
the role would no longer find its distribution variables and its verification tasks.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:57:15 +02:00
volker.raschekandCopilot fc06d1ba9b docs: fix the galaxy badge and describe the tests
Lint Markdown files / markdown-lint (push) Failing after 1m1s
Molecule / Molecule (push) Failing after 1m6s
Ansible Linter / ansible-lint (push) Failing after 1m8s
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 <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot ee977a8610 fix(ci): pin actions to their commit sha
Floating tags let a compromised or force pushed release change what the workflows execute. Pinning the actions to a
commit sha and restricting the default token to read access limits the blast radius of a supply chain attack. The
outdated ansible-lint and markdownlint-cli2 versions are raised along with the pinning.

The ansible-lint run installs the collections of the molecule scenario, because the scenario is linted as well and
depends on community.docker beside the community.general requirement of the role.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot e2f248e28d test: verify the role with molecule
The role was not covered by any automated test, so regressions in the drop-in file handling only surfaced on real
hosts. The scenario starts one container per supported distribution family and covers all four conditional branches of
tasks/main.yaml: a user, a user acting as another user, a group and a group acting as another user.

Beside the created rules the verification asserts that a rule declared as absent is removed again, that the drop-in
directory is included exactly once and that visudo accepts the resulting configuration, because a rejected drop-in file
invalidates every rule of the directory.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 0cb76c4bc8 feat(meta): document sudo_users_sudoers via argument specs
The only variable of the role was documented in defaults/main.yaml comments alone. An argument spec makes the variable
discoverable through ansible-doc and lets ansible reject a wrong type early.

The entries are intentionally left without suboptions. Argument spec validation fills missing suboptions with none,
which would turn the item.user | default('') | length conditions in tasks/main.yaml into a runtime error.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 1e70b5f11f fix(meta): declare Debian as supported platform
The role ships vars/Debian.yaml and the README lists Debian, but the galaxy metadata did not advertise the platform, so
Ansible Galaxy hid the role from users searching for Debian.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 3947d4e30a style(yamllint): add document start marker
The yamllint configuration enabled the default rule set, which includes document-start, but omitted the marker in its
own file. Linting the repository therefore reported a violation in the configuration itself.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 50ab126130 fix(tasks): fall back to user or group for empty filename
The default filter only replaces undefined values unless its boolean flag is
enabled. An entry with 'filename: ""' - as documented in defaults/main.yaml -
therefore produced a sudoers drop-in file without a name. Enabling the flag
makes the role fall back to the user or group name for empty filenames as
well.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 09f4b9fe4c fix(tasks): match entries with empty user, group or runas values
The conditions relied on 'is defined' and 'is not defined'. An entry which
declares the unused key with an empty string - as documented in
defaults/main.yaml - matched none of the four tasks, so the sudoers drop-in
file was silently not created. Comparing the length of the defaulted values
instead makes exactly one task apply to every entry accepted by the
validation.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot c5011457e9 fix(meta): raise min_ansible_version to 2.11
Ansible 2.9 can neither resolve the used fully qualified collection names
reliably nor ship the community.general.sudoers module, which requires
ansible-base 2.10 or newer. Align the requirement with the sibling role
unix-users, which already declares 2.11.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot fec90dc9be feat: declare community.general collection requirement
The role uses the community.general.sudoers module, but did not declare the
collection dependency like the sibling roles unix-users and
certificate_authority do. The sudoers module was added in community.general
4.3.0, its runas parameter in 4.7.0, therefore 4.7.0 is the lowest usable
version.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot d2e4036430 fix(tasks): match @includedir directive in /etc/sudoers
The regular expression required a leading hash, but sudo 1.9.1 introduced @includedir and distributions such as
Debian 12, Ubuntu 22.04, RHEL 9 and Arch Linux ship /etc/sudoers with that syntax. Since the existing line was never
matched, lineinfile appended a second directive and /etc/sudoers.d was included twice.

The dot in sudoers.d is escaped as well, so the expression no longer matches unrelated paths.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot c3f714a7c6 fix(tasks)!: stop flushing /etc/sudoers.d
Recreating /etc/sudoers.d on every run deleted every drop-in file on the host, not only the ones managed by this role.
That removes files shipped by packages or other tooling, such as 90-cloud-init-users on cloud instances, which can lock
out the remaining login paths. The task also reported changed on every run and therefore made check mode and CI runs
useless for detecting real drift.

The directory is now only ensured with its owner, group and permissions. To keep entries removable, each item of
sudo_users_sudoers accepts an optional state, which is passed to community.general.sudoers and defaults to present.

BREAKING CHANGE: Entries dropped from sudo_users_sudoers are no longer deleted implicitly. Set state: absent on the
entry to remove its drop-in file.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
volker.raschekandCopilot 7c76a5cc86 fix(tasks): include verify_vars.yaml as tasks file
The variable verification was included via include_vars, which is meant for variable files only. Additionally the
first_found lookup had no paths defined, so it searched the files/ subdirectory and the role root instead of tasks/ and
failed with "No file was found". Switching to include_tasks and adding the tasks path makes the verification run at all.

The assertion itself was fully commented out and is now active, so a misconfigured entry fails early instead of being
silently skipped by all four sudoers tasks.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00
CSRBot fae902ac46 Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.8.0' (#40) from renovate/ansible-ansible-lint-26.x into master
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 33s
2026-08-12 09:14:12 +00:00
CSRBot 327ef710fd chore(deps): update ansible/ansible-lint action to v26.8.0
Ansible Linter / ansible-lint (pull_request) Successful in 1m29s
Ansible Linter / ansible-lint (push) Successful in 44s
Lint Markdown files / markdown-lint (pull_request) Successful in 12s
Lint Markdown files / markdown-lint (push) Successful in 6s
2026-08-12 09:02:35 +00:00
CSRBot 4982345ed7 Merge pull request 'chore(deps): update actions/checkout action to v6.1.0' (#39) from renovate/actions-checkout-6.x into master
Ansible Linter / ansible-lint (push) Successful in 30s
Lint Markdown files / markdown-lint (push) Successful in 7s
2026-07-20 18:20:09 +00:00
CSRBot 975791382c chore(deps): update actions/checkout action to v6.1.0
Ansible Linter / ansible-lint (pull_request) Successful in 46s
Lint Markdown files / markdown-lint (pull_request) Successful in 6s
Lint Markdown files / markdown-lint (push) Successful in 6s
Ansible Linter / ansible-lint (push) Successful in 1m38s
2026-07-20 18:02:54 +00:00
CSRBot ca8d8c83de Merge pull request 'chore(deps): pin dependencies' (#37) from renovate/pin-dependencies into master
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 29s
2026-07-03 00:02:23 +00:00
CSRBot 5189976a74 chore(deps): pin dependencies
Ansible Linter / ansible-lint (push) Successful in 26s
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (pull_request) Successful in 26s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
2026-07-02 21:03:06 +00:00
CSRBot 3b726024a6 Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.6.0' (#38) from renovate/ansible-ansible-lint-26.x into master
Ansible Linter / ansible-lint (push) Successful in 33s
Lint Markdown files / markdown-lint (push) Successful in 5s
2026-07-02 18:33:16 +00:00
CSRBot c5e66cd04a chore(deps): update ansible/ansible-lint action to v26.6.0
Ansible Linter / ansible-lint (pull_request) Successful in 1m20s
Lint Markdown files / markdown-lint (pull_request) Successful in 11s
Lint Markdown files / markdown-lint (push) Successful in 11s
Ansible Linter / ansible-lint (push) Successful in 1m3s
2026-07-02 18:02:54 +00:00
CSRBot fcc5ba6efa Merge pull request 'chore(deps): update davidanson/markdownlint-cli2-action action to v23' (#33) from renovate/davidanson-markdownlint-cli2-action-23.x into master
Lint Markdown files / markdown-lint (push) Successful in 6s
Ansible Linter / ansible-lint (push) Failing after 10s
2026-06-04 15:16:55 +00:00
CSRBot dfc4688504 chore(deps): update davidanson/markdownlint-cli2-action action to v23
Lint Markdown files / markdown-lint (pull_request) Successful in 6s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (pull_request) Successful in 1m7s
Ansible Linter / ansible-lint (push) Successful in 32s
2026-06-04 15:02:53 +00:00
CSRBot 0343b47905 Merge pull request 'chore(deps): update actions/checkout action to v6.0.3' (#32) from renovate/actions into master
Ansible Linter / ansible-lint (push) Failing after 9s
Lint Markdown files / markdown-lint (push) Successful in 4s
2026-06-02 15:15:16 +00:00
CSRBot 4fc2c4ead9 chore(deps): update actions/checkout action to v6.0.3
Lint Markdown files / markdown-lint (push) Successful in 12s
Ansible Linter / ansible-lint (push) Successful in 26s
Ansible Linter / ansible-lint (pull_request) Successful in 27s
Lint Markdown files / markdown-lint (pull_request) Successful in 5s
2026-06-02 15:02:46 +00:00
CSRBot da1c02abec Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.4.0' (#31) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Failing after 8s
2026-04-14 11:06:37 +00:00
CSRBot 2ec3ab8117 chore(deps): update ansible/ansible-lint action to v26.4.0
Ansible Linter / ansible-lint (pull_request) Successful in 25s
Lint Markdown files / markdown-lint (pull_request) Successful in 6s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 1m40s
2026-04-14 10:48:14 +00:00
CSRBot 71d8b991e5 Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.3.0' (#30) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 12s
Ansible Linter / ansible-lint (push) Successful in 54s
2026-03-05 14:06:23 +00:00
CSRBot e94f04809b chore(deps): update ansible/ansible-lint action to v26.3.0
Ansible Linter / ansible-lint (pull_request) Successful in 18s
Lint Markdown files / markdown-lint (pull_request) Successful in 5s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 18s
2026-03-05 14:01:45 +00:00
CSRBot a248f96436 Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.2.0' (#29) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 18s
2026-02-25 17:23:42 +00:00
CSRBot 7b5bb365c5 chore(deps): update ansible/ansible-lint action to v26.2.0
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (pull_request) Successful in 20s
Lint Markdown files / markdown-lint (pull_request) Successful in 6s
Ansible Linter / ansible-lint (push) Successful in 54s
2026-02-25 17:18:38 +00:00
CSRBot bc059ab046 Merge pull request 'chore(deps): update actions/checkout action to v6.0.2' (#28) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 17s
2026-01-22 17:09:29 +00:00
CSRBot a2dc579d3f chore(deps): update actions/checkout action to v6.0.2
Ansible Linter / ansible-lint (pull_request) Successful in 17s
Lint Markdown files / markdown-lint (pull_request) Successful in 5s
Lint Markdown files / markdown-lint (push) Successful in 7s
Ansible Linter / ansible-lint (push) Successful in 19s
2026-01-22 17:01:36 +00:00
CSRBot 3c9568be0d Merge pull request 'chore(deps): update ansible/ansible-lint action to v26.1.1' (#27) from renovate/actions into master
Ansible Linter / ansible-lint (push) Successful in 16s
Lint Markdown files / markdown-lint (push) Successful in 5s
2026-01-16 05:05:25 +00:00
CSRBot 14756c9c10 chore(deps): update ansible/ansible-lint action to v26.1.1
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Ansible Linter / ansible-lint (push) Successful in 16s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Lint Markdown files / markdown-lint (push) Successful in 5s
2026-01-16 05:01:18 +00:00
CSRBot 6d7abcaa79 chore(deps): update ansible/ansible-lint action to v26
Ansible Linter / ansible-lint (pull_request) Successful in 17s
Lint Markdown files / markdown-lint (pull_request) Successful in 9s
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 16s
2026-01-11 23:01:10 +00:00
volker.raschek 161d72089e fix(ci): add workflow dispatch for releases
Lint Markdown files / markdown-lint (push) Successful in 6s
Ansible Linter / ansible-lint (push) Successful in 55s
2026-01-11 21:16:09 +01:00
volker.raschek 58d25578d7 fix(ci): use dynamic github repository name
Ansible Linter / ansible-lint (push) Successful in 16s
Lint Markdown files / markdown-lint (push) Successful in 4s
2026-01-07 16:11:15 +01:00
volker.raschek 3af115d465 fix(ci): add release workflow
Ansible Linter / ansible-lint (push) Successful in 16s
Lint Markdown files / markdown-lint (push) Successful in 4s
2026-01-07 16:05:38 +01:00
volker.raschek a8e2ba74ee fix: replace deprecated INJECT_FACTS_AS_VARS
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 16s
2026-01-05 10:31:11 +01:00
volker.raschek b946da2d8d fix: replace deprecated INJECT_FACTS_AS_VARS
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 17s
2026-01-05 10:28:07 +01:00
CSRBot 79f34eb179 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.12.2' (#25) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-12-22 20:05:03 +00:00
CSRBot 8b4aa30051 chore(deps): update ansible/ansible-lint action to v25.12.2
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Lint Markdown files / markdown-lint (pull_request) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 54s
2025-12-22 20:01:22 +00:00
CSRBot 75793805af Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.12.1' (#24) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 52s
2025-12-10 14:06:32 +00:00
CSRBot a0eef04414 chore(deps): update ansible/ansible-lint action to v25.12.1
Lint Markdown files / markdown-lint (push) Successful in 4s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Ansible Linter / ansible-lint (pull_request) Successful in 54s
Ansible Linter / ansible-lint (push) Successful in 17s
2025-12-10 14:01:25 +00:00
CSRBot 29f312ef07 Merge pull request 'chore(deps): update actions/checkout action to v6' (#23) from renovate/actions-checkout-6.x into master
Ansible Linter / ansible-lint (push) Successful in 16s
Lint Markdown files / markdown-lint (push) Successful in 5s
2025-12-02 21:08:42 +00:00
CSRBot 316c642cf4 chore(deps): update actions/checkout action to v6
Ansible Linter / ansible-lint (pull_request) Successful in 17s
Lint Markdown files / markdown-lint (pull_request) Successful in 8s
Lint Markdown files / markdown-lint (push) Successful in 9s
Ansible Linter / ansible-lint (push) Successful in 17s
2025-12-02 21:01:32 +00:00
CSRBot e315f71fea Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.12.0' (#22) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 55s
2025-12-02 17:05:27 +00:00
CSRBot fc9dc7a034 chore(deps): update ansible/ansible-lint action to v25.12.0
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (pull_request) Successful in 56s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-12-02 17:01:17 +00:00
CSRBot ea17bd56a5 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.11.1' (#21) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 17s
2025-11-24 23:05:07 +00:00
CSRBot dc4e741b85 chore(deps): update ansible/ansible-lint action to v25.11.1
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 56s
2025-11-24 23:01:37 +00:00
volker.raschek 6679f1602f fix(lint): close bracket
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 55s
2025-11-23 16:21:40 +01:00
volker.raschek 6469d81fcf fix: rename files to .yaml
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Failing after 17s
2025-11-23 16:19:51 +01:00
volker.raschek f2dc0be80d fix: prepare for INJECT_FACTS_AS_VARS
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Failing after 57s
2025-11-22 23:53:42 +01:00
CSRBot 39aa914832 Merge pull request 'chore(deps): update davidanson/markdownlint-cli2-action action to v21' (#19) from renovate/davidanson-markdownlint-cli2-action-21.x into master
Ansible Linter / ansible-lint (push) Successful in 54s
Lint Markdown files / markdown-lint (push) Successful in 9s
2025-11-18 17:01:42 +00:00
CSRBot 3e6c7d3d8c chore(deps): update davidanson/markdownlint-cli2-action action to v21
Ansible Linter / ansible-lint (push) Successful in 52s
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (pull_request) Successful in 52s
Lint Markdown files / markdown-lint (pull_request) Successful in 10s
2025-11-17 20:01:11 +00:00
CSRBot 9cbaaa4589 Merge pull request 'chore(deps): update actions/checkout action to v5.0.1' (#20) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-11-17 17:18:21 +00:00
CSRBot 16ac7855c8 chore(deps): update actions/checkout action to v5.0.1
Ansible Linter / ansible-lint (pull_request) Successful in 52s
Ansible Linter / ansible-lint (push) Successful in 54s
Lint Markdown files / markdown-lint (pull_request) Successful in 11s
Lint Markdown files / markdown-lint (push) Successful in 8s
2025-11-17 17:01:55 +00:00
CSRBot 3009461188 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.11.0' (#18) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-11-10 14:07:02 +00:00
CSRBot 528420e284 chore(deps): update ansible/ansible-lint action to v25.11.0
Lint Markdown files / markdown-lint (pull_request) Successful in 9s
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Lint Markdown files / markdown-lint (push) Successful in 3s
Ansible Linter / ansible-lint (push) Successful in 53s
2025-11-10 14:01:41 +00:00
CSRBot 32e3079e08 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.9.2' (#17) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 15s
2025-10-08 13:05:53 +00:00
CSRBot 88788b7cd1 chore(deps): update ansible/ansible-lint action to v25.9.2
Lint Markdown files / markdown-lint (push) Successful in 9s
Lint Markdown files / markdown-lint (pull_request) Successful in 8s
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-10-08 13:02:14 +00:00
CSRBot da33649399 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.9.1' (#16) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-10-01 13:06:00 +00:00
CSRBot caa42a035e chore(deps): update ansible/ansible-lint action to v25.9.1
Lint Markdown files / markdown-lint (push) Successful in 12s
Ansible Linter / ansible-lint (pull_request) Successful in 15s
Lint Markdown files / markdown-lint (pull_request) Successful in 8s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-10-01 13:02:42 +00:00
CSRBot e18584824c Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.9.0' (#14) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 17s
2025-09-19 19:56:12 +00:00
CSRBot 53de3ceedf Merge pull request 'chore(deps): update actions/checkout action to v5' (#15) from renovate/actions-checkout-5.x into master
Ansible Linter / ansible-lint (push) Has been cancelled
Lint Markdown files / markdown-lint (push) Has been cancelled
2025-09-19 19:55:38 +00:00
CSRBot 53eb0f30ed chore(deps): update actions/checkout action to v5
Ansible Linter / ansible-lint (push) Successful in 15s
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (pull_request) Successful in 15s
Lint Markdown files / markdown-lint (pull_request) Successful in 3s
2025-09-18 22:03:29 +00:00
CSRBot dff5646823 chore(deps): update ansible/ansible-lint action to v25.9.0
Ansible Linter / ansible-lint (pull_request) Successful in 15s
Lint Markdown files / markdown-lint (push) Successful in 8s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 16s
2025-09-18 22:03:23 +00:00
volker.raschek 7ba49f476e chore(deps): update actions/checkout to v5.0.0
Lint Markdown files / markdown-lint (push) Successful in 9s
Ansible Linter / ansible-lint (push) Successful in 14s
2025-09-18 22:33:18 +02:00
CSRBot f09302f932 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.8.2' (#13) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 14s
2025-08-21 16:05:51 +00:00
CSRBot ff4324e0f9 chore(deps): update ansible/ansible-lint action to v25.8.2
Lint Markdown files / markdown-lint (push) Successful in 16s
Ansible Linter / ansible-lint (pull_request) Successful in 14s
Lint Markdown files / markdown-lint (pull_request) Successful in 14s
Ansible Linter / ansible-lint (push) Successful in 15s
2025-08-21 16:02:24 +00:00
CSRBot 6b809b1997 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.8.1' (#12) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 3s
Ansible Linter / ansible-lint (push) Successful in 14s
2025-08-14 01:05:17 +00:00
CSRBot 2ca8f45a61 chore(deps): update ansible/ansible-lint action to v25.8.1
Lint Markdown files / markdown-lint (push) Successful in 8s
Ansible Linter / ansible-lint (push) Successful in 14s
Lint Markdown files / markdown-lint (pull_request) Successful in 3s
Ansible Linter / ansible-lint (pull_request) Successful in 51s
2025-08-14 01:02:10 +00:00
CSRBot 9c5ad99d0f Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.8.0' (#11) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 15s
Ansible Linter / ansible-lint (push) Successful in 14s
2025-08-13 16:04:43 +00:00
CSRBot 55542cbb01 chore(deps): update ansible/ansible-lint action to v25.8.0
Lint Markdown files / markdown-lint (push) Successful in 3s
Ansible Linter / ansible-lint (pull_request) Successful in 14s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 51s
2025-08-13 16:02:05 +00:00
CSRBot f553b6faca Merge pull request 'chore(deps): update actions/checkout action to v4.3.0' (#9) from renovate/actions into master
Lint Markdown files / markdown-lint (push) Successful in 4s
Ansible Linter / ansible-lint (push) Successful in 14s
2025-08-11 13:21:32 +00:00
CSRBot c7a8d1063c chore(deps): update actions/checkout action to v4.3.0
Lint Markdown files / markdown-lint (push) Successful in 9s
Ansible Linter / ansible-lint (pull_request) Successful in 52s
Lint Markdown files / markdown-lint (pull_request) Successful in 8s
Ansible Linter / ansible-lint (push) Successful in 52s
2025-08-11 13:03:33 +00:00
volker.raschek 8160509a05 fix(ansible-galaxy): adapt indentation
Lint Markdown files / markdown-lint (push) Successful in 9s
Ansible Linter / ansible-lint (push) Successful in 52s
2025-08-06 16:10:34 +02:00
volker.raschek c4de350a3c fix(ansible-galaxy): add namespace
Lint Markdown files / markdown-lint (push) Successful in 19s
Ansible Linter / ansible-lint (push) Failing after 51s
2025-08-06 15:22:44 +02:00
24 changed files with 487 additions and 79 deletions

No files matched your search

File renamed without changes.
-20
View File
@@ -1,20 +0,0 @@
name: Ansible Linter
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
jobs:
ansible-lint:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@v25.7.0
with:
args: "--config-file .ansible-lint"
setup_python: "true"
+25
View File
@@ -0,0 +1,25 @@
name: Ansible Linter
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
permissions:
contents: read
jobs:
ansible-lint:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Run ansible-lint
uses: ansible/ansible-lint@b74fb6f73d234bf92672372cb1c10768e4018d16 # v26.11.0
with:
args: "--config-file .ansible-lint.yml"
# The molecule scenario is linted as well, so its collections are required beside the ones of the role.
requirements_file: "molecule/default/collections.yml"
setup_python: "true"
@@ -7,12 +7,15 @@ on:
branches: [ '**' ] branches: [ '**' ]
tags-ignore: [ '**' ] tags-ignore: [ '**' ]
permissions:
contents: read
jobs: jobs:
markdown-lint: markdown-lint:
runs-on: runs-on:
- ubuntu-latest - ubuntu-latest
steps: steps:
- uses: actions/checkout@v4.2.2 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0 - uses: DavidAnson/markdownlint-cli2-action@ded1f9488f68a970bc66ea5619e13e9b52e601cd # v23.2.0
with: with:
globs: '**/*.md' globs: '**/*.md'
+30
View File
@@ -0,0 +1,30 @@
name: Molecule
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
permissions:
contents: read
jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest-amd64
steps:
# The scenario includes the role by its name, so the directory must be named like the role and not like the
# repository. Its parent is used as roles path.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: sudo
- name: Install molecule
run: |
apt update --yes
apt install --yes python3-pip
pip3 install --break-system-packages molecule docker
- name: Run molecule
run: molecule test
working-directory: sudo
+25
View File
@@ -0,0 +1,25 @@
name: Release Ansible Role
on:
push:
tags:
- '**'
workflow_dispatch: {}
permissions:
contents: read
jobs:
release:
name: Release Ansible Role
runs-on: ubuntu-latest
steps:
- name: Install Ansible Galaxy
run: |
apt update --yes
apt install --yes ansible
- env:
ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
name: Update Ansible Role in Ansible Galaxy
run: |
ansible-galaxy role import --token=${ANSIBLE_GALAXY_TOKEN} volker-raschek ${GITHUB_REPOSITORY#*/}
File renamed without changes.
+2 -2
View File
@@ -3,12 +3,12 @@
"files.associations": { "files.associations": {
"**/.gitea/**/*.yml": "yaml", "**/.gitea/**/*.yml": "yaml",
"**/.gitea/**/*.yaml": "yaml", "**/.gitea/**/*.yaml": "yaml",
".drone.yml": "yaml",
"docker-compose*.yml": "dockercompose", "docker-compose*.yml": "dockercompose",
"*.yml": "ansible", "*.yml": "ansible",
"*.yaml": "ansible", "*.yaml": "ansible",
".yamllint": "yaml", ".yamllint": "yaml",
".yamllint.yml": "yaml", ".yamllint.yml": "yaml",
".yamllint.yaml": "yaml" ".yamllint.yaml": "yaml"
} },
"rewrap.wrappingColumn": 120
} }
+2
View File
@@ -1,3 +1,5 @@
---
# #
# Documentation: # Documentation:
# https://yamllint.readthedocs.io/en/stable/ # https://yamllint.readthedocs.io/en/stable/
+38 -2
View File
@@ -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 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. 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 - Installing sudo
- Configuring drop-on files in `/etc/sudoers.d` - 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 ## Configuring
In the default directory are examples how to configure the network stack. Copy the In the default directory are examples how to configure the network stack. Copy the
+6 -5
View File
@@ -3,8 +3,9 @@
sudo_users_sudoers: [] sudo_users_sudoers: []
# - commands: # - commands:
# - ALL # - ALL
# filename: "" # Optional: Default to user or group # filename: "" # Optional: Default to user or group
# group: "" # Group or User, not booth! # group: "" # Group or User, not booth!
# nopassword: true # nopassword: true #
# runas: "" # Optional # runas: "" # Optional
# user: "markus": # Group or User, not booth! # state: present # Optional: absent removes this drop-in; defaults to present
# user: "markus": # Group or User, not booth!
+17
View File
@@ -0,0 +1,17 @@
---
argument_specs:
main:
short_description: "Role to configure sudoers on different distributions"
description:
- "This Ansible role installs sudo and manages drop-in files in /etc/sudoers.d."
- "Each drop-in file grants a unix user or a unix group the permission to execute commands, optionally as another
unix user."
author: "Markus Pesch"
options:
sudo_users_sudoers:
description:
- "List of sudoers drop-in files. Each entry must define either 'user' or 'group', but not both."
- "Supported keys are 'commands', 'filename', 'group', 'nopassword', 'runas', 'state' and 'user'."
type: list
elements: dict
default: []
+11 -9
View File
@@ -1,14 +1,21 @@
dependencies: []
galaxy_info: galaxy_info:
role_name: "sudo"
author: "Markus Pesch" author: "Markus Pesch"
description: Role to configure sudoers on different distributions
company: Cryptic Systems company: Cryptic Systems
description: Role to configure sudoers on different distributions
galaxy_tags:
- sudo
- sudoers
license: MIT license: MIT
min_ansible_version: "2.9" min_ansible_version: "2.11"
namespace: volker-raschek
platforms: platforms:
- name: ArchLinux - name: ArchLinux
versions: versions:
- all - all
- name: Debian
versions:
- all
- name: EL - name: EL
versions: versions:
- all - all
@@ -18,9 +25,4 @@ galaxy_info:
- name: Ubuntu - name: Ubuntu
versions: versions:
- all - all
role_name: "sudo"
galaxy_tags:
- sudo
- sudoers
dependencies: []
+5
View File
@@ -0,0 +1,5 @@
---
collections:
- name: community.docker
- name: community.general
+33
View File
@@ -0,0 +1,33 @@
---
- name: Converge
hosts: all
vars:
sudo_users_sudoers:
# A user without runas, restricted to a single command.
- user: molecule-alice
commands:
- /usr/bin/systemctl restart nginx
nopassword: true
# A user that acts as another user and stores its rule under a custom filename.
- user: molecule-bob
runas: molecule-alice
filename: molecule-bob-as-alice
nopassword: true
# A group that has to authenticate itself.
- group: molecule-ops
commands:
- /usr/bin/id
nopassword: false
# A group that acts as root.
- group: molecule-admins
runas: root
filename: molecule-admins-as-root
nopassword: true
- user: molecule-obsolete
state: absent
tasks:
# The role is included by the name of its directory, which molecule put on the roles path.
- name: Include the role sudo
ansible.builtin.include_role:
name: sudo
+25
View File
@@ -0,0 +1,25 @@
---
- name: Create
hosts: localhost
gather_facts: false
tasks:
- name: Start a container per platform
community.docker.docker_container:
name: "{{ item.name }}"
image: "{{ item.image }}"
command: "sleep infinity"
state: started
loop: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
- name: Write the instance config
ansible.builtin.copy:
content: |
{% for platform in molecule_yml.platforms %}
- instance: {{ platform.name }}
connection: community.docker.docker
{% endfor %}
dest: "{{ molecule_instance_config }}"
mode: "0600"
+19
View File
@@ -0,0 +1,19 @@
---
- name: Destroy
hosts: localhost
gather_facts: false
tasks:
- name: Remove the container of every platform
community.docker.docker_container:
name: "{{ item.name }}"
state: absent
loop: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
- name: Empty the instance config
ansible.builtin.copy:
content: "[]"
dest: "{{ molecule_instance_config }}"
mode: "0600"
+24
View File
@@ -0,0 +1,24 @@
---
driver:
name: default
options:
managed: true
login_cmd_template: "docker exec --interactive --tty {instance} bash"
platforms:
- name: sudo-archlinux
image: docker.io/library/archlinux:base
- name: sudo-debian
image: docker.io/library/debian:13
- name: sudo-fedora
image: registry.fedoraproject.org/fedora:43
provisioner:
name: ansible
# The role under test is the project directory itself, so its parent has to be on the roles path.
env:
ANSIBLE_ROLES_PATH: "${MOLECULE_PROJECT_DIRECTORY}/.."
config_options:
defaults:
interpreter_python: auto_silent
+61
View File
@@ -0,0 +1,61 @@
---
- name: Prepare
hosts: all
gather_facts: false
vars:
# The base images ship neither a python interpreter for ansible nor the package manager bindings the role relies on.
_bootstrap: |
set -eu
if command -v pacman > /dev/null; then
pacman --sync --refresh --sysupgrade --noconfirm python shadow
elif command -v apt-get > /dev/null; then
apt-get update
apt-get install --yes passwd python3 python3-apt
else
dnf install --assumeyes python3 python3-libdnf5 shadow-utils
fi
tasks:
# The raw command is wrapped explicitly, because the bootstrap relies on shell builtins.
- name: Bootstrap the python interpreter and the package manager bindings
ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}"
changed_when: true
- name: Seed the objects the converge refers to
hosts: all
tasks:
- name: Create the groups the converge grants permissions to
ansible.builtin.group:
name: "{{ item }}"
state: present
loop:
- molecule-admins
- molecule-ops
- name: Create the users the converge grants permissions to
ansible.builtin.user:
name: "{{ item }}"
group: users
state: present
loop:
- molecule-alice
- molecule-bob
- name: Create the drop-in directory for the seeded files
ansible.builtin.file:
path: /etc/sudoers.d
state: directory
owner: root
group: root
mode: "0750"
- name: Seed the obsolete and unmanaged drop-in files
ansible.builtin.copy:
content: "molecule-alice ALL=NOPASSWD: /usr/bin/true\n"
dest: '/etc/sudoers.d/{{ item }}'
owner: root
group: root
mode: "0440"
loop:
- molecule-obsolete
- molecule-unmanaged
+4
View File
@@ -0,0 +1,4 @@
---
# The role has no role dependencies, but molecule warns about the missing file.
roles: []
+95
View File
@@ -0,0 +1,95 @@
---
- name: Verify
hosts: all
vars:
# The exact spacing the sudoers module emits differs between releases, so only the tokens are matched.
_expected_rules:
molecule-alice: 'molecule-alice\s+ALL=\s*NOPASSWD:\s*/usr/bin/systemctl restart nginx'
molecule-bob-as-alice: 'molecule-bob\s+ALL=\(molecule-alice\)\s*NOPASSWD:\s*ALL'
molecule-ops: '%molecule-ops\s+ALL=\s*/usr/bin/id'
molecule-admins-as-root: '%molecule-admins\s+ALL=\(root\)\s*NOPASSWD:\s*ALL'
tasks:
- name: Stat the drop-in directory and the removed drop-in file
ansible.builtin.stat:
path: "{{ item }}"
register: _directory
loop:
- /etc/sudoers.d
- /etc/sudoers.d/molecule-obsolete
- name: Assert that the drop-in directory exists and that the obsolete drop-in file is gone
ansible.builtin.assert:
that:
- _directory.results[0].stat.isdir
- _directory.results[0].stat.mode == '0750'
- not _directory.results[1].stat.exists
fail_msg: "/etc/sudoers.d is not owned by the role or the file molecule-obsolete was not removed"
- name: Read the unmanaged drop-in file
ansible.builtin.slurp:
src: /etc/sudoers.d/molecule-unmanaged
register: _unmanaged_rule
- name: Assert that the unmanaged drop-in file was preserved unchanged
ansible.builtin.assert:
that: >-
(_unmanaged_rule.content | b64decode) == 'molecule-alice ALL=NOPASSWD: /usr/bin/true\n'
- name: Stat the drop-in files of the declared rules
ansible.builtin.stat:
path: "/etc/sudoers.d/{{ item.key }}"
register: _rule_files
loop: "{{ _expected_rules | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Assert that every drop-in file exists and is only readable by root
ansible.builtin.assert:
that:
- item.stat.exists
- item.stat.mode == '0440'
- item.stat.pw_name == 'root'
- item.stat.gr_name == 'root'
fail_msg: >-
/etc/sudoers.d/{{ item.item.key }} has mode {{ item.stat.mode | default('none') }} and owner
{{ item.stat.pw_name | default('none') }}:{{ item.stat.gr_name | default('none') }} instead of 0440 and root:root
loop: "{{ _rule_files.results }}"
loop_control:
label: "{{ item.item.key }}"
- name: Read the drop-in files of the declared rules
ansible.builtin.slurp:
src: "/etc/sudoers.d/{{ item.key }}"
register: _rule_contents
loop: "{{ _expected_rules | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Assert that every drop-in file holds the declared rule
ansible.builtin.assert:
that: item.content | b64decode is search(item.item.value)
fail_msg: >-
/etc/sudoers.d/{{ item.item.key }} contains
{{ item.content | b64decode | trim }} instead of a rule matching {{ item.item.value }}
loop: "{{ _rule_contents.results }}"
loop_control:
label: "{{ item.item.key }}"
- name: Read /etc/sudoers
ansible.builtin.slurp:
src: /etc/sudoers
register: _sudoers
- name: Assert that the drop-in directory is included exactly once
vars:
_includedir: "{{ (_sudoers.content | b64decode).splitlines() | select('search', 'includedir\\s+/etc/sudoers.d') }}"
ansible.builtin.assert:
that: _includedir == ['#includedir /etc/sudoers.d']
fail_msg: "/etc/sudoers includes the drop-in directory as {{ _includedir }}"
# A drop-in file that sudo rejects would lock out every rule of the directory.
- name: Assert that sudo is installed and parses the resulting configuration
ansible.builtin.command:
cmd: visudo --check --strict
changed_when: false
+7
View File
@@ -0,0 +1,7 @@
---
collections:
# The sudoers module has been added in community.general 4.3.0, its runas
# parameter in 4.7.0.
- name: community.general
version: ">=4.7.0"
+43 -33
View File
@@ -1,16 +1,28 @@
--- ---
- name: Load variables - name: Include OS-specific variables
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
- name: Verify variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files:
- "{{ ansible_distribution }}_verify_vars.yml" - "{{ ansible_facts['distribution'] }}_{{ ansible_facts['architecture'] }}.yml"
- "{{ ansible_os_family }}_verify_vars.yml" - "{{ ansible_facts['distribution'] }}.yml"
- "verify_vars.yml" - "{{ ansible_facts['os_family'] }}_{{ ansible_facts['architecture'] }}.yml"
- "{{ ansible_facts['os_family'] }}.yml"
- main.yml
paths:
- vars
- name: Verify variables
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] }}_verify_vars.yml"
- "{{ ansible_facts['os_family'] }}_verify_vars.yml"
- verify_vars.yml
paths:
- tasks
- name: Install sudo - name: Install sudo
ansible.builtin.package: ansible.builtin.package:
@@ -22,74 +34,72 @@
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
dest: /etc/sudoers dest: /etc/sudoers
state: present state: present
regexp: "^(#)+(\\s)*includedir(\\s)*/etc/sudoers.d" # sudo >= 1.9.1 ships the directive as @includedir, older releases as #includedir
regexp: "^[#@]+(\\s)*includedir(\\s)*/etc/sudoers\\.d"
line: "#includedir /etc/sudoers.d" line: "#includedir /etc/sudoers.d"
validate: 'visudo --check --file %s' validate: 'visudo --check --file %s'
mode: "0440" mode: "0440"
owner: "root" owner: "root"
group: "root" group: "root"
- name: Flush drop-in files of sudoers.d - name: Create drop-in directory of sudoers
ansible.builtin.file: ansible.builtin.file:
state: "{{ item }}" state: directory
path: "/etc/sudoers.d" path: "/etc/sudoers.d"
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0750" mode: "0750"
with_items:
- absent
- directory
- name: "Create sudoers drop-in file to execute commands for specific unix users" - name: "Create sudoers drop-in file to execute commands for specific unix users"
community.general.sudoers: community.general.sudoers:
name: "{{ item.filename | default(item.user) }}" name: "{{ item.filename | default(item.user, true) }}"
state: present state: "{{ item.state | default('present') }}"
user: "{{ item.user }}" user: "{{ item.user }}"
nopassword: "{{ item.nopassword | default(false) }}" nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}" commands: "{{ item.commands | default('ALL') }}"
with_items: with_items:
- "{{ sudo_users_sudoers }}" - "{{ sudo_users_sudoers }}"
when: item.user is defined and item.user | length > 0 and when: item.user | default('') | length > 0 and
item.group is not defined and item.group | default('') | length == 0 and
item.runas is not defined item.runas | default('') | length == 0
- name: "Create sudoers drop-in file to execute commands for specific unix users as specific unix user" - name: "Create sudoers drop-in file to execute commands for specific unix users as specific unix user"
community.general.sudoers: community.general.sudoers:
name: "{{ item.filename | default(item.user) }}" name: "{{ item.filename | default(item.user, true) }}"
state: present state: "{{ item.state | default('present') }}"
user: "{{ item.user }}" user: "{{ item.user }}"
runas: "{{ item.runas }}" runas: "{{ item.runas }}"
nopassword: "{{ item.nopassword | default(false) }}" nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}" commands: "{{ item.commands | default('ALL') }}"
with_items: with_items:
- "{{ sudo_users_sudoers }}" - "{{ sudo_users_sudoers }}"
when: item.user is defined and item.user | length > 0 and when: item.user | default('') | length > 0 and
item.group is not defined and item.group | default('') | length == 0 and
item.runas is defined and item.runas | length > 0 item.runas | default('') | length > 0
- name: "Create sudoers drop-in file to execute commands for specific unix groups" - name: "Create sudoers drop-in file to execute commands for specific unix groups"
community.general.sudoers: community.general.sudoers:
name: "{{ item.filename | default(item.group) }}" name: "{{ item.filename | default(item.group, true) }}"
state: present state: "{{ item.state | default('present') }}"
group: "{{ item.group }}" group: "{{ item.group }}"
nopassword: "{{ item.nopassword | default(false) }}" nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}" commands: "{{ item.commands | default('ALL') }}"
with_items: with_items:
- "{{ sudo_users_sudoers }}" - "{{ sudo_users_sudoers }}"
when: item.user is not defined and when: item.user | default('') | length == 0 and
item.group is defined and item.group | length > 0 and item.group | default('') | length > 0 and
item.runas is not defined item.runas | default('') | length == 0
- name: "Create sudoers drop-in file to execute commands for specific unix groups as specifix unix user" - name: "Create sudoers drop-in file to execute commands for specific unix groups as specifix unix user"
community.general.sudoers: community.general.sudoers:
name: "{{ item.filename | default(item.group) }}" name: "{{ item.filename | default(item.group, true) }}"
state: present state: "{{ item.state | default('present') }}"
group: "{{ item.group }}" group: "{{ item.group }}"
runas: "{{ item.runas }}" runas: "{{ item.runas }}"
nopassword: "{{ item.nopassword | default(false) }}" nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}" commands: "{{ item.commands | default('ALL') }}"
with_items: with_items:
- "{{ sudo_users_sudoers }}" - "{{ sudo_users_sudoers }}"
when: item.user is not defined and when: item.user | default('') | length == 0 and
item.group is defined and item.group | length > 0 and item.group | default('') | length > 0 and
item.runas is defined and item.runas | length > 0 item.runas | default('') | length > 0
+10 -6
View File
@@ -1,8 +1,12 @@
--- ---
# - name: Verify if not user and group exists for each entry - name: Verify that each entry defines either a user or a group
# ansible.builtin.assert: ansible.builtin.assert:
# that: that:
# - (item.user is defined and item.group is not defined) or - (item.user is defined and item.user | length > 0) !=
# (item.user is not defined and item.group is defined) (item.group is defined and item.group | length > 0)
# with_items: "{{ sudo_users_sudoers }}" fail_msg: >
Each entry of sudo_users_sudoers must define either 'user' or 'group',
but not both and not none.
quiet: true
with_items: "{{ sudo_users_sudoers }}"