Merge "Configure static DHCP before automated cleaning"

This commit is contained in:
Zuul 2024-01-05 00:34:48 +00:00 committed by Gerrit Code Review
commit e15d7ade1c
12 changed files with 66 additions and 64 deletions

View File

@ -12,9 +12,6 @@ deploy_image_filename: "deployment_image.qcow2"
deploy_image_path: "{{ deploy_image | default(http_boot_folder + '/' + deploy_image_filename) }}"
deploy_image_source: "{{ deploy_url_protocol }}://{{ internal_ip }}:{{ file_url_port }}/{{ deploy_image_filename }}"
deploy_root_gb: 10
inventory_dhcp: false
inventory_dhcp_static_ip: true
inventory_dns: false
deploy_url_protocol: "http"
# Under normal circumstances, the os_ironic_node module does not wait for

View File

@ -43,32 +43,8 @@
- uuid is undefined
- name is defined
- 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
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
become: yes
- name: "Restarting dnsmasq"
service:
name: dnsmasq
state: restarted
become: yes
when: inventory_dhcp | bool or inventory_dns | bool
- import_role:
name: bifrost-dhcp-record
- name: "Create instance info"
when: instance_info is not defined or instance_info == {}

View File

@ -0,0 +1,17 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
dnsmasq_dhcp_hostsdir: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
dnsmasq_host_record_prefix: "/etc/dnsmasq.d/host_record_"
inventory_dhcp: false
inventory_dhcp_static_ip: true
inventory_dns: false

View File

@ -0,0 +1,38 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: "Setup DHCP for nodes."
template:
src: dhcp-host.j2
dest: "{{ dnsmasq_dhcp_hostsdir }}/{{ inventory_hostname }}"
owner: root
group: root
mode: "0644"
when: inventory_dhcp | bool
become: yes
- name: "Setup DNS address for nodes."
template:
src: dns-address.j2
dest: "{{ dnsmasq_host_record_prefix }}{{ inventory_hostname }}"
owner: root
group: root
mode: "0644"
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 or inventory_dns | bool

View File

@ -19,6 +19,9 @@
- import_role:
name: bifrost-cloud-config
- import_role:
name: bifrost-dhcp-record
- name: "Dynamic enrollment"
openstack.cloud.baremetal_node:
cloud: "{{ cloud_name | default(omit) }}"

View File

@ -2,9 +2,6 @@
# defaults file for ironic-inspect-node
noauth_mode: false
inspection_wait_timeout: 1800
inventory_dhcp: false
inventory_dhcp_static_ip: true
inventory_dns: false
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -19,30 +19,8 @@
- import_role:
name: bifrost-cloud-config
- 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
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
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 or inventory_dns | bool
- import_role:
name: bifrost-dhcp-record
- name: "Execute node introspection"
openstack.cloud.baremetal_inspect:

View File

@ -1,6 +0,0 @@
# 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

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

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Makes sure the static DHCP configuration runs before automated cleaning.