theforeman / theforeman.foreman / 4.0.0 / module / job_invocation Invoke Remote Execution Jobs | "added in version" 1.4.0 of theforeman.foreman" Authors: Peter Ondrejka (@pondrejk)theforeman.foreman.job_invocation (4.0.0) — module
Install with ansible-galaxy collection install theforeman.foreman:==4.0.0
collections: - name: theforeman.foreman version: 4.0.0
Invoke and schedule Remote Execution Jobs
- 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
ssh: description: - ssh related options suboptions: effective_user: description: - What user should be used to run the script (using sudo-like mechanisms) - Defaults to a template parameter or global setting type: str type: dict inputs: description: - Inputs to use type: dict command: description: - Command to be executed on host. Required for command templates type: str bookmark: description: - Bookmark to infer the search query from type: str password: description: - Password of the user accessing the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD) will be used instead. required: true type: str username: description: - Username accessing the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME) will be used instead. required: true type: str recurrence: description: - Schedule a recurring job suboptions: cron_line: description: - How often the job should occur, in the cron format type: str end_time: description: - Perform no more executions after this time type: str max_iteration: description: - Repeat a maximum of N times type: int purpose: description: - Designation of a special purpose type: str type: dict scheduling: description: - Schedule the job to start at a later time suboptions: start_at: description: - Schedule the job for a future time type: str start_before: description: - Indicates that the action should be cancelled if it cannot be started before this time. type: str type: dict server_url: description: - URL of the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL) will be used instead. required: true type: str job_template: description: - Job template to execute required: true type: str search_query: description: - Search query to identify hosts type: str targeting_type: choices: - static_query - dynamic_query default: static_query description: - Dynamic query updates the search results before execution (useful for scheduled jobs) type: str validate_certs: default: true description: - 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 C(FOREMAN_VALIDATE_CERTS) will be used instead. type: bool description_format: description: - Override the description format from the template for this invocation only type: str concurrency_control: description: - Control concurrency level and distribution over time suboptions: concurrency_level: description: - Maximum jobs to be executed at once type: int time_span: description: - Distribute tasks over given number of seconds - This is removed since foreman_remote_execution-11.0.0 type: int type: dict randomized_ordering: description: - Whether to order the selected hosts randomly type: bool execution_timeout_interval: description: - Override the timeout interval from the template for this invocation only type: int
entity: contains: job_invocations: description: List of job invocations elements: dict type: list description: Final state of the affected entities grouped by their type. returned: success type: dict