community / community.general / 6.6.8 / module / rundeck_job_run Run a Rundeck job | "added in version" 3.8.0 of community.general" Authors: Phillipe Smith (@phsmith)community.general.rundeck_job_run (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
This module runs a Rundeck job specified by ID.
- name: Run a Rundeck job community.general.rundeck_job_run: url: "https://rundeck.example.org" api_version: 39 api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" register: rundeck_job_run
- name: Show execution info ansible.builtin.debug: var: rundeck_job_run.execution_info
- name: Run a Rundeck job with options community.general.rundeck_job_run: url: "https://rundeck.example.org" api_version: 39 api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" job_options: option_1: "value_1" option_2: "value_3" option_3: "value_3" register: rundeck_job_run
- name: Run a Rundeck job with timeout, delay between status check and abort on timeout community.general.rundeck_job_run: url: "https://rundeck.example.org" api_version: 39 api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" wait_execution_timeout: 30 wait_execution_delay: 10 abort_on_timeout: true register: rundeck_job_run
- name: Schedule a Rundeck job community.general.rundeck_job_run: url: "https://rundeck.example.org" api_version: 39 api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" run_at_time: "2021-10-05T15:45:00-03:00" register: rundeck_job_schedule
- name: Fire-and-forget a Rundeck job community.general.rundeck_job_run: url: "https://rundeck.example.org" api_version: 39 api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" wait_execution: false register: rundeck_job_run
url: description: - Rundeck instance URL. required: true type: str force: default: false description: - If V(yes) do not get a cached copy. type: bool job_id: description: - The job unique ID. required: true type: str loglevel: choices: - debug - verbose - info - warn - error default: info description: - Log level configuration. type: str api_token: description: - Rundeck User API Token. required: true type: str use_proxy: default: true description: - If V(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. type: bool client_key: description: - PEM formatted file that contains your private key to be used for SSL client authentication. - If O(client_cert) contains both the certificate and key, this option is not required. type: path http_agent: default: ansible-httpget description: - Header to identify as, generally appears in web server logs. type: str use_gssapi: default: false description: - Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. - Requires the Python library L(gssapi,https://github.com/pythongssapi/python-gssapi) to be installed. - Credentials for GSSAPI can be specified with O(url_username)/O(url_password) or with the GSSAPI env var C(KRB5CCNAME) that specified a custom Kerberos credential cache. - NTLM authentication is B(not) supported even if the GSSAPI mech for NTLM has been installed. type: bool version_added: '2.11' version_added_collection: ansible.builtin api_version: default: 39 description: - Rundeck API version to be used. - API version must be at least 14. type: int client_cert: description: - PEM formatted certificate chain file to be used for SSL client authentication. - This file can also include the key as well, and if the key is included, O(client_key) is not required. type: path job_options: description: - The job options for the steps. - Numeric values must be quoted. type: dict run_at_time: description: - Schedule the job execution to run at specific date and time. - ISO-8601 date and time format like C(2021-10-05T15:45:00-03:00). type: str filter_nodes: description: - Filter the nodes where the jobs must run. - See U(https://docs.rundeck.com/docs/manual/11-node-filters.html#node-filter-syntax). type: str url_password: description: - The password for use in HTTP basic authentication. - If the O(url_username) parameter is not specified, the O(url_password) parameter will not be used. type: str url_username: description: - The username for use in HTTP basic authentication. - This parameter can be used without O(url_password) for sites that allow empty passwords type: str validate_certs: default: true description: - If V(no), SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. type: bool wait_execution: default: true description: - Wait until the job finished the execution. type: bool abort_on_timeout: default: false description: - Send a job abort request if exceeded the I(wait_execution_timeout) specified. type: bool force_basic_auth: default: false description: - Credentials specified with O(url_username) and O(url_password) should be passed in HTTP Header. type: bool wait_execution_delay: default: 5 description: - Delay, in seconds, between job execution status check requests. type: int wait_execution_timeout: default: 120 description: - Job execution wait timeout in seconds. - If the timeout is reached, the job will be aborted. - Keep in mind that there is a sleep based on I(wait_execution_delay) after each job status check. type: int
execution_info: description: Rundeck job execution metadata. returned: always sample: execution_info: argstring: -exit_code 0 date-ended: date: '2021-10-05T15:50:26Z' unixtime: 1633449026358 date-started: date: '2021-10-05T15:50:20Z' unixtime: 1633449020784 description: sleep 5 && echo 'Test!' && exit ${option.exit_code} executionType: user href: https://rundeck.example.org/api/39/execution/1 id: 1 job: averageDuration: 4917 description: '' group: '' href: https://rundeck.example.org/api/39/job/697af0c4-72d3-4c15-86a3-b5bfe3c6cb6a id: 697af0c4-72d3-4c15-86a3-b5bfe3c6cb6a name: Test options: exit_code: '0' permalink: https://rundeck.example.org/project/myproject/job/show/697af0c4-72d3-4c15-86a3-b5bfe3c6cb6a project: myproject output: Test! permalink: https://rundeck.example.org/project/myproject/execution/show/1 project: myproject serverUUID: 5b9a1438-fa3a-457e-b254-8f3d70338068 status: succeeded successfulNodes: - localhost user: admin msg: Job execution succeeded! type: dict