On 04/11/2022 22:02, Manikandan Balasubramanian wrote:
> For some reason, If you want to know the AWX job id itself, you can
> assign the job id as an environment variable in your pod spec:
> something like this:
>
> env:
> - name: job_id
> valueFrom:
> fieldRef:
> fieldPath: metadata.labels['ansible-awx-job-id']
>
> And in your ansible playbook, you can reference this job_id variable
> to get the AWX job id that the pod was assigned.
You don't even need to do that "{{ tower_job_id }}" (and I would guess
awx_job_id) are already defined.
(you can also use "when: tower_job_id is defined" to have tasks that
only run when you are running from awx and not locally)