theforeman.foreman.job_template – Manage Job Templates¶
Note
This plugin is part of the theforeman.foreman collection.
To install it use: ansible-galaxy collection install theforeman.foreman
.
To use it in a playbook, specify: theforeman.foreman.job_template
.
New in version 1.0.0: of theforeman.foreman
Parameters¶
Examples¶
- name: "Create a Job Template inline"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.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"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.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"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: a new job template
template_inputs: []
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Delete a Job Template"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: timeywimey
state: absent
- name: "Create a Job Template from a file and modify with parameter(s)"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.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
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.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
theforeman.foreman.job_template:
server_url: "https://foreman.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"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: absent
- name: "Assign all Job Templates to the same organization(s)"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.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:
Authors¶
Manuel Bonk (@manuelbonk) ATIX AG
Matthias Dellweg (@mdellweg) ATIX AG