Add bootstrap task for ironic-pxe

PXE files should be copied after volume mount to avoid overwrite.

Change-Id: I023cc316e6873abd658478dfa05be839e44a80c7
Closes-bug: #1538164
This commit is contained in:
Andrey Shestakov 2016-01-26 16:56:26 +02:00
parent 9da034dc0a
commit 5855a07212
3 changed files with 35 additions and 7 deletions

View File

@ -52,3 +52,20 @@
run_once: True
delegate_to: "{{ groups['ironic-api'][0] }}"
when: database_created
- name: Running Ironic-PXE bootstrap container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ ironic_pxe_image_full }}"
name: "bootstrap_ironic_pxe"
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/ironic-pxe/:{{ container_config_directory }}/:ro"
- "ironic-pxe:/tftpboot/"
run_once: True
delegate_to: "{{ groups['ironic-pxe'][0] }}"

View File

@ -6,9 +6,7 @@ MAINTAINER {{ maintainer }}
RUN yum -y install \
tftp-server \
syslinux-tftpboot \
&& yum clean all \
&& mkdir -p /tftpboot \
&& cp /var/lib/tftpboot/chain.c32 /tftpboot
&& yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %}
@ -16,13 +14,12 @@ RUN apt-get install -y --no-install-recommends \
tftpd-hpa \
syslinux-common \
syslinux \
&& apt-get clean \
&& mkdir -p /tftpboot \
&& chown -R ironic: /tftpboot \
&& cp /usr/lib/syslinux/pxelinux.0 /usr/lib/syslinux/chain.c32 /tftpboot
&& apt-get clean
{% endif %}
COPY tftp-map-file /map-file
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start
{{ include_footer }}

View File

@ -0,0 +1,14 @@
#!/bin/bash
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
chown -R ironic: /tftpboot
for pxe_file in /var/lib/tftpboot/chain.c32 /usr/lib/syslinux/pxelinux.0 /usr/lib/syslinux/chain.c32; do
if [[ -e "$pxe_file" ]]; then
cp "$pxe_file" /tftpboot
fi
done
exit 0
fi