92 lines
2.0 KiB
YAML
92 lines
2.0 KiB
YAML
---
|
|
- name: Install required packages
|
|
apt:
|
|
name:
|
|
- python3-pip
|
|
- python-is-python3
|
|
- python3-full
|
|
- python3-virtualenv
|
|
- python3-psycopg2
|
|
- libpq-dev
|
|
update_cache: yes
|
|
|
|
- name: Add the user 'airflow'
|
|
ansible.builtin.user:
|
|
name: airflow
|
|
|
|
- name: Install pip package apache-airflow
|
|
ansible.builtin.pip:
|
|
name: apache-airflow[celery]==2.6.2
|
|
virtualenv: /home/airflow/airflow
|
|
virtualenv_python: python3
|
|
extra_args: --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.6.2/constraints-3.7.txt"
|
|
|
|
- name: Install pip package psycopg2
|
|
ansible.builtin.pip:
|
|
name: psycopg2
|
|
virtualenv: /home/airflow/airflow
|
|
virtualenv_python: python3
|
|
|
|
- name: generate /etc/systemd/system/airflow.service
|
|
template:
|
|
src: airflow.service.j2
|
|
dest: /etc/systemd/system/airflow.service
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify:
|
|
- reload systemd
|
|
|
|
- name: Flush handlers
|
|
meta: flush_handlers
|
|
|
|
- name: enable airflow
|
|
systemd:
|
|
name: airflow
|
|
enabled: yes
|
|
masked: no
|
|
notify:
|
|
restart airflow
|
|
|
|
- name: generate /home/airflow/airflow/airflow.cfg
|
|
template:
|
|
src: airflow.cfg.j2
|
|
dest: /home/airflow/airflow/airflow.cfg
|
|
owner: airflow
|
|
group: airflow
|
|
notify:
|
|
- restart airflow
|
|
|
|
- name: set permissions correct
|
|
file:
|
|
dest: /home/airflow/airflow
|
|
owner: airflow
|
|
group: airflow
|
|
recurse: yes
|
|
notify:
|
|
- restart airflow
|
|
|
|
- name: Flush handlers
|
|
meta: flush_handlers
|
|
|
|
- name: include role for database
|
|
include_role:
|
|
name: postgresql
|
|
|
|
- name: include role for website
|
|
include_role:
|
|
name: website
|
|
vars:
|
|
domainname: "{{ inventory_hostname }}"
|
|
docroot: "/var/www/html"
|
|
optionalDirectives: |
|
|
ProxyPreserveHost On
|
|
SSLProxyEngine On
|
|
SSLProxyCheckPeerCN on
|
|
SSLProxyCheckPeerExpire on
|
|
RequestHeader set X-Forwarded-Proto "https"
|
|
RequestHeader set X-Forwarded-Port "443"
|
|
ProxyPass / http://127.0.0.1:8080/
|
|
ProxyPassReverse / http://127.0.0.1:8080/
|
|
|