rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
331 stars 100 forks source link

Add job options to ansible env #358

Open len-ro opened 6 months ago

len-ro commented 6 months ago

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 commented 1 month ago

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