redhat.satellite.job_template – Manage Job Templates
Note
This plugin is part of the redhat.satellite collection (version 3.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install redhat.satellite
.
To use it in a playbook, specify: redhat.satellite.job_template
.
New in version 1.0.0: of redhat.satellite
Synopsis
Manage Remote Execution Job Templates
Requirements
The below requirements are needed on the host that executes this module.
requests
Parameters
Examples
- name: "Create a Job Template inline"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: A New Job Template
state: present
template: |
<%#
name: A Job Template
%>
rm -rf <%= input("toDelete") %>
template_inputs:
- name: toDelete
input_type: user
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Create a Job Template from a file"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: a new job template
file_name: timeywimey_template.erb
template_inputs:
- name: a new template input
input_type: user
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "remove a job template's template inputs"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: a new job template
template_inputs: []
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Delete a Job Template"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: timeywimey
state: absent
- name: "Create a Job Template from a file and modify with parameter(s)"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
file_name: timeywimey_template.erb
name: Wibbly Wobbly Template
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: Parsing a directory of Job templates
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
file_name: "{{ item }}"
state: present
locations:
- SKARO
organizations:
- DALEK INC
with_fileglob:
- "./arsenal_templates/*.erb"
# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all your Job Templates
redhat.satellite.job_template:
server_url: "https://satellite.example.com"
username: "admin"
password: "changeme"
state: present
template: '{{ lookup("file", item.src) }}'
with_filetree: '/path/to/job/templates'
when: item.state == 'file'
# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* Job Templates"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: "*"
state: absent
- name: "Assign all Job Templates to the same organization(s)"
redhat.satellite.job_template:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
name: "*"
state: present
organizations:
- DALEK INC
- sky.net
- Doc Brown's garage
Return Values
Common return values are documented here, the following are the fields unique to this module: