Skip to content

Commit

Permalink
Merge pull request #23 from tulibraries/make-airflow-home-envvar
Browse files Browse the repository at this point in the history
replacing airflow_home from config with envvar, per airflow deprecation warning
  • Loading branch information
sensei100 authored Sep 30, 2019
2 parents 9c4cd72 + 0df889a commit b2848e4
Show file tree
Hide file tree
Showing 13 changed files with 553 additions and 333 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.6
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ verify_ssl = true
pytest = "*"
pylint = "*"
docker = "*"
ansible = "*"

[packages]
molecule = "*"

[requires]
python_version = "3.7"
python_version = "3.6"
836 changes: 535 additions & 301 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ airflow_do_upgrade_db: True
# Default configuration
airflow_defaults_config:
core:
airflow_home: "{{ airflow_user_home_path ~ '/airflow' }}"
airflow_home_mode: "0700"
dags_folder: "{{ airflow_user_home_path ~ '/airflow/dags' }}"
dags_folder_mode: "0755"
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_debian_ubuntu_prerequisites_packages(host, name, codenames):


@pytest.mark.parametrize('name,codenames', [
('python36-devel', None),
('python3-devel', None),
('openssl-devel', None),
('libffi-devel', None),
('libxml2', None),
Expand Down
10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: 'INSTALL | Include installation tasks'
import_tasks: "manage_installation.yml"
environment:
AIRFLOW_HOME: '{{ airflow_config.core.airflow_home }}'
AIRFLOW_HOME: "{{ airflow_user_home_path ~ '/airflow' }}"
become: True
tags:
- 'role::airflow'
Expand All @@ -25,7 +25,7 @@
- name: 'CONFIG | Include configuration tasks'
import_tasks: "manage_configuration.yml"
environment:
AIRFLOW_HOME: '{{ airflow_config.core.airflow_home }}'
AIRFLOW_HOME: "{{ airflow_user_home_path ~ '/airflow' }}"
become: True
tags:
- 'role::airflow'
Expand All @@ -46,7 +46,7 @@
- name: 'CONFIG | Include connections tasks'
import_tasks: "manage_connections.yml"
environment:
AIRFLOW_HOME: '{{ airflow_config.core.airflow_home }}'
AIRFLOW_HOME: "{{ airflow_user_home_path ~ '/airflow' }}"
become: True
tags:
- 'role::airflow'
Expand All @@ -57,7 +57,7 @@
- name: 'CONFIG | Include connections tasks'
import_tasks: "manage_airflow_variables.yml"
environment:
AIRFLOW_HOME: '{{ airflow_config.core.airflow_home }}'
AIRFLOW_HOME: "{{ airflow_user_home_path ~ '/airflow' }}"
become: True
tags:
- 'role::airflow'
Expand All @@ -67,7 +67,7 @@
- name: 'CONFIG | Include DAG codebases'
import_tasks: "manage_dags.yml"
environment:
AIRFLOW_HOME: '{{ airflow_config.core.airflow_home }}'
AIRFLOW_HOME: "{{ airflow_user_home_path ~ '/airflow' }}"
become: True
tags:
- 'role::airflow'
Expand Down
4 changes: 2 additions & 2 deletions tasks/manage_configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
become: true
template:
src: "templates/airflow.cfg.j2"
dest: "{{ airflow_config.core.airflow_home }}/airflow.cfg"
dest: "{{ airflow_user_home_path ~ '/airflow' }}/airflow.cfg"
owner: "{{ airflow_user_name }}"
group: "{{ airflow_user_group }}"
mode: '0400'
Expand Down Expand Up @@ -52,7 +52,7 @@
- name: 'CONFIG | Generate Webserver Config if RBAC is enabled'
template:
src: "templates/webserver_config.py"
dest: "{{ airflow_config.core.airflow_home }}/webserver_config.py"
dest: "{{ airflow_user_home_path ~ '/airflow' }}/webserver_config.py"
owner: "{{ airflow_user_name }}"
group: "{{ airflow_user_group }}"
mode: '0400'
Expand Down
4 changes: 2 additions & 2 deletions tasks/manage_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# This has to happen before the install, because the install creates a default file in $AIRFLOW_HOME
- name: 'INSTALL | Check if configuration file exists'
stat:
path: "{{ airflow_config.core.airflow_home }}/airflow.cfg"
path: "{{ airflow_user_home_path ~ '/airflow' }}/airflow.cfg"
register: 'airflow_config_stat'
changed_when: False

Expand All @@ -48,7 +48,7 @@

- name: 'INSTALL | Manage permissions on airflow home directory'
file:
path: "{{ airflow_config.core.airflow_home }}"
path: "{{ airflow_user_home_path ~ '/airflow' }}"
owner: "{{ airflow_user_name }}"
group: "{{ airflow_user_name }}"
mode: "{{ airflow_config.core.airflow_home_mode }}"
Expand Down
4 changes: 2 additions & 2 deletions templates/airflow.env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:{{ airflow_virtualenv ~ '/bin' }}:{{ airflow_user_home_path }}.local/bin:$PATH"

# General
AIRFLOW_HOME="{{ airflow_config.core.airflow_home }}"
AIRFLOW_CONFIG="{{ airflow_config.core.airflow_home }}/airflow.cfg"
AIRFLOW_HOME="{{ airflow_user_home_path ~ '/airflow' }}"
AIRFLOW_CONFIG="{{ airflow_user_home_path ~ '/airflow' }}/airflow.cfg"
AIRFLOW_BINARY_PATH="{{ airflow_virtualenv ~ '/bin' }}"

# Webserver specific
Expand Down
2 changes: 1 addition & 1 deletion templates/airflow.profile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# {{ ansible_managed }}

# General
export AIRFLOW_HOME="{{ airflow_config.core.airflow_home }}"
export AIRFLOW_HOME="{{ airflow_user_home_path ~ '/airflow' }}"
export PATH="$PATH:{{ airflow_virtualenv ~ '/bin' }}"
2 changes: 1 addition & 1 deletion vars/os_distribution/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Centos 7 specific vars

# Python
_airflow_python_version: 'python36'
_airflow_python_version: 'python3'

# Services management
_is_systemd_managed_system: True
2 changes: 1 addition & 1 deletion vars/os_family/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RedHat CentOS 7 family specific vars

_airflow_system_dependencies:
- name: 'python36-devel'
- name: 'python3-devel'
- name: 'postgresql-devel'
- name: 'openssl-devel'
- name: 'libffi-devel'
Expand Down

0 comments on commit b2848e4

Please sign in to comment.