I have a situation where the approval logic in Ansible Tower workflow template is working fine, Slack notifications are also working fine, but, I want to send approve and deny buttons to Slack and capture response from Slack channel to Ansible Tower workflow template.
I get the notifications like this:
The approval node "Proceed for L1" needs review. This node can be viewed at: https://ansibletower/#/workflows/668
The approval node "Proceed for L1" was approved. https://ansibletower/#/workflows/668
The approval node "Proceed for L1" needs review. This node can be viewed at: https://ansibletower/#/workflows/674
The approval node "Proceed for L1" was denied. https://ansibletower/#/workflows/674
But can we get the approval messages like this:
I tried a playbook to use Slack module but waiting for the response and receiving action response was the challenge
- name: Post Message to Slack
slack:
token: "{{ slack_token }}"
attachments:
- title: Launched {{ tower_job_id }} and Restart Service
text: "*Actions:*"
actions:
- type: button
text: Approve
style: primary
url: https://anisbletower/#/templates/job_template/17
- type: button
text: Deny
style: danger
url: https://ansibletower/#/templates/job_template/15
- type: button
text: Check Job Log
url: https://ansibletower/#/jobs/playbook/{{ tower_job_id }}
channel: {{ slack_channel }}
domain: "app.slack.com"
delegate_to: localhost
How can we capture the response (approved or denied) from Slack and send it to the job on Ansible Tower which is waiting?