This commit is contained in:
Julia Kreger 2015-03-12 17:58:04 +00:00
commit 1b315d406d
5 changed files with 61 additions and 2 deletions

View File

@ -12,6 +12,14 @@
with_items:
- pxelinux
when: ansible_distribution_version|version_compare('14.10', '>=')
- name: "Install testing packages"
local_action: apt name={{ item }}
with_items:
- libvirt-bin
- qemu-utils
- qemu-kvm
- sgabios
when: testing == true
- name: "Ensuring /opt/stack is present"
local_action: file name=/opt/stack state=directory owner=root group=root
# This won't be necessary in the long run, however until a suitable version
@ -160,7 +168,37 @@
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
# NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading
# the ROM from /usr/share/misc.
- name: "Looking for sgabios in /usr/share/qemu"
local_action: stat path=/usr/share/qemu/sgabios.bin
register: test_sgabios_qemu
- name: "Looking for sgabios in /usr/share/misc"
local_action: stat path=/usr/share/misc/sgabios.bin
register: test_sgabios_misc
- name: "Place sgabios.bin"
local_action: command cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
when: test_sgabios_qemu == false and test_sgabios_misc == true and 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

View File

@ -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 %}

View File

@ -470,6 +470,9 @@ debug=true
# Additional append parameters for baremetal PXE boot. (string
# value)
#agent_pxe_append_params=nofb nomodeset vga=normal
{% if testing %}
agent_pxe_append_params=nofb nomodeset vga=normal console=ttyS0 systemd.journald.forward_to_console=yes
{% endif %}
# Template file for PXE configuration. (string value)
#agent_pxe_config_template=$pybasedir/drivers/modules/agent_config.template

View File

@ -23,7 +23,6 @@ required_packages_ubuntu:
- nginx
- wget
- genisoimage
- qemu-utils
- kpartx
http_boot_folder: /httpboot
transform_boot_image: false

View File

@ -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"