Merge "Break install role into logical chunks"

This commit is contained in:
Jenkins 2015-07-06 23:28:28 +00:00 committed by Gerrit Code Review
commit 16c19775ad
3 changed files with 80 additions and 50 deletions

View File

@ -0,0 +1,46 @@
# 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
# NOTE(cinerama) See https://bugs.launchpad.net/bifrost/+bug/1471973
# with regard to the next two tasks.
- name: "Placing pxelinux.0 (pre-14.10)"
copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot
when: ansible_distribution_version|version_compare('14.10', '<')
- name: "Placing pxelinux.0 (>=14.10)"
copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot
when: ansible_distribution_version|version_compare('14.10', '>=')
- 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/
# 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

View File

@ -0,0 +1,29 @@
# 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.
---
# This is overly complex, however get_url will always re-retrieve the file
# if it already exists, and this is to prevent that behavior.
- name: "Test if CoreOS kernel is present"
stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present
- name: "Download CoreOS kernel"
get_url: url={{ deploy_kernel_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
when: test_core_os_kernel_present.stat.exists == false
- name: "Test if CoreOS image is present"
stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present
- name: "Download CoreOS image"
get_url: url={{ deploy_ramdisk_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
when: test_core_os_image_present.stat.exists == false

View File

@ -150,28 +150,8 @@
service: name=ironic-conductor state=restarted
- name: "Start ironic-api"
service: name=ironic-api state=restarted
- 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: "Placing pxelinux.0 (pre-14.10)"
copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot
when: ansible_distribution_version|version_compare('14.10', '<')
- name: "Placing pxelinux.0 (>=14.10)"
copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot
when: ansible_distribution_version|version_compare('14.10', '>=')
- 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/
- name: "Create and populate /tftpboot"
include: create_tftpboot.yml
- name: "Deploy dnsmasq configuration file"
template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
when: "{{include_dhcp_server|bool}}"
@ -224,39 +204,14 @@
- name: "Sending services a force-reload signal"
service: name=dnsmasq state=restarted
when: "{{include_dhcp_server|bool}}"
# 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
# This is overly complex, however get_url will always re-retrieve the file
# if it already exists, and this is to prevent that behavior.
- name: "Test if CoreOS kernel is present"
stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present
- name: "Download CoreOS kernel"
get_url: url={{ deploy_kernel_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
when: test_core_os_kernel_present.stat.exists == false
- name: "Test if CoreOS image is present"
stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present
- name: "Download CoreOS image"
get_url: url={{ deploy_ramdisk_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
when: test_core_os_image_present.stat.exists == false
- name: "Download Ironic Python Agent CoreOS kernel & image"
include: download_ipa_coreos.yml
- name: "Download cirros to use for deployment if requested"
get_url: url={{ cirros_deploy_image_upstream_url }} dest="{{ deploy_image }}"
when: "{{use_cirros|bool}}"
- name: "Test if Ubuntu 14.04 server cloud amd64 is present"
- name: "Test if deploy image is present"
stat: path={{ deploy_image }}
register: test_os_image_present
- name: "Download Ubuntu image"
get_url: url={{ deploy_image_upstream_url }} dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz
when: test_os_image_present.stat.exists == false and create_image_via_dib == false
- name: "Extract Ubuntu image"
unarchive: src=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ creates=/httpboot/trusty-server-cloudimg-amd64.img
when: test_os_image_present.stat.exists == false and create_image_via_dib == false
# Create bootable image takes a partition image, prepends space for a
# bootloader, partition table, and then installs the bootloader.
#