Skip to content

Commit

Permalink
Add a template that enables download and execution of a script
Browse files Browse the repository at this point in the history
The main idea is to execute scripts from the Foreman server, similar to theforeman/foreman#10208.
  • Loading branch information
ShimShtein authored and stejskalleos committed Aug 1, 2024
1 parent a135e05 commit bb0ad70
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<%#
name: Download and execute a script
job_category: Ansible Commands
description_format: Download script from %{url} and execute it
snippet: false
template_inputs:
- name: url
required: true
input_type: user
description: "URL of the script to download e.g: http://example.com/unattended/anonymous/my_script"
advanced: false
provider_type: Ansible
kind: job_template
model: JobTemplate
%>

---
- hosts: all
tasks:
- uri:
url: <%= input("url") %>
return_content: true
register: script_response
- shell:
cmd: |
{{script_response.content}}
register: out
- debug: var=out

0 comments on commit bb0ad70

Please sign in to comment.