Configure pools.yaml inside Designate role

This adds the ability for a user to configure the Designate
pools.yaml file inside of the role by specifying an attribute.

Because the data required is yaml, it's a nice mapping to specify
the yaml attribute and have it dumped directly to the pools.yaml
file.

This allows users to use attributes from other plays (perhaps setting
up some complex DNS infrastructure in their cloud) and insert them
into Designate without having to write their own template or supply
their own file.

This also invokes the `designate-manage` command to load the pools.yaml
file into the Designate database, and simplifies the tests that
do the pools.yaml needful.

Change-Id: I11a849898bf33aa6b8aa6605296ac7fd733d7c01
This commit is contained in:
Tim Simmons
2017-01-26 20:21:30 +00:00
parent 5ba88401eb
commit 69877f3437
11 changed files with 90 additions and 112 deletions

View File

@@ -80,13 +80,44 @@ designate_pool_target_uuid: f02a0c72-c701-4ec2-85d7-197b30992ce9
# Enable/Disable Ceilometer
designate_ceilometer_enabled: False
# Designate APIs enabled
designate_enable_v1_api: True
designate_enable_v2_api: True
# Designate services info
designate_role_name: admin
## DNS Backend Configuration
# Configuration for the DNS backend that Designate will talk to, Designate
# supports lots of backends, bind9, powerdns, nsd, djb, dyn, akamai, etc.
# DNS Backends are configured via a YAML file that Designate reads. The DNS
# server need not be in the actual Designate container, but for development,
# or for some internal addressing use cases, it may make sense.
# YAML to use for the Designate pools.yaml file. If this variable is defined,
# a pools.yaml file will be written to /etc/designate/pools.yaml with the
# provided YAML data.
#
# This is some example pools.yaml information that will work with a
# simple bind9 installation in the same container as Designate.
# designate_pools_yaml:
# - name: "default"
# description: Default BIND9 Pool
# attributes: {}
# ns_records:
# - hostname: ns1.example.org.
# priority: 1
# nameservers:
# - host: 127.0.0.1
# port: 53
# targets:
# - type: bind9
# description: BIND9 Server
# masters:
# - host: 127.0.0.1
# port: 5354
# options:
# host: 127.0.0.1
# port: 53
# rndc_host: 127.0.0.1
# rndc_port: 953
## Service Type and Data
designate_service_region: RegionOne
designate_service_endpoint_type: internalURL

View File

@@ -12,6 +12,11 @@ This role will install the following services:
* designate-mdns
* designate-sink
The DNS servers Designate will interface with can be defined in the
``designate_pools_yaml`` variable. This is eventually written to the Designate
`pools.yaml <http://docs.openstack.org/developer/designate/pools.html#managing-pools>`_
file.
To clone or view the source code for this repository, visit the role repository
for `os_designate <https://github.com/openstack/openstack-ansible-os_designate>`_.

View File

@@ -0,0 +1,11 @@
---
features:
- The Designate pools.yaml file can now be generated via the
designate_pools_yaml attribute, if desired. This allows users to populate
the Designate DNS server configuration using attributes from other plays
and obviates the need to manage the file outside of the Designate role.
upgrade:
- The Designate pools.yaml file can now be generated via the
designate_pools_yaml attribute, if desired. This ability is toggled by
the designate_use_pools_yaml_attr attribute. In the future this behavior
may become default and designate_pools_yaml may become a required variable.

View File

@@ -24,3 +24,11 @@
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

View File

@@ -43,6 +43,12 @@
config_type: "ini"
notify: Restart designate services
- name: Create Designate pools.yaml file
copy:
content: "{{ designate_pools_yaml | to_nice_yaml }}"
dest: "/etc/designate/pools.yaml"
when: designate_pools_yaml is defined
- name: Copy rootwrap filters
copy:
src: "{{ item }}"

View File

@@ -41,6 +41,9 @@
tags:
- designate-install
- name: Flush handlers
meta: flush_handlers
- include: designate_db_setup.yml
when: inventory_hostname == groups['designate_all'][0]
tags:

View File

@@ -85,7 +85,7 @@ rabbit_notification_topic = notifications
#threads = 1000
# Enable host request headers
#enable_host_header = False
enable_host_header = True
# The base uri used in responses
#api_base_uri = 'http://127.0.0.1:9001/'

View File

@@ -34,6 +34,27 @@ designate_rabbitmq_servers: "{{ rabbitmq_servers }}"
designate_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
designate_rabbitmq_port: "{{ rabbitmq_port }}"
designate_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin"
designate_pools_yaml:
- name: "default"
description: Default BIND9 Pool
attributes: {}
ns_records:
- hostname: ns1.example.org.
priority: 1
nameservers:
- host: 127.0.0.1
port: 53
targets:
- type: bind9
description: BIND9 Server
masters:
- host: 127.0.0.1
port: 5354
options:
host: 127.0.0.1
port: 53
rndc_host: 127.0.0.1
rndc_port: 953
tempest_run: yes

View File

@@ -1,44 +0,0 @@
- name: default
# The name is immutable. There will be no option to change the name after
# creation and the only way will to change it will be to delete it
# (and all zones associated with it) and recreate it.
description: Default BIND9 Pool
attributes: {}
# List out the NS records for zones hosted within this pool
ns_records:
- hostname: ns1-1.example.org.
priority: 1
# List out the nameservers for this pool. These are the actual BIND servers.
# We use these to verify changes have propagated to all nameservers.
nameservers:
- host: 127.0.0.1
port: 53
# List out the targets for this pool. For BIND, most often, there will be one
# entry for each BIND server.
targets:
- type: bind9
description: BIND9 Server 1
# List out the designate-mdns servers from which BIND servers should
# request zone transfers (AXFRs) from.
masters:
- host: 127.0.0.1
port: 5354
# BIND Configuration options
options:
host: 127.0.0.1
port: 53
rndc_host: 127.0.0.1
rndc_port: 953
rndc_key_file: /etc/bind/rndc.key
# Optional list of additional IP/Port's for which designate-mdns will send
# DNS NOTIFY packets to
# also_notifies:
# - host: 192.0.2.4
# port: 53

View File

@@ -1,44 +0,0 @@
- name: default
# The name is immutable. There will be no option to change the name after
# creation and the only way will to change it will be to delete it
# (and all zones associated with it) and recreate it.
description: Default BIND9 Pool
attributes: {}
# List out the NS records for zones hosted within this pool
ns_records:
- hostname: ns1-1.example.org.
priority: 1
# List out the nameservers for this pool. These are the actual BIND servers.
# We use these to verify changes have propagated to all nameservers.
nameservers:
- host: 127.0.0.1
port: 53
# List out the targets for this pool. For BIND, most often, there will be one
# entry for each BIND server.
targets:
- type: bind9
description: BIND9 Server 1
# List out the designate-mdns servers from which BIND servers should
# request zone transfers (AXFRs) from.
masters:
- host: 127.0.0.1
port: 5354
# BIND Configuration options
options:
host: 127.0.0.1
port: 53
rndc_host: 127.0.0.1
rndc_port: 953
rndc_key_file: /etc/rndc.key
# Optional list of additional IP/Port's for which designate-mdns will send
# DNS NOTIFY packets to
# also_notifies:
# - host: 192.0.2.4
# port: 53

View File

@@ -59,22 +59,3 @@
- role: "os_designate"
vars_files:
- common/test-vars.yml
- name: Import pools
hosts: designate_all[0]
user: root
gather_facts: true
tasks:
- name: Copy sample pools.yaml file
copy:
src: "{{ sample_pool_file }}"
dest: /etc/designate/pools.yaml
- name: Import sample pools.yaml file
shell: |
. /root/openrc
{{ designate_bin }}/designate-manage pool update --file /etc/designate/pools.yaml
vars:
sample_pool_file: "{{ (ansible_pkg_mgr == 'apt') | ternary('pools.yaml.sample','pools.yaml.sample.centos') }}"
vars_files:
- common/test-vars.yml