Skip to content

Commit

Permalink
Fixes #33942 - Allow extra vars for awx/tower on snippet template.
Browse files Browse the repository at this point in the history
The chaged templates now supports 'extra_vars' for the awx/tower api callbak via host/hostgroup parameters.
  • Loading branch information
rbertol committed Nov 17, 2021
1 parent 16d1317 commit cb4c19a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ description: |
#!/bin/sh

echo "Calling Ansible AWX/Tower provisioning callback..."
<% if host_param('ansible_extra_vars') -%>
/usr/bin/curl -v -k -s -H 'Content-Type: application/json' --data {"host_config_key":"<%= host_param('ansible_host_config_key') %>", "extra_vars": "<%=host_param('ansible_extra_vars') %>"} https://<%= host_param('ansible_tower_fqdn') %>/api/v2/job_templates/<%= host_param('ansible_job_template_id') %>/callback/
<% else -%>
/usr/bin/curl -v -k -s --data "host_config_key=<%= host_param('ansible_host_config_key') %>" https://<%= host_param('ansible_tower_fqdn') %>/api/v2/job_templates/<%= host_param('ansible_job_template_id') %>/callback/
<% end -%>
echo "DONE"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ After=network-online.target

[Service]
Type=oneshot
<% if host_param('ansible_extra_vars') -%>
ExecStart=/usr/bin/curl -k -s -H 'Content-Type: application/json' --data {"host_config_key":"<%= host_param('ansible_host_config_key') %>", "extra_vars": "<%=host_param('ansible_extra_vars') %>"} https://<%= host_param('ansible_tower_fqdn') %>/api/v2/job_templates/<%= host_param('ansible_job_template_id') %>/callback/
<% else -%>
ExecStart=/usr/bin/curl -k -s --data "host_config_key=<%= host_param('ansible_host_config_key') -%>" https://<%= host_param('ansible_tower_fqdn') -%>/api/v2/job_templates/<%= host_param('ansible_job_template_id') -%>/callback/
<% end -%>
ExecStartPost=/usr/bin/systemctl disable ansible-callback

[Install]
Expand Down

0 comments on commit cb4c19a

Please sign in to comment.