redhat.satellite.job_invocation – Invoke Remote Execution Jobs

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_invocation.

New in version 1.4.0: of redhat.satellite

Synopsis

  • Invoke and schedule Remote Execution Jobs

Requirements

The below requirements are needed on the host that executes this module.

  • requests

Parameters

Parameter Choices/Defaults Comments
bookmark
string
Bookmark to infer the search query from
command
string
Command to be executed on host. Required for command templates
concurrency_control
dictionary
Control concurrency level and distribution over time
concurrency_level
integer
Maximum jobs to be executed at once
time_span
integer
Distribute tasks over given number of seconds
execution_timeout_interval
integer
Override the timeout interval from the template for this invocation only
inputs
dictionary
Inputs to use
job_template
string / required
Job template to execute
password
string / required
Password of the user accessing the Foreman server.
If the value is not specified in the task, the value of environment variable SATELLITE_PASSWORD will be used instead.
randomized_ordering
boolean
    Choices:
  • no
  • yes
Whether to order the selected hosts randomly
recurrence
dictionary
Schedule a recurring job
cron_line
string
How often the job should occur, in the cron format
end_time
string
Perform no more executions after this time
max_iteration
integer
Repeat a maximum of N times
scheduling
dictionary
Schedule the job to start at a later time
start_at
string
Schedule the job for a future time
start_before
string
Indicates that the action should be cancelled if it cannot be started before this time.
search_query
string
Search query to identify hosts
server_url
string / required
URL of the Foreman server.
If the value is not specified in the task, the value of environment variable SATELLITE_SERVER_URL will be used instead.
ssh
dictionary
ssh related options
effective_user
string
What user should be used to run the script (using sudo-like mechanisms)
Defaults to a template parameter or global setting
targeting_type
string
    Choices:
  • static_query ←
  • dynamic_query
Dynamic query updates the search results before execution (useful for scheduled jobs)
username
string / required
Username accessing the Foreman server.
If the value is not specified in the task, the value of environment variable SATELLITE_USERNAME will be used instead.
validate_certs
boolean
    Choices:
  • no
  • yes ←
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 SATELLITE_VALIDATE_CERTS will be used instead.

Examples

- name: "Run remote command on a single host once"
  job_invocation:
    search_query: "name ^ (satellite.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 Returned Description
entity
dictionary
success
Final state of the affected entities grouped by their type.

 
job_invocations
list / elements=dictionary
success
List of job invocations



Authors

  • Peter Ondrejka (@pondrejk)