Merge "Add dhcp related tasks to inspection role"

This commit is contained in:
Jenkins 2017-01-05 21:16:20 +00:00 committed by Gerrit Code Review
commit 417cdffc80
7 changed files with 83 additions and 13 deletions

View File

@ -67,16 +67,16 @@ inventory_dhcp: A boolean value, defaulted to false, which allows dnsmasq
parameter.
inventory_dhcp_static_ip: A boolean value, defaulted to true, which configures
the mechanism for setting up the IP of machines when
inventory_dhcp is enabled.
If set to true, it will read the value of the key
'provisioning_ipv4_address' from the inventory section
of each machine and dnsmasq will assign that IP to each
machine accordingly. Note, that if you don't assign
the key 'provisioning_ipv4_address' it will default
to the value of 'ipv4_address'.
If set to false, dnsmasq will assign IPs
automatically from the configured DHCP range.
the mechanism for setting up the IP of machines when
inventory_dhcp is enabled.
If set to true, it will read the value of the key
'provisioning_ipv4_address' from the inventory section
of each machine and dnsmasq will assign that IP to each
machine accordingly. Note, that if you don't assign
the key 'provisioning_ipv4_address' it will default
to the value of 'ipv4_address'.
If set to false, dnsmasq will assign IPs
automatically from the configured DHCP range.
noauth_mode: Controls if the module is called in noauth mode.
By default, this is the standard mode of operation,
@ -89,9 +89,9 @@ cloud_name: Optional: String value defining a clouds.yaml entry for
the ansible module to leverage.
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.
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

@ -39,6 +39,33 @@ inspection_wait_timeout: Integer value in seconds, defaults to 1800.
under 300 seconds, although that will vary based
upon the hardware configuration.
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.
If set to true, the role will create a file for each machine
under /etc/dnsmasq.d/bifrost.dhcp-hosts.d containing the mac,
name of the machine, lease time and optionally the IP address
that will be offered to the machine by DHCP.
This optional IP is controlled by the inventory_dhcp_static_ip
parameter.
inventory_dhcp_static_ip: A boolean value, defaulted to true, which configures
the mechanism for setting up the IP of machines when
inventory_dhcp is enabled.
If set to true, it will read the value of the key
'provisioning_ipv4_address' from the inventory section
of each machine and dnsmasq will assign that IP to each
machine accordingly. Note, that if you don't assign
the key 'provisioning_ipv4_address' it will default
to the value of 'ipv4_address'.
If set to false, dnsmasq will assign IPs
automatically from the configured DHCP range.
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

@ -2,3 +2,6 @@
# defaults file for ironic-inspect-node
noauth_mode: true
inspection_wait_timeout: 1800
inventory_dhcp: false
inventory_dhcp_static_ip: true
inventory_dns: false

View File

@ -32,6 +32,31 @@
when: auth is undefined
no_log: yes
- name: "Setup DHCP for nodes."
template:
src: dhcp-host.j2
dest: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d/{{ inventory_hostname }}"
owner: root
group: root
mode: 0644
when: inventory_dhcp | bool == true
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
when: inventory_dns | bool == true
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 == true) or (inventory_dns | bool == true)
- name: "Execute node introspection"
os_ironic_inspect:
cloud: "{{ cloud_name | default(omit) }}"

View File

@ -0,0 +1,6 @@
# This file is managed by bifrost
{% if inventory_dhcp_static_ip | bool == true %}
{{ nics[0]['mac'] }},{{provisioning_ipv4_address}},{{name}},12h
{% else %}
{{ nics[0]['mac'] }},{{name}},12h
{% endif %}

View File

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

View File

@ -0,0 +1,7 @@
---
fixes:
- Added dhcp configuration tasks to inspection role.
In case when inventory_dhcp is enabled and node is not deployed yet,
inspection is not working because dnsmasq ignores requests from unknown
address. This fix introduces tasks which configures dhcp before
inspection.