theforeman.foreman.job_invocation module – Invoke Remote Execution Jobs
Note
This module is part of the theforeman.foreman collection (version 5.1.0-dev).
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 theforeman.foreman
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: theforeman.foreman.job_invocation
.
New in theforeman.foreman 1.4.0
Synopsis
Invoke and schedule Remote Execution Jobs
Requirements
The below requirements are needed on the host that executes this module.
requests
Parameters
Parameter |
Comments |
---|---|
Bookmark to infer the search query from |
|
Command to be executed on host. Required for command templates |
|
Control concurrency level and distribution over time |
|
Maximum jobs to be executed at once |
|
Distribute tasks over given number of seconds This is removed since foreman_remote_execution-11.0.0 |
|
Override the description format from the template for this invocation only |
|
Override the timeout interval from the template for this invocation only |
|
Inputs to use |
|
Job template to execute |
|
Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Whether to order the selected hosts randomly Choices:
|
|
Schedule a recurring job |
|
How often the job should occur, in the cron format |
|
Perform no more executions after this time |
|
Repeat a maximum of N times |
|
Designation of a special purpose |
|
Schedule the job to start at a later time |
|
Schedule the job for a future time |
|
Indicates that the action should be cancelled if it cannot be started before this time. |
|
Search query to identify hosts |
|
URL of the Foreman server. If the value is not specified in the task, the value of environment variable |
|
ssh related options |
|
What user should be used to run the script (using sudo-like mechanisms) Defaults to a template parameter or global setting |
|
Dynamic query updates the search results before execution (useful for scheduled jobs) Choices:
|
|
Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying the entity |
|
Support: full |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
Examples
- name: "Run remote command on a single host once"
theforeman.foreman.job_invocation:
search_query: "name ^ (foreman.example.com)"
command: 'ls'
job_template: "Run Command - SSH Default"
ssh:
effective_user: "tester"
- name: "Run ansible command on active hosts once a day"
theforeman.foreman.job_invocation:
bookmark: 'active'
command: 'pwd'
job_template: "Run Command - Ansible Default"
recurrence:
cron_line: "30 2 * * *"
concurrency_control:
concurrency_level: 2
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Final state of the affected entities grouped by their type. Returned: success |
|
List of job invocations Returned: success |