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 job options to ansible env #358

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

len-ro
Copy link

@len-ro len-ro commented Mar 31, 2024

This change adds all the "job" options to the process environment used to run ansible. It allows something like this to work:

    - debug:
        msg: 
          - "RD_JOB_NAME: {{lookup('ansible.builtin.env', 'RD_JOB_NAME')}}"
          - "RD_JOB_USERNAME: {{lookup('ansible.builtin.env', 'RD_JOB_USERNAME')}}"
          - "RD_JOB_URL: {{lookup('ansible.builtin.env', 'RD_JOB_URL')}}"

In my case this allows me to use the RD_JOB_USERNAME in a custom ansible callback to identify the user calling the job.
Before this change these variables were not present in ansible unlike in a shell script ran from rundeck.

Thanks.

@wwilkins-intlog
Copy link

@len-ro Does this work with "Plain Text with Password Input" job inputs as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants