Closed yannickincyberatlantis closed 2 months ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @JonEllis click here for bot help
This isn't a bug, that's normal Ansible behavior.
The commands
option expects a list of strings. If you provide a single string, Ansible will split that string by commas. Since your string contains a comma, it will be converted to a list with two elements - something that's wrong in your case.
So simply provide a proper list here instead of a string that contains a comma. The "workaround" is not a workaround, but the correct way to use Ansible in this case.
This isn't a bug, that's normal Ansible behavior.
The
commands
option expects a list of strings. If you provide a single string, Ansible will split that string by commas. Since your string contains a comma, it will be converted to a list with two elements - something that's wrong in your case.So simply provide a proper list here instead of a string that contains a comma. The "workaround" is not a workaround, but the correct way to use Ansible in this case.
I see, thank you for explaining this! :)
Summary
When creating a sudo rule using the following task, the sudoers module adds an unintentional space to the string, in this case breaking the regex:
The resulting sudoers file has the following contents:
Note the space between
1,
and15
: {1, 15}Someone on the Ansible IRC channel found a workaround for this: add the command as a list, rather than a single string. The following Ansible task does work:
Issue Type
Bug Report
Component Name
sudoers
Ansible Version
Community.general Version
Configuration
OS / Environment
Controller: Fedora 40 Target: Debian 12
Steps to Reproduce
Expected Results
I expected the following line:
Instead I got the following line:
Actual Results
No response
Code of Conduct