summaryrefslogtreecommitdiff
path: root/test/integration/targets/tower_job_launch/tasks/main.yml
blob: 7550377905b2842e40aefda5cf65a99b8999fbd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
- 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'"

- 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'"

- 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.'"

- 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'"