-
Notifications
You must be signed in to change notification settings - Fork 2
/
playbook_calljob.yml
29 lines (20 loc) · 1.14 KB
/
playbook_calljob.yml
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
---
- name: Call Jobs
hosts: all
roles:
- dump_variables_host
tasks:
- name: create inventory
shell: /usr/bin/tower-cli inventory create -n {{ guestname }} --organization {{ default_organization }} -u {{ tower_user }} -p {{ tower_password }} -h {{ tower_host }}
- name: create host and join host to inventory
shell: /usr/bin/tower-cli host create -n {{ guestname }}.acme.local -i {{ guestname }} -u {{ tower_user }} -p {{ tower_password }} -h {{ tower_host }}
- name: exec job {{ job_template }}
shell: /usr/bin/tower-cli job launch -v --wait --job-template '{{ job_template }}' --inventory {{ guestname }} -u {{ tower_user }} -p {{ tower_password }} -h {{ tower_host }} --extra-vars=@/tmp/.{{ guestname }}-vars.json
- name: delete host
shell: /usr/bin/tower-cli host delete -n {{ guestname }}.acme.local -u {{ tower_user }} -p {{ tower_password }} -h {{ tower_host }}
- name: delete inventory
shell: /usr/bin/tower-cli inventory delete -n {{ guestname }} -u {{ tower_user }} -p {{ tower_password }} -h {{ tower_host }}
- name: delete vars
file:
path: "/tmp/.{{ guestname }}-vars.json"
state: absent