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

linode: Allow templating token for dynamic inventory #4040

Merged

Conversation

wbh1
Copy link
Contributor

@wbh1 wbh1 commented Jan 14, 2022

SUMMARY

Template the value for the access_token if it's a Jinja template.

Allows for looking up tokens from files or pulling from secrets stores like Vault.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

linode

ADDITIONAL INFORMATION

This is inspired by how AWS handles templating in their EC2 dynamic inventory plugin.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added cloud feature This issue/PR relates to a feature request inventory inventory plugin needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) labels Jan 14, 2022
@wbh1 wbh1 force-pushed the linode/inventory-templating branch from 7fb1f3e to 2bd73ca Compare January 14, 2022 15:29
@ansibullbot ansibullbot added tests tests unit tests/unit and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 14, 2022
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! Can you please add a changelog fragment?

plugins/inventory/linode.py Outdated Show resolved Hide resolved
plugins/inventory/linode.py Outdated Show resolved Hide resolved
@felixfontein felixfontein added backport-4 check-before-release PR will be looked at again shortly before release and merged if possible. labels Jan 16, 2022
Template the value for the access_token if it's a Jinja template.

Allows for looking up tokens from files or pulling from secrets stores like Vault.
@wbh1 wbh1 force-pushed the linode/inventory-templating branch from 2bd73ca to 90feee1 Compare January 18, 2022 15:54
@wbh1 wbh1 force-pushed the linode/inventory-templating branch from 90feee1 to 57a9d96 Compare January 18, 2022 15:55
Co-authored-by: Felix Fontein <felix@fontein.de>
@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 18, 2022
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.

Besides this, looks good!

tests/unit/plugins/inventory/test_linode.py Outdated Show resolved Hide resolved
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein
Copy link
Collaborator

If nobody complains until beginning of next week, I'll merge this PR by then.

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jan 29, 2022
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 30, 2022
@felixfontein
Copy link
Collaborator

Looks like I missed the beginning of last week, so let's merge it now :)

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

patchback bot commented Jan 30, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/f77a1114fb1bfb90bbde7851fc8b1959c6dafd3e/pr-4040

Backported as #4119

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

patchback bot pushed a commit that referenced this pull request Jan 30, 2022
* linode: Allow templating token for dynamic inventory

Template the value for the access_token if it's a Jinja template.

Allows for looking up tokens from files or pulling from secrets stores like Vault.

* add Linode changelog fragment

* Fix lookup example for newer versions of Ansible

Co-authored-by: Felix Fontein <felix@fontein.de>

* Rename test case for clarity

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f77a111)
@felixfontein
Copy link
Collaborator

@wbh1 thanks for contributing this!

felixfontein pushed a commit that referenced this pull request Jan 30, 2022
* linode: Allow templating token for dynamic inventory

Template the value for the access_token if it's a Jinja template.

Allows for looking up tokens from files or pulling from secrets stores like Vault.

* add Linode changelog fragment

* Fix lookup example for newer versions of Ansible

Co-authored-by: Felix Fontein <felix@fontein.de>

* Rename test case for clarity

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f77a111)

Co-authored-by: Will Hegedus <will@wbhegedus.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloud feature This issue/PR relates to a feature request inventory inventory plugin new_contributor Help guide this first time contributor plugins plugin (any type) stale_ci CI is older than 7 days, rerun before merging tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants