From 89447107b5fc056ce73dc9be9eba45235300f530 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Fri, 20 Jan 2017 12:01:53 +0000 Subject: [PATCH] Remove hardcoded designate backend Add conditionals to deploy bind9 as backend for designate, this way will easy third parties to deploy or develop custom backends. Change-Id: Ie61a3927ecb9366476cf3fbe0a866f8ea843d100 --- ansible/group_vars/all.yml | 2 ++ ansible/roles/designate/tasks/config.yml | 11 +++++++++++ ansible/roles/designate/tasks/precheck.yml | 2 ++ ansible/roles/designate/tasks/pull.yml | 4 +++- ansible/roles/designate/tasks/start.yml | 4 +++- ansible/roles/designate/templates/pools.yaml.j2 | 2 ++ etc/kolla/globals.yml | 3 ++- 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index b51b98903e..0d478d8291 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -440,6 +440,8 @@ cloudkitty_collector_backend: "ceilometer" ####################### # Designate options ####################### +# Valid options are [ bind9 ] +designate_backend: "bind9" designate_ns_record: "sample.openstack.org" ####################### diff --git a/ansible/roles/designate/tasks/config.yml b/ansible/roles/designate/tasks/config.yml index 0cd4066508..79c15bac41 100644 --- a/ansible/roles/designate/tasks/config.yml +++ b/ansible/roles/designate/tasks/config.yml @@ -61,6 +61,9 @@ - "{{ node_custom_config }}/designate/designate-backend-bind9/named.conf" - "{{ node_custom_config }}/designate/named.conf" - "{{ role_path }}/templates/named.conf.j2" + when: + - designate_backend == 'bind9' + - inventory_hostname in groups['designate-backend-bind9'] - name: Copying over rndc.conf template: @@ -69,6 +72,10 @@ with_items: - "designate-backend-bind9" - "designate-worker" + when: + - designate_backend == 'bind9' + - inventory_hostname in groups['designate-backend-bind9'] + or inventory_hostname in groups['designate-worker'] - name: Copying over rndc.key template: @@ -77,6 +84,10 @@ with_items: - "designate-backend-bind9" - "designate-worker" + when: + - designate_backend == 'bind9' + - inventory_hostname in groups['designate-backend-bind9'] + or inventory_hostname in groups['designate-worker'] - name: Check if policies shall be overwritten local_action: stat path="{{ node_custom_config }}/designate/policy.json" diff --git a/ansible/roles/designate/tasks/precheck.yml b/ansible/roles/designate/tasks/precheck.yml index 775ac0e827..dd8dc1c0f8 100644 --- a/ansible/roles/designate/tasks/precheck.yml +++ b/ansible/roles/designate/tasks/precheck.yml @@ -36,6 +36,7 @@ connect_timeout: 1 state: stopped when: + - designate_backend == 'bind9' - container_facts['designate_backend_bind9'] is not defined - inventory_hostname in groups['designate-backend-bind9'] @@ -46,5 +47,6 @@ connect_timeout: 1 state: stopped when: + - designate_backend == 'bind9' - container_facts['designate_backend_bind9'] is not defined - inventory_hostname in groups['designate-backend-bind9'] diff --git a/ansible/roles/designate/tasks/pull.yml b/ansible/roles/designate/tasks/pull.yml index 4a67bfe62f..a6c0cf81d4 100644 --- a/ansible/roles/designate/tasks/pull.yml +++ b/ansible/roles/designate/tasks/pull.yml @@ -39,4 +39,6 @@ action: "pull_image" common_options: "{{ docker_common_options }}" image: "{{ designate_backend_bind9_image_full }}" - when: inventory_hostname in groups['designate-backend-bind9'] + when: + - designate_backend == 'bind9' + - inventory_hostname in groups['designate-backend-bind9'] diff --git a/ansible/roles/designate/tasks/start.yml b/ansible/roles/designate/tasks/start.yml index d1ff1ca998..444b2f6822 100644 --- a/ansible/roles/designate/tasks/start.yml +++ b/ansible/roles/designate/tasks/start.yml @@ -10,7 +10,9 @@ - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" - "designate_backend_bind9:/var/lib/named/" - when: inventory_hostname in groups['designate-backend-bind9'] + when: + - designate_backend == 'bind9' + - inventory_hostname in groups['designate-backend-bind9'] - name: Starting designate-central container kolla_docker: diff --git a/ansible/roles/designate/templates/pools.yaml.j2 b/ansible/roles/designate/templates/pools.yaml.j2 index 14b8078733..f3b0aca03f 100644 --- a/ansible/roles/designate/templates/pools.yaml.j2 +++ b/ansible/roles/designate/templates/pools.yaml.j2 @@ -1,3 +1,4 @@ +{% if designate_backend == 'bind9' %} - name: default-bind id: {{ designate_pool_id }} description: Default BIND9 Pool @@ -26,3 +27,4 @@ rndc_port: {{ designate_rndc_port }} rndc_key_file: /etc/designate/rndc.key {% endfor %} +{% endif %} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index e8e288fbf3..50df81bcc4 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -253,9 +253,10 @@ kolla_internal_vip_address: "10.10.10.254" ####################### # Designate options ####################### +# Valid options are [ bind9 ] +designate_backend: "bind9" designate_ns_record: "sample.openstack.org" - ######################### # Nova - Compute Options #########################