added files

This commit is contained in:
Alexander Gabriel 2023-06-20 23:19:46 +02:00
commit c024706d56
5 changed files with 1355 additions and 0 deletions

5
defaults/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
postgresql_hostname: localhost
postgresql_database: airflow_db
postgresql_username: airflow_user
postgresql_password: airflow_pass

24
handlers/main.yml Normal file
View File

@ -0,0 +1,24 @@
---
- name: reload systemd
command: systemctl daemon-reload
- name: restart keycloak
service:
name: keycloak
state: restarted
- name: restart apache2
service:
name: apache2
state: restarted
- name: restart airflow
service:
name: airflow
state: restarted
- name: reload apache2
service:
name: apache2
state: reloaded

71
tasks/main.yml Normal file
View File

@ -0,0 +1,71 @@
---
- name: Install required packages
apt:
name:
- python3-pip
- python-is-python3
update_cache: yes
- name: Install pip package apache-airflow
ansible.builtin.pip:
name: apache-airflow
- name: Add the user 'airflow'
ansible.builtin.user:
name: airflow
system: true
- 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
mode: "0644"
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/

1242
templates/airflow.cfg.j2 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
[Unit]
Description=Apache Airflow
[Service]
User=airflow
Group=airflow
Type=simple
ExecStart=/usr/local/bin/airflow standalone
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target