This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
job-runner.yml
50 lines (46 loc) · 2.24 KB
/
job-runner.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
- name: Prepare any necessary Tower components exist then launch job
hosts: localhost
connection: local
gather_facts: false
become: false
vars:
job_project_name: >-
{{
job_vars['__meta__']['deployer']['scm_url'] ~ ' '
~ job_vars['__meta__']['deployer']['scm_ref']
}}
job_template_name: >-
{{
job_vars['__meta__']['tower']['action'] ~ '-'
~ job_vars['__meta__']['deployer']['type'] ~ '-'
~ job_vars['__meta__']['deployer']['scm_ref'] ~ '-'
~ job_vars['guid']
}}
job_forks: "{{ job_vars['__meta__']['tower']['forks'] | default(10) }}"
job_template_timeout: "{{ job_vars['__meta__']['tower']['timeout'] | default(3*60*60) }}"
job_playbook: "{{ job_vars['__meta__']['deployer']['entry_point'] }}"
job_virtualenv: "{{ job_vars['__meta__']['deployer']['virtualenv'] | default('') }}"
_job_virtualenv: >-
{%- if job_virtualenv is match('/') -%}
{{ job_virtualenv }}
{%- elif job_virtualenv != '' -%}
/opt/rh/virtualenvs/{{ job_virtualenv }}
{%- endif -%}
ansible_tower_host: "{{ lookup('env', 'TOWER_HOST') }}"
ansible_tower_base_url: "https://{{ ansible_tower_host }}"
ansible_tower_username: "{{ lookup('env', 'TOWER_USERNAME') }}"
ansible_tower_password: "{{ lookup('env', 'TOWER_PASSWORD') }}"
ansible_tower_verify_ssl: "{{ lookup('env', 'TOWER_VERIFY_SSL') | bool }}"
roles:
- babylon-security-checks # IMPORTANT - keep as first role
- babylon-api-checks # Validation and additional logging
- create-job-manifest # Create a record of job prior to running
# - babylon-setup-for-new-job # Select execution instance groups etc
# - git-tag-lookup # Optionally select optimal stage git tag
- confirm-tower-organization # Ensure correct organization exists
- confirm-tower-project # Confirm correct repo AND tag/reference
- confirm-tower-job-template # Create 1 time job template
- launch-tower-job # Launch job with callbacks
- post-job-housekeeping # Cleanup 1 time objects plus misc cleanup
...