theforeman / theforeman.foreman / 4.0.0 / module / wait_for_task Wait for a task | "added in version" 3.13.0 of theforeman.foreman" Authors: Julien Godin (@JGodin-C2C)theforeman.foreman.wait_for_task (4.0.0) — module
Install with ansible-galaxy collection install theforeman.foreman:==4.0.0
collections: - name: theforeman.foreman version: 4.0.0
Wait for a task to finish
- name: Wait for a task to finish theforeman.foreman.wait_for_task: server_url: "https://foreman.example.com" password: changeme username: admin task: a03ba49f-4dc2-4ad6-a48b-b271b46f3347 timeout: 60
- name: Sarch for previously created tasks resource_info: server_url: "https://foreman.example.com" password: changeme username: admin resource: foreman_tasks search: "(label = Actions::Katello::Product::Destroy and action ~ 'Test Product' and state = running)" register: tasks
- name: Wait for all found tasks to finish wait_for_task: server_url: "https://foreman.example.com" password: changeme username: admin task: "{{ item }}" timeout: 900 loop: "{{ tasks.resources | map(attribute='id') | list }}"
task: description: - Task id to wait for. required: true type: str timeout: default: 60 description: - How much time the task should take to be finished required: false type: int 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 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 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
task: description: The finished task returned: success type: dict