diff --git a/playbooks/roles/bifrost-create-bootable-image/README.md b/playbooks/roles/bifrost-create-bootable-image/README.md deleted file mode 100644 index 2d56279b3..000000000 --- a/playbooks/roles/bifrost-create-bootable-image/README.md +++ /dev/null @@ -1,64 +0,0 @@ -bifrost-create-bootable-image -============================= - -This role modifies an existing partition image to create a bootable disk image. -This role is now legacy code and will not be supported in future. - -Requirements ------------- - -This role requires: - -- Ansible 2.9 -- qemu-img -- kpartx -- The partition image must have the grub bootloader installed. - -Role Variables --------------- - -http_boot_folder, deploy_image_filename, and deploy_image all control the final -destination of the built image. - -http_boot_folder: /httpboot -deploy_image_filename: "partition_image.raw" -deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" - -Dependencies ------------- - -None at this time. - -Example Playbook ----------------- - -- hosts: localhost - connection: local - name: "Create bootable image" - become: yes - gather_facts: yes - roles: - - role: bifrost-create-bootable-image - - -License -------- - -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. - -Author Information ------------------- - -Ironic Developers diff --git a/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml b/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml deleted file mode 100644 index 462606bf4..000000000 --- a/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -http_boot_folder: /httpboot -deploy_image_filename: "partition_image.raw" -deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" - - -# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment -bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" -ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}" diff --git a/playbooks/roles/bifrost-create-bootable-image/meta/main.yml b/playbooks/roles/bifrost-create-bootable-image/meta/main.yml deleted file mode 100644 index 495dbdf43..000000000 --- a/playbooks/roles/bifrost-create-bootable-image/meta/main.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -galaxy_info: - author: Ironic Developers - description: Create bootable disk image for Bifrost - company: OpenStack - license: Apache - min_ansible_version: 1.9 - platforms: - - name: Ubuntu - versions: - - trusty - - utopic - categories: - - cloud - - cloud:openstack -dependencies: [] diff --git a/playbooks/roles/bifrost-create-bootable-image/tasks/create_bootable_image.yml b/playbooks/roles/bifrost-create-bootable-image/tasks/create_bootable_image.yml deleted file mode 100644 index a3704119d..000000000 --- a/playbooks/roles/bifrost-create-bootable-image/tasks/create_bootable_image.yml +++ /dev/null @@ -1,75 +0,0 @@ -# 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: "Extract the raw disk image" - command: qemu-img convert -O raw "{{ deploy_image }}" "{{ deploy_image }}.raw" -- name: "Copy image however with 32k of empty space at the beginning of the file." - command: dd if="{{ deploy_image }}.raw" of="{{ deploy_image }}.bootimg" seek=64 -- name: "Create partition table lining up with the copied file's contents." - shell: echo '32;' | sfdisk "{{ deploy_image }}.bootimg" -uB -f # noqa 306 -- name: "Allocate one of two loopbacks" - command: losetup -f - register: stored_value_loopback_alpha -- name: "Create loopback connetion to new image file" - command: losetup "{{ stored_value_loopback_alpha.stdout }}" "{{ deploy_image }}.bootimg" -- name: "Force partition table to be re-read" - command: kpartx -v -a "{{ stored_value_loopback_alpha.stdout }}" - # Using second loopback as for some reason /dev/mapper does not translate into a chroot cleanly when devfs is mounted -- name: "Allocate second loopback pointing to the initial partition" - command: losetup -f - register: stored_value_loopback_beta -- name: "Bind second loopback to the first partition" - shell: | - set -o pipefail - losetup "{{ stored_value_loopback_beta.stdout }}" /dev/mapper/$(echo "{{ stored_value_loopback_alpha.stdout }}" | cut -f3 -d '/')p1 - args: - executable: /bin/bash - # TODO parameterize folder name/location -- name: "Ensure we have a location to mount the disk to" - file: path=/mnt/bootimg state=directory -# NOTE(dtantsur): skipping ansible-lint 303 because the mount module does not -# support temporary mounts: https://github.com/ansible-collections/ansible.posix/issues/84 -- name: "Mount volume on /mnt/bootimg" - command: mount "{{ stored_value_loopback_beta.stdout }}" /mnt/bootimg # noqa 303 -- name: "Bind /sys into /mnt/bootimg/sys" - command: mount -t sysfs sysfs /mnt/bootimg/sys # noqa 303 -- name: "Bind /proc into /mnt/bootimg/proc" - command: mount -t proc proc /mnt/bootimg/proc # noqa 303 -- name: "Bind /dev into /mnt/bootimg/dev" - command: mount --bind /dev /mnt/bootimg/dev # noqa 303 -- name: "Disable Grub Prober" - shell: echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub -- name: "Disable Grub Prober" - shell: echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub -- name: "Run the grub-install tool" - command: chroot /mnt/bootimg grub-install --boot-directory=/boot --modules="biosdisk part_msdos" "{{ stored_value_loopback_alpha.stdout }}" -- name: "Unlink /dev/bootimg/dev" - command: umount /mnt/bootimg/dev -- name: "Unlink /dev/bootimg/proc" - command: umount /mnt/bootimg/proc -- name: "Unlink /dev/bootimg/sys" - command: umount /mnt/bootimg/sys -- name: "Unmount image" - command: umount /mnt/bootimg -- name: "Detach second loop device" - command: losetup -d "{{ stored_value_loopback_beta.stdout }}" -- name: "Remove partition map" - command: kpartx -v -d "{{ stored_value_loopback_alpha.stdout }}" -- name: "Detach first loop device" - command: losetup -d "{{ stored_value_loopback_alpha.stdout }}" -- name: "Move image to .oldimg" - command: mv "{{ deploy_image }}" "{{ deploy_image }}.oldimg" -- name: "Move new image into place" - command: mv "{{ deploy_image }}.bootimg" "{{ deploy_image }}" diff --git a/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml b/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml deleted file mode 100644 index 0c66f9ed3..000000000 --- a/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ -# 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: "Test if deploy image is present" - stat: path={{ deploy_image }} - register: test_image_present -- name: "Create bootable image" - include: create_bootable_image.yml - when: test_image_present.stat.exists diff --git a/releasenotes/notes/no-bootable-image-63c649c3f2008c96.yaml b/releasenotes/notes/no-bootable-image-63c649c3f2008c96.yaml new file mode 100644 index 000000000..4e7e6fb2b --- /dev/null +++ b/releasenotes/notes/no-bootable-image-63c649c3f2008c96.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The role ``bifrost-create-bootable-image``, marked as legacy since 2015, + has been removed. Please use diskimage-builder or other external tools + to build your images.