-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#50 Fix Airflow extra packages scenario and compatibility with more A…
…nsible versions
- Loading branch information
Jose
committed
Jun 18, 2019
1 parent
e9aa492
commit ded5be3
Showing
14 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Molecule managed | ||
|
||
{% if item.registry is defined %} | ||
FROM {{ item.registry.url }}/{{ item.image }} | ||
{% else %} | ||
FROM {{ item.image }} | ||
{% endif %} | ||
|
||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates systemd systemd-sysv && apt-get clean; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from datetime import datetime | ||
from airflow import DAG | ||
from airflow.operators.dummy_operator import DummyOperator | ||
|
||
args = { | ||
'owner': 'airflow', | ||
'start_date': datetime(2017, 9, 10, 0, 0), | ||
'random_logic': False | ||
} | ||
|
||
dag = DAG( | ||
'sample_dag', | ||
schedule_interval="@once", | ||
default_args=args | ||
) | ||
|
||
t1 = DummyOperator( | ||
task_id='extract_data', | ||
dag=dag | ||
) | ||
|
||
t2 = DummyOperator( | ||
task_id='load_data', | ||
dag=dag | ||
) | ||
|
||
t3 = DummyOperator( | ||
task_id='random_task', | ||
dag=dag | ||
) | ||
|
||
t1.set_downstream(t2) | ||
t2.set_downstream(t3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
airflow_fernet_key: xKy13nPFfDflJ0DYGVTwf_DEmbItfURHlEDxrt-bBQw= | ||
|
||
airflow_required_libs: | ||
- acl | ||
- python-pip | ||
- python-mysqldb | ||
|
||
airflow_extra_packages: | ||
- celery | ||
- mysql | ||
|
||
# airflow_extra_packages: celery, mysql | ||
|
||
# airflow_extra_packages: [celery, mysql] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
lint: | ||
name: yamllint | ||
enabled: False | ||
|
||
platforms: | ||
- name: airflow_extra_packages-${MOLECULE_DISTRO:-stretch} | ||
image: debian:${MOLECULE_DISTRO:-stretch} | ||
privileged: true | ||
capabilities: | ||
- SYS_ADMIN | ||
volumes: | ||
- '/sys/fs/cgroup:/sys/fs/cgroup:ro' | ||
groups: | ||
- airflow | ||
command: '/lib/systemd/systemd' | ||
|
||
provisioner: | ||
name: ansible | ||
lint: | ||
name: ansible-lint | ||
enabled: False | ||
scenario: | ||
name: extra_packages | ||
verifier: | ||
name: goss | ||
lint: | ||
name: yamllint | ||
enabled: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
|
||
- name: Converge | ||
hosts: all | ||
roles: | ||
- role: airflow-role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
service: | ||
{% for airflow_service in airflow_services %} | ||
{% if airflow_services[airflow_service]["enabled"] %} | ||
{{ airflow_service }}: | ||
enabled: true | ||
running: true | ||
{% endif %} | ||
{% endfor %} | ||
|
||
user: | ||
{{ airflow_user }}: | ||
exists: true | ||
groups: | ||
- {{ airflow_group }} | ||
|
||
group: | ||
{{ airflow_group }}: | ||
exists: true | ||
|
||
command: | ||
/usr/local/bin/airflow version: | ||
exit-status: 0 | ||
stdout: | ||
- "{{ airflow_version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
# This is an example playbook to execute goss tests. | ||
# Tests need distributed to the appropriate ansible host/groups | ||
# prior to execution by `goss validate`. | ||
|
||
- name: Verify | ||
hosts: all | ||
become: true | ||
vars: | ||
goss_version: v0.3.7 | ||
goss_arch: amd64 | ||
goss_dst: /usr/local/bin/goss | ||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" | ||
goss_test_directory: /tmp | ||
goss_format: documentation | ||
|
||
vars_files: | ||
- ../../defaults/main.yml | ||
- ./group_vars/airflow/main.yml | ||
|
||
tasks: | ||
- name: Download and install Goss | ||
get_url: | ||
url: "{{ goss_url }}" | ||
dest: "{{ goss_dst }}" | ||
mode: 0755 | ||
register: download_goss | ||
until: download_goss is succeeded | ||
retries: 3 | ||
|
||
- name: Copy Goss tests to remote | ||
template: | ||
src: "{{ item }}" | ||
dest: "{{ goss_test_directory }}/{{ item | basename }}" | ||
with_fileglob: | ||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" | ||
|
||
- name: Register test files | ||
shell: "ls {{ goss_test_directory }}/test_*.yml" | ||
register: test_files | ||
|
||
- name: Execute Goss tests | ||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }} --retry-timeout 10s" | ||
register: test_results | ||
with_items: "{{ test_files.stdout_lines }}" | ||
|
||
- name: Display details about the Goss results | ||
debug: | ||
msg: "{{ item.stdout_lines }}" | ||
with_items: "{{ test_results.results }}" | ||
|
||
- name: Fail when tests fail | ||
fail: | ||
msg: "Goss failed to validate" | ||
when: item.rc != 0 | ||
with_items: "{{ test_results.results }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
ansible==2.4.5.0 | ||
molecule==2.20.1 | ||
docker==3.7.2 |