Skip to content

Commit

Permalink
Merge pull request #122 from idealista/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Plozano94 authored Feb 7, 2023
2 parents 8b26662 + aefce72 commit 3d068a3
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 320 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
dist: xenial
dist: focal
language: python
python: "3.7"
python: "3.9"
os: linux
services:
- docker
install:
- pip install pipenv
- pip install -I pipenv
- pipenv sync
env:
jobs:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).

## [Unreleased](https://github.com/idealista/airflow-role/tree/develop)
### Fixed
- :hammer_and_wrench: Allow intalling only some services
- :hammer_and_wrench: Updating travis environment

### Changed

- :arrows_clockwise: Moving copy tasks of services to service.yml

## [2.0.5](https://github.com/idealista/airflow-role/tree/2.0.5)

Expand Down
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ verify_ssl = true
[dev-packages]

[packages]
ansible = "==2.9.21"
ansible = "==2.9.27"
molecule = "==3.0.8"
docker = "==4.1.0"
docker = "==4.4.4"
ansible-lint = "==4.2.0"

[requires]
python_version = "3.7"
python_version = "3.9"
686 changes: 423 additions & 263 deletions Pipfile.lock

Large diffs are not rendered by default.

37 changes: 8 additions & 29 deletions tasks/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Airflow | Ensure airflow directories structure
file:
path: "{{ item }}"
Expand Down Expand Up @@ -31,10 +30,7 @@
register: airflow_config
when: airflow_version is version( '2.0.0', '>=')
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags: airflow-webserver-config-py

- name: Airflow | Copy basic airflow config file (< 2.0)
Expand All @@ -47,10 +43,7 @@
register: airflow_config
when: airflow_version is version( '2.0.0', '<')
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags: airflow-cfg

- name: Airflow | Copy basic airflow config file (>= 2.0)
Expand All @@ -63,10 +56,7 @@
register: airflow_config
when: airflow_version is version( '2.0.0', '>=')
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags: airflow-cfg

- name: Airflow | Initializing DB < 2.0
Expand All @@ -77,10 +67,7 @@
- airflow_version is version( '2.0.0', '<')
- (airflow_install.changed or airflow_config.changed)
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags:
- airflow-db-init
- skip_ansible_lint
Expand All @@ -93,10 +80,7 @@
- airflow_version is version( '2.0.0', '>=')
- airflow_install.changed or airflow_config.changed
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags: airflow-db-init

- name: Airflow | Copy extra airflow config files (provided by playbooks)
Expand All @@ -109,10 +93,7 @@
with_fileglob:
- "{{ airflow_extra_conf_path }}/*"
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
tags: airflow-extra-config

- name: Airflow | Copy extra airflow config templates (provided by playbooks)
Expand All @@ -125,10 +106,8 @@
with_fileglob:
- "{{ airflow_extra_conf_template_path }}/*"
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"

tags: airflow-extra-config

- name: Airflow | Add variables from configuration file
Expand Down
22 changes: 1 addition & 21 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,4 @@
with_items: "{{ dags_dependencies }}"
when: dags_dependencies is defined
notify:
- restart airflow-webserver
- restart airflow-scheduler
- restart airflow-worker
- restart airflow-flower

- name: Airflow | Copy Environment File
template:
src: airflow-environment-file.j2
dest: "{{ airflow_environment_file_folder }}/airflow"
mode: 0644
owner: "{{ airflow_user }}"
group: "{{ airflow_group }}"

- name: Airflow | Copy Daemon scripts
template:
src: "{{ item.value.path }}"
dest: "/lib/systemd/system/{{ item.value.service_name }}.service"
mode: 0644
notify: restart {{ item.value.service_name }}
with_dict: "{{ airflow_services }}"
when: item.value.enabled
"{{ ['restart'] | product(airflow_services.values() | map(attribute='service_name')) | map('join', ' ') | list }}"
19 changes: 18 additions & 1 deletion tasks/service.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
---

- name: Airflow | Copy Environment File
template:
src: airflow-environment-file.j2
dest: "{{ airflow_environment_file_folder }}/airflow"
mode: 0644
owner: "{{ airflow_user }}"
group: "{{ airflow_group }}"

- name: Airflow | Copy Daemon scripts
template:
src: "{{ item.value.path }}"
dest: "/lib/systemd/system/{{ item.value.service_name }}.service"
mode: 0644
notify: restart {{ item.value.service_name }}
with_dict: "{{ airflow_services }}"
when: airflow_services is defined

- name: Airflow | Configuring service
systemd:
name: "{{ item.value.service_name }}"
state: "{{ item.value.state }}"
enabled: "{{ item.value.enabled }}"
daemon_reload: true
with_dict: "{{ airflow_services }}"
when: item.value.enabled
when: airflow_services is defined
changed_when: false

0 comments on commit 3d068a3

Please sign in to comment.