mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
feat: sudoers module supports runas parameter with default of root (#4380)
* feat: sudoers module supports runas parameter with default of root * fix: sudoers tests now pass * chore: add changelog fragment for 4380 * fix: runas feature now a non-breaking change wh no def with no default * fix: no trailing space in sudoers.py * Update plugins/modules/system/sudoers.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
8515c03dc7
commit
17fe813c18
3 changed files with 40 additions and 1 deletions
|
@ -102,6 +102,21 @@
|
|||
src: "{{ alt_sudoers_path }}/my-sudo-rule-5"
|
||||
register: rule_5_contents
|
||||
|
||||
- name: Create rule to runas another user
|
||||
community.general.sudoers:
|
||||
name: my-sudo-rule-6
|
||||
state: present
|
||||
user: alice
|
||||
commands: /usr/local/bin/command
|
||||
runas: bob
|
||||
sudoers_path: "{{ sudoers_path }}"
|
||||
register: rule_6
|
||||
|
||||
- name: Grab contents of my-sudo-rule-6 (in alternative directory)
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ sudoers_path }}/my-sudo-rule-6"
|
||||
register: rule_6_contents
|
||||
|
||||
|
||||
- name: Revoke rule 1
|
||||
community.general.sudoers:
|
||||
|
@ -133,6 +148,7 @@
|
|||
- "rule_3_contents['content'] | b64decode == 'alice ALL= /usr/local/bin/command\n'"
|
||||
- "rule_4_contents['content'] | b64decode == '%students ALL=NOPASSWD: /usr/local/bin/command\n'"
|
||||
- "rule_5_contents['content'] | b64decode == 'alice ALL=NOPASSWD: /usr/local/bin/command\n'"
|
||||
- "rule_6_contents['content'] | b64decode == 'alice ALL=(bob)NOPASSWD: /usr/local/bin/command\n'"
|
||||
|
||||
- name: Check stats
|
||||
ansible.builtin.assert:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue