From 87eb5d46cd6a3266e6c459263829ee77260feffd Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 19 Mar 2021 18:57:54 +0200 Subject: [PATCH] Update pool when pools.yaml is changed Move designate-mange pool update command to handlers since we need to run it only when pools.yaml is changed. We also don't need to restart designate service, when pools.yaml is updated. Change-Id: I7f3d6bd777ce5a6e0f3372f0f6e29cb5499d5419 --- handlers/main.yml | 8 ++++++++ tasks/designate_db_sync.yml | 8 -------- tasks/designate_post_install.yml | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index f4f7761..dfc0269 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -59,6 +59,14 @@ - "Restart designate services" - "venv changed" +- name: Perform Designate pools update + command: "{{ designate_bin }}/designate-manage pool update --file /etc/designate/pools.yaml" + become: yes + become_user: "{{ designate_system_user_name }}" + changed_when: false + when: designate_pools_yaml is defined + notify: Restart designate services + - name: Start services systemd: name: "{{ item.service_name }}" diff --git a/tasks/designate_db_sync.yml b/tasks/designate_db_sync.yml index 98235e9..61f0122 100644 --- a/tasks/designate_db_sync.yml +++ b/tasks/designate_db_sync.yml @@ -18,11 +18,3 @@ become: yes become_user: "{{ designate_system_user_name }}" changed_when: false - -- name: Perform a Designate DNS pools update - command: "{{ designate_bin }}/designate-manage pool update" - become: yes - become_user: "{{ designate_system_user_name }}" - changed_when: false - when: designate_pools_yaml is defined - notify: Restart designate services diff --git a/tasks/designate_post_install.yml b/tasks/designate_post_install.yml index 86d356b..b61494a 100644 --- a/tasks/designate_post_install.yml +++ b/tasks/designate_post_install.yml @@ -69,6 +69,7 @@ content: "{{ designate_pools_yaml | to_nice_yaml }}" dest: "/etc/designate/pools.yaml" when: designate_pools_yaml is defined + notify: Perform Designate pools update - name: Create Designate rndc key file template: