Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for setenv parameters #5883

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

redat00
Copy link
Contributor

@redat00 redat00 commented Jan 24, 2023

SUMMARY

During the configuration of sudo rights regarding a Python app I created, I needed to allow my user to keep their environments variables while running it. This can be done by using sudo -E [command to run].

To allow this in our sudoers files we need to pass a parameters. However while the sudoers modules allowed to pass nopasswd, it did not allowed to pass the setenv parameters. This PR aims to allow it.

minor_changes:
  - sudoers - add `setenv` parameters to support passing environments variables via sudo.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

sudoers

ADDITIONAL INFORMATION
%mygroup ALL=NOPASSWD:SETENV: /usr/local/bin/testing

@ansibullbot
Copy link
Collaborator

cc @JonEllis @JonEllis0
click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) system labels Jan 24, 2023
@github-actions
Copy link

github-actions bot commented Jan 24, 2023

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added some first comments. Can you please add a changelog fragment? Thanks.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-6 labels Jan 24, 2023
@redat00
Copy link
Contributor Author

redat00 commented Jan 24, 2023

Just added the changelog fragment and updated my code with your suggestions

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 25, 2023
@redat00
Copy link
Contributor Author

redat00 commented Jan 25, 2023

Should be all good now, sorry for the small hiccups regarding changelog, I'll now best for the next time !

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 25, 2023
@felixfontein
Copy link
Collaborator

No worries! Looks good to me. If nobody objects, I'll merge beginning of next week.

It would be nice if you could also add a test for this option, though. You can find the existing tests in tests/integration/targets/sudoers/tasks/main.yml.

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from my side

@felixfontein felixfontein merged commit dcc3d4f into ansible-collections:main Jan 30, 2023
@patchback
Copy link

patchback bot commented Jan 30, 2023

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/dcc3d4f50843b54aee82a44b059466149d692fa5/pr-5883

Backported as #5920

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 30, 2023
patchback bot pushed a commit that referenced this pull request Jan 30, 2023
@felixfontein
Copy link
Collaborator

@redat00 thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Jan 30, 2023
…ers (#5920)

Add support for setenv parameters (#5883)

(cherry picked from commit dcc3d4f)

Co-authored-by: Renaud <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) system tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants