Support for disabling DHCP server configuration

The distinct possibility exists that a user may wish to utilize
a pre-existing dhcp server.  This is a first initial step to help
facilitate that use case.

Partial-Bug: #1459636
Change-Id: Icb45b1d50f29ad369d1473adbe4ae9f2e03fe5ae
This commit is contained in:
Julia Kreger
2015-06-01 18:12:21 -04:00
parent b485d4d788
commit 22cd159df6
3 changed files with 20 additions and 3 deletions

View File

@@ -41,6 +41,12 @@ As for controlling if a partition image is utilized or an image is created with
create_image_via_dib: true create_image_via_dib: true
transform_boot_image: false transform_boot_image: false
By default this role installs dnsmasq to act as a DHCP server for provisioning hosts. In the event this is not required, set the following configuration:
include_dhcp_server: false
In the event of an external DHCP server being used, the user will need to configure their DHCP server such that PXE, and iPXE chain loading occurs.
Additional default variables exist in defaults/main.yml, however these are mainly limited to settings which are unlikely to be modified, unless a user has a custom Ironic Python Agent image, or needs to modify where the httpboot folder is set to. Additional default variables exist in defaults/main.yml, however these are mainly limited to settings which are unlikely to be modified, unless a user has a custom Ironic Python Agent image, or needs to modify where the httpboot folder is set to.
Dependencies Dependencies

View File

@@ -56,3 +56,7 @@ deploy_image_filename: "trusty-server-cloudimg-amd64.img"
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Use cirros instead of building an image via diskimage-builder # Use cirros instead of building an image via diskimage-builder
use_cirros: false use_cirros: false
# By default Bifrost will deploy dnsmasq to utilize as an integrated DHCP
# server. If you already have a DHCP server, you will need to disable
# this setting, and perform manual configuration of your DHCP server.
include_dhcp_server: true

View File

@@ -171,18 +171,20 @@
copy: src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/ copy: src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/
- name: "Deploy dnsmasq configuration file" - name: "Deploy dnsmasq configuration file"
template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
when: include_dhcp_server == true or '"true" in include_dhcp_server'
# NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file, # NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file,
# not the one supplied by libvirt. And the libvirt started dnsmasq processes # not the one supplied by libvirt. And the libvirt started dnsmasq processes
# are not controlled by upstart, so we need to manually kill those. # are not controlled by upstart, so we need to manually kill those.
- name: "Looking for libvirt dnsmasq config" - name: "Looking for libvirt dnsmasq config"
stat: path=/etc/dnsmasq.d/libvirt-bin stat: path=/etc/dnsmasq.d/libvirt-bin
register: test_libvirt_dnsmasq register: test_libvirt_dnsmasq
when: include_dhcp_server == true or '"true" in include_dhcp_server'
- name: "Disabling libvirt dnsmasq config" - name: "Disabling libvirt dnsmasq config"
command: mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~ command: mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~
when: test_libvirt_dnsmasq.stat.exists == true and testing == true when: (include_dhcp_server == true or '"true" in include_dhcp_server') and test_libvirt_dnsmasq.stat.exists == true and testing == true
- name: "Stopping existing libvirt dnsmasq processes" - name: "Stopping existing libvirt dnsmasq processes"
command: killall -w dnsmasq command: killall -w dnsmasq
when: testing == true when: testing == true and (include_dhcp_server == true or '"true" in include_dhcp_server')
# NOTE(Shrews) We need to enable ip forwarding for the libvirt bridge to # NOTE(Shrews) We need to enable ip forwarding for the libvirt bridge to
# operate properly with dnsmasq. This should be done before starting dnsmasq. # operate properly with dnsmasq. This should be done before starting dnsmasq.
- name: "Enabling IP forwarding in sysctl" - name: "Enabling IP forwarding in sysctl"
@@ -205,8 +207,12 @@
service: name={{ item }} state=restarted service: name={{ item }} state=restarted
with_items: with_items:
- xinetd - xinetd
- dnsmasq
- nginx - nginx
- name: "Ensuring dnsmasq is running with current config"
service: name={{ item }} state=restarted
with_items:
- dnsmasq
when: include_dhcp_server == true or '"true" in include_dhcp_server'
- name: "Sending services a reload signal" - name: "Sending services a reload signal"
service: name={{ item }} state=reloaded service: name={{ item }} state=reloaded
with_items: with_items:
@@ -214,6 +220,7 @@
- nginx - nginx
- name: "Sending services a force-reload signal" - name: "Sending services a force-reload signal"
command: /etc/init.d/dnsmasq force-reload command: /etc/init.d/dnsmasq force-reload
when: include_dhcp_server == true or '"true" in include_dhcp_server'
# Similar logic to below can be utilized to retrieve files # Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder." - name: "Determine if folder exists, else create and populate folder."
stat: path=/tftpboot/master_images stat: path=/tftpboot/master_images