bifrost/playbooks/roles/bifrost-ironic-install/tasks/create_tftpboot.yml

73 lines
2.9 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.
---
# TODO(TheJulia): The pxelinux folder is statically coded in ironic.
# For now, we need to use it, but we can patch that.
- name: "Set up PXE and iPXE folders"
file: name={{item}} owner=ironic group=ironic state=directory mode=0755
with_items:
- /tftpboot
- /tftpboot/pxelinux.cfg
- "{{ http_boot_folder }}"
- "{{ http_boot_folder }}/pxelinux.cfg"
- name: "Place tftpd map-file"
copy: src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic
- name: "Disable service {{ tftp_service_name }}"
service: name="{{ tftp_service_name }}" state=stopped enabled=no
- name: "Place boot.ipxe helper script /etc/ironic"
copy: src=boot.ipxe dest=/etc/ironic/boot.ipxe owner=ironic group=ironic mode=0744
- name: "Pre-stage boot.ipxe into {{ http_boot_folder }}/"
copy: src=boot.ipxe dest={{ http_boot_folder }}/boot.ipxe owner=ironic group=ironic mode=0744
- name: "Place tftp config file"
copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp
- name: "Download ipxe files if asked"
include: get_ipxe.yml
when: download_ipxe | bool == true
- name: "Copy iPXE image into place"
copy: src={{ ipxe_dir }}/undionly.kpxe dest=/tftpboot/ remote_src=true
# NOTE(TheJulia): Copy full iPXE chain loader images in case they are required.
- name: "Copy full iPXE image into {{ http_boot_folder }}/"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest={{ http_boot_folder }}/ remote_src=true
- name: "Copy full iPXE image into /tftpboot"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/tftpboot/ remote_src=true
# Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder."
stat: path="{{ ironic_tftp_master_path }}"
register: test_master_images
- name: "Create master_images folder"
file: name="{{ ironic_tftp_master_path }}" state=directory owner=ironic group=ironic
when: test_master_images.stat.exists == false
# TODO(TheJulia): The pxelinux folder is statically coded in ironic.
# For now, we need to use it, but we can patch that.
- name: "Inspector - Place default tftp boot file in {{ http_boot_folder}}/pxelinux.cfg/"
template:
src=inspector-default-boot-ipxe.j2
dest="{{ http_boot_folder }}/pxelinux.cfg/default"
owner=ironic
group=ironic
when: enable_inspector | bool == true