theforeman.foreman.job_invocation – Invoke Remote Execution Jobs
Note
This plugin is part of the theforeman.foreman collection (version 2.2.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 theforeman.foreman
.
To use it in a playbook, specify: theforeman.foreman.job_invocation
.
New in version 1.4.0: of theforeman.foreman
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 |
|
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 |
|
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:
|
Examples
- name: "Run remote command on a single host once"
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"
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 |
Authors
Peter Ondrejka (@pondrejk)