bifrost/playbooks/roles/ironic-install/tasks/create_tftpboot.yml
stephane 1f508fccc4 Only copy pxelinux.0 to /tftpboot if it's not there already
Add a conditional to only copy pxelinux.0 to /tftpbboot if it's
not there, which has the side effect of fixing this playbook for
Fedora 22, where pxelinux.0 gets installed to /tftpboot from the
relevant syslinux package.

Change-Id: Ib62d432cbf7e0aa3369fbf417fa8c3f2d4ca2511
Closes-Bug: 1478888
2015-07-31 14:22:25 -07:00

54 lines
2.3 KiB
YAML

# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "Setting up PXE and iPXE folders"
file: name={{item}} owner=ironic group=ironic state=directory
with_items:
- /tftpboot
- /tftpboot/pxelinux.cfg
- "{{ http_boot_folder }}"
- name: "Placing tftpd map-file"
copy: src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic
- name: "Disable service tftpd-hpa"
service: name=tftpd-hpa state=stopped enabled=no
- name: "Set pxelinux.0 source (for Ubuntu >=14.10)"
set_fact:
syslinux_tftp_dir: '/usr/lib/PXELINUX'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('14.10', '>=')
- name: "Determine if pxelinux.0 is in place"
stat: path=/tftpboot/pxelinux.0
register: test_pxelinux
- name: "Placing pxelinux.0"
copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot
when: test_pxelinux.stat.exists == false
- name: "Place boot.ipxe helper script to HTTP root"
copy: src=boot.ipxe dest=/httpboot/boot.ipxe
- name: "Place tftp config file"
copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp
- name: "Copy iPXE image into place"
copy: src={{ ipxe_dir }}/undionly.kpxe dest=/tftpboot/
# NOTE(TheJulia): Copy full iPXE chain loader images in case they are required.
- name: "Copy full iPXE image into /httpboot"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/httpboot/
- name: "Copy full iPXE image into /tftpboot"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/tftpboot/
# Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder."
stat: path=/tftpboot/master_images
register: test_master_images
- name: "Create master_images folder"
file: name=/tftpboot/master_images state=directory owner=ironic group=ironic
when: test_master_images.stat.exists == false