Hello,
I am working in AWX to create a job workflow template. My workflow is to gather DNS entries, prompt the user for approval of deleting the DNS entries. If they approve, it will run a playbook to delete the gathered DNS entries.
Here’s my job workflow’s config:
I have “prompt on launch” enabled since I intend to allow the user to specify certain things determining what DNS entries are to be gathered.
Here is the first job_template node in the workflow’s playbook:
- name: AWX Decom DNS
hosts: localhost
connection: local
gather_facts: true
tasks:
- name: Set fact
ansible.builtin.set_fact:
approval_summary: "These items will be deleted! example1.company.com and example2.company.com"
- name: Set stats for dns_items_to_delete
ansible.builtin.set_stats:
per_host: false
data:
approval_summary: "These items will be deleted! example1.company.com and example2.company.com"
dns_items_to_delete:
- example1.company.com
- example2.company.com
- name: Show approval_summary
ansible.builtin.debug:
msg: "approval_summary is: {{ approval_summary }}"
approval_summary seems to be transferring correctly to the final deletion playbook and reads “These items will be deleted![…]” as expected . I am trying to figure out how to pass this info in some way to the approval step to help the user to know which DNS entries will be deleted. This bit seems to be eluding me despite my attempts.
This is what is seen in step 2 of the workflow, the approval step:
Variables is empty. I also tried having the description contain {{ approval_summary }}
but I figure this is set at create time only, hence it defaulting to my fallback of “Nothing supplied for approval_summary”.
I presume variables being under Workflow Job means the initial variables the user supplied. Is there a way for a preceding step of an approval to insert information into this approval step so the user knows what they are approving without having to click the preceding job and looking at the log there…? Or is there some other way to add context to this approval?