Merge "Add inventory_dns feature to bifrost"

This commit is contained in:
Jenkins 2016-01-19 18:09:37 +00:00 committed by Gerrit Code Review
commit dfcfcc22a8
9 changed files with 48 additions and 7 deletions

View File

@ -66,3 +66,15 @@ You can set up a static DHCP reservation using the ``ipv4_address`` parameter
and setting the ``inventory_dhcp`` setting to a value of ``true``. This will
result in the first MAC address defined in the list of hardware MAC addresses
to receive a static address assignment in dnsmasq.
======================================
Forcing DNS to resolve to ipv4_address
======================================
dnsmasq will resolve all entries to the IP assigned to each server in
the leases file. However, this IP will not always be the desired one, if you
are working with multiple networks.
To force DNS to always resolve to ``ipv4_address`` please set the
``inventory_dns`` setting to a value of ``true``. This will result in each
server to resolve to ``ipv4_address`` by explicitly using address capabilities
of dnsmasq.

View File

@ -56,7 +56,6 @@ instance_info: A dictionary containing the information to define an instance.
expected are image_source, image_checksum, root_gb, however,
any supported key/value can be submitted to the API.
inventory_dhcp: A boolean value, defaulted to false, which allows dnsmasq
to configure the IP of the machines, rather than putting
the IP configuration of the machine in the config drive.
@ -85,6 +84,12 @@ noauth_mode: Controls if the module is called in noauth mode.
which expects a clouds.yml file. More information about
this file format can be found at:
http://docs.openstack.org/developer/os-client-config/
inventory_dns: A boolean value, defaulted to false, which causes the role
to update a template file and reload dnsmasq upon each update
in order to perform static dns addressing utilizing the
ipv4_address parameter.
Dependencies
------------

View File

@ -9,5 +9,6 @@ deploy_image_filename: "deployment_image.qcow2"
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
inventory_dhcp: false
inventory_dhcp_static_ip: true
inventory_dns: false
deploy_url_protocol: "http"
noauth_mode: true

View File

@ -27,13 +27,18 @@
delegate_to: localhost
when: inventory_dhcp | bool
become: yes
- name: "Setup DNS address for nodes."
template: src=dns-address.j2 dest=/etc/dnsmasq.d/host_record_{{ inventory_hostname }} owner=root group=root mode=0644
delegate_to: localhost
when: inventory_dns | bool
become: yes
- name: "Sending dnsmasq HUP"
# Note(TheJulia): We need to actually to send a hup signal directly as
# Ansible's reloaded state does not pass through to the init script.
command: killall -HUP dnsmasq
become: yes
when: inventory_dhcp | bool
- name: "Deploy to hardware - Using custom instance_info"
when: (inventory_dhcp | bool) or (inventory_dns | bool)
- name: "Deploy to hardware - Using custom instance_info."
os_ironic_node:
auth_type: "{{ auth_type | default(omit) }}"
auth: "{{ auth | default(omit) }}"

View File

@ -0,0 +1,2 @@
# This file is managed by bifrost
host-record={{ inventory_hostname }},{{ ipv4_address }}

View File

@ -77,6 +77,9 @@ In the case of static inventory, please also consider to set the
``dhcp_lease_time`` setting to infinite, to avoid unnecessary refreshes
of ips.
If you want to force all hostnames to resolve to ``ipv4_address`` set on
the inventory, please set the ``inventory_dns`` setting to ``true``.
In case your HW needs a kernel option to boot, set the following variable:
extra_kernel_options: Default undefined.

View File

@ -86,6 +86,10 @@ enable_cors_credential_support: false
# hosts in your dynamic inventory.
inventory_dhcp: False
# Set this to true to configure dnsmasq to resolv to ipv4_address from the
# hosts in your dynamic inventory.
inventory_dns: False
# Settings to enable the use of inspector
enable_inspector: false
inspector_auth: "noauth"

View File

@ -119,6 +119,10 @@ interface={{ network_interface }}
# running another nameserver on the same machine.
bind-interfaces
# Include another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
conf-dir=/etc/dnsmasq.d
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
@ -656,10 +660,6 @@ dhcp-boot=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interf
# Log lots of extra information about DHCP transactions.
#log-dhcp
# Include another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
#conf-dir=/etc/dnsmasq.d
{% if testing %}
log-queries
log-dhcp

View File

@ -0,0 +1,9 @@
---
features:
- Adds new feature to manage DNS with the settings
on the inventory. When ``inventory_dns`` setting is
True, it will populate a set of record-host entries,
for each of the hostnames present on the inventory,
matching the ``ipv4_address``. This will override
the default dnsmasq behaviour, that will associate
hostnames with IP present on the leases file.