Updates for testing to work with libvirt
dnsmasq needs certain options set when working with libvirt virtual machines rather than physical hardware. We also need to kill libvirt-controlled dnsmasq processes when testing, and make sure IP forwarding is enabled.
This commit is contained in:
parent
f4ed4a5376
commit
f2b6e474c5
@ -157,7 +157,26 @@
|
||||
local_action: copy src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/
|
||||
- name: "Deploy dnsmasq configuration file"
|
||||
local_action: template src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
|
||||
- name: "Deploying nginx configuraiton file for serving HTTP requests"
|
||||
|
||||
# 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
|
||||
# are not controlled by upstart, so we need to manually kill those.
|
||||
- name: "Looking for libvirt dnsmasq config"
|
||||
local_action: stat path=/etc/dnsmasq.d/libvirt-bin
|
||||
register: test_libvirt_dnsmasq
|
||||
- name: "Disabling libvirt dnsmasq config"
|
||||
local_action: command mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~
|
||||
when: test_libvirt_dnsmasq == true and testing == true
|
||||
- name: "Stopping existing libvirt dnsmasq processes"
|
||||
local_action: command killall -w dnsmasq
|
||||
when: testing == true
|
||||
# NOTE(Shrews) We need to enable ip forwarding for the libvirt bridge to
|
||||
# operate properly with dnsmasq. This should be done before starting dnsmasq.
|
||||
- name: "Enabling IP forwarding in sysctl"
|
||||
local_action: sysctl name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes
|
||||
when: testing == true
|
||||
|
||||
- name: "Deploying nginx configuration file for serving HTTP requests"
|
||||
local_action: template src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
|
||||
- name: "Ensuring dnsmasq is running"
|
||||
local_action: service name={{ item }} state=started
|
||||
|
@ -91,7 +91,11 @@ port=53
|
||||
# specified interfaces (and the loopback) give the name of the
|
||||
# interface (eg eth0) here.
|
||||
# Repeat the line for more than one interface.
|
||||
{% if testing %}
|
||||
interface=virbr0
|
||||
{% else %}
|
||||
interface={{ network_interface }}
|
||||
{% endif %}
|
||||
# Or you can specify which interface _not_ to listen on
|
||||
#except-interface=
|
||||
# Or which to listen on by address (remember to include 127.0.0.1 if
|
||||
@ -142,7 +146,11 @@ bind-interfaces
|
||||
# a lease time. If you have more than one network, you will need to
|
||||
# repeat this for each network on which you want to supply DHCP
|
||||
# service.
|
||||
{% if testing %}
|
||||
dhcp-range=192.168.122.2,192.168.122.254,12h
|
||||
{% else %}
|
||||
dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},12h
|
||||
{% endif %}
|
||||
|
||||
# This is an example of a DHCP range where the netmask is given. This
|
||||
# is needed for networks we reach the dnsmasq DHCP server via a relay
|
||||
@ -423,7 +431,11 @@ dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},12h
|
||||
# load. The dhcp-match sets the gpxe tag for requests from gPXE.
|
||||
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
|
||||
dhcp-boot=tag:!ipxe,undionly.kpxe
|
||||
{% if testing %}
|
||||
dhcp-boot=http://192.168.122.1:8080/boot.ipxe
|
||||
{% else %}
|
||||
dhcp-boot=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:8080/boot.ipxe
|
||||
{% endif %}
|
||||
|
||||
# Encapsulated options for Etherboot gPXE. All the options are
|
||||
# encapsulated within option 175
|
||||
@ -629,3 +641,8 @@ dhcp-boot=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]
|
||||
# Include another lot of configuration options.
|
||||
#conf-file=/etc/dnsmasq.more.conf
|
||||
#conf-dir=/etc/dnsmasq.d
|
||||
|
||||
{% if testing %}
|
||||
log-queries
|
||||
log-dhcp
|
||||
{% endif %}
|
||||
|
@ -3,6 +3,8 @@ ironic_url: "http://localhost:6385/"
|
||||
network_interface: "virbr0"
|
||||
ironic_db_password: aSecretPassword473z
|
||||
mysql_password:
|
||||
# If testing is true, then the environment is setup for using libvirt
|
||||
# virtual machines for the hardware instead of real hardware.
|
||||
testing: false
|
||||
http_boot_folder: /httpboot
|
||||
ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub"
|
||||
|
Loading…
Reference in New Issue
Block a user