-
Notifications
You must be signed in to change notification settings - Fork 3
/
airflow.yml
74 lines (68 loc) · 2.04 KB
/
airflow.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# The playbook for installing airflow.
# This assumes the docker playbook has already run.
#
- name: Playbook for Airflow
hosts: all
become: yes
become_method: sudo
tasks:
- name: Create airflow folders
become: no
file:
path: "{{item}}"
state: directory
with_items:
- "{{deploy_home}}"
- "{{airflow_dags_home}}"
- "{{airflow_db_home}}"
- name: Ensure supervisor is installed (for daemonizing docker-compose)
apt:
name: supervisor
- name: Write supervisor config for airflow
copy:
dest: /etc/supervisor/conf.d/airflow.conf
content: |
[program:airflow]
command=docker-compose -f {{deploy_home}}/docker-compose.yml up
directory={{deploy_home}}
autostart=true
autorestart=true
startretries=3
user={{deploy_user}}
environment=HOME={{deploy_home}}
- name: Write docker-compose config for airflow
become: no
copy:
dest: "{{deploy_home}}/docker-compose.yml"
content: |
version: '2'
services:
postgres:
image: {{docker_pg_image}}
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
volumes:
- {{airflow_db_home}}:/var/lib/postgresql/data
webserver:
image: {{docker_airflow_image}}
restart: always
depends_on:
- postgres
environment:
- LOAD_EX=y
- EXECUTOR=Local
volumes:
- {{airflow_dags_home}}:/usr/local/airflow/dags
ports:
- "{{airflow_port}}:8080"
command: webserver
- name: Ensure docker images have been pulled
docker_image:
name: "{{item}}"
with_items:
- "{{docker_pg_image}}"
- "{{docker_airflow_image}}"
- include: tasks/supervisor-reload.yml