From aad1580f566a6ce84be03f50292c8c3fd75b0418 Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Tue, 3 Jan 2023 13:20:56 -0300 Subject: [PATCH 1/2] replace shortcode with full subcommand name. Airflow does not support `-s` and `-a` anymore. --- tasks/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/config.yml b/tasks/config.yml index e90e393..35f4207 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -111,7 +111,7 @@ tags: airflow-extra-config - name: Airflow | Add variables from configuration file - command: "{{ airflow_executable }} variables -s {{ item.key }} {{ item.value }}" + command: "{{ airflow_executable }} variables set {{ item.key }} {{ item.value }}" become: true become_user: "{{ airflow_user }}" with_items: "{{ airflow_admin_variables }}" @@ -120,7 +120,7 @@ - airflow-extra-vars-file - name: Airflow | Add connections from configuration file - command: "{{ airflow_executable }} connections -a \ + command: "{{ airflow_executable }} connections add \ {% for key, value in item.iteritems() %}--{{ key }} '{{ value }}' \ {% endfor %}" become: true From 0b273ca8c041c57b623a9f7ef0c1ca51db1c021e Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Tue, 3 Jan 2023 13:38:38 -0300 Subject: [PATCH 2/2] Change extra connections loop logic To be compatible with python3 and also airflow cli syntax --- tasks/config.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/config.yml b/tasks/config.yml index 35f4207..2f9a9bb 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -121,8 +121,11 @@ - name: Airflow | Add connections from configuration file command: "{{ airflow_executable }} connections add \ - {% for key, value in item.iteritems() %}--{{ key }} '{{ value }}' \ - {% endfor %}" + {% for key, value in item.items() %} \ + {% if key == 'conn_id' %} {{ value }} \ + {% else %} --{{ key | replace('_', '-') }} '{{ value }}' \ + {% endif %} \ + {% endfor %}" become: true become_user: "{{ airflow_user }}" with_items: "{{ airflow_admin_connections }}"