2018-03-16 18:28:19 +01:00
|
|
|
- name: Launch a Job Template
|
|
|
|
tower_job_launch:
|
|
|
|
job_template: "Demo Job Template"
|
|
|
|
inventory: "Demo Inventory"
|
|
|
|
credential: "Demo Credential"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result is changed"
|
|
|
|
- "result.status == 'pending'"
|
2019-01-09 15:31:21 +01:00
|
|
|
|
2019-04-09 15:08:11 +02:00
|
|
|
- name: Wait for a job template to complete
|
|
|
|
tower_job_wait:
|
|
|
|
job_id: "{{ result.id }}"
|
|
|
|
max_interval: 10
|
|
|
|
timeout: 120
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result is not changed"
|
|
|
|
- "result.status == 'successful'"
|
|
|
|
|
2019-01-09 15:31:21 +01:00
|
|
|
- name: Check module fails with correct msg
|
|
|
|
tower_job_launch:
|
|
|
|
job_template: "Non Existing Job Template"
|
|
|
|
inventory: "Test Inventory"
|
|
|
|
credential: "Test Credential"
|
|
|
|
register: result
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.msg =='Unable to launch job, job_template/Non Existing Job Template was not found: The requested object could not be found.'"
|
2019-04-09 15:08:11 +02:00
|
|
|
|
|
|
|
- name: Create a Job Template for testing prompt on launch
|
|
|
|
tower_job_template:
|
|
|
|
name: "Demo Job Template - ask inventory and credential"
|
|
|
|
project: Demo Project
|
|
|
|
playbook: hello_world.yml
|
|
|
|
job_type: run
|
|
|
|
ask_credential: yes
|
|
|
|
ask_inventory: yes
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Launch job template with inventory and credential for prompt on launch
|
|
|
|
tower_job_launch:
|
|
|
|
job_template: "Demo Job Template - ask inventory and credential"
|
|
|
|
inventory: "Demo Inventory"
|
|
|
|
credential: "Demo Credential"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result is changed"
|
|
|
|
- "result.status == 'pending'"
|