Initial support for diskimage-builder

Changing the process over to utilize diskimage-builder
as it has support for building images that will boot
utilizing configuration drives.
This commit is contained in:
Julia Kreger 2015-03-12 17:55:29 +00:00
parent f4ed4a5376
commit 70169451cf
6 changed files with 32 additions and 6 deletions

View File

@ -0,0 +1,4 @@
---
- name: "Initiate image build"
shell: disk-image-create -a amd64 -o "{{http_boot_folder}}/{{deploy_image_filename}}" -t qcow2 vm ubuntu serial-console cloud-init-datasources "{{ extra_dib_elements}}"
environment: dib_env_vars

View File

@ -0,0 +1,11 @@
---
- name: "Shade - Retrieving diskimage-builder from git.openstack.org"
local_action: command git clone https://git.openstack.org/openstack/diskimage-builder chdir=/opt/stack creates=/opt/stack/diskimage-builder
- name: "Shade - Checking out master branch"
local_action: command git checkout -f master chdir=/opt/stack/diskimage-builder
- name: "Shade - Resetting local repository"
local_action: command git reset --hard master chdir=/opt/stack/diskimage-builder
- name: "Shade - Resyncing local repository"
local_action: command git pull --ff-only chdir=/opt/stack/diskimage-builder
- name: "Shade - Installing patched library."
local_action: command pip install -I --force-reinstall /opt/stack/diskimage-builder

View File

@ -74,6 +74,9 @@
local_action: command git pull --ff-only chdir=/opt/stack/shade
- name: "Shade - Installing patched shade library."
local_action: command pip install -I --force-reinstall /opt/stack/shade
- name: "Include diskimage-builder installation"
include: dib_install.yml
when: create_image_via_dib == true
- name: "Starting MySQL"
local_action: service name=mysql state=started
- name: "Starting rabbitmq-server"
@ -200,9 +203,13 @@
# Anything better!
- name: "Download Ubuntu image"
local_action: get_url url=http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz
when: test_os_image_present.stat.exists == false
when: test_os_image_present.stat.exists == false and create_image_via_dib == false
- name: "Extract Ubuntu image"
local_action: command tar -xvzf ubuntu-14.04-server-cloudimg-amd64.tar.gz chdir=/httpboot creates=/httpboot/trusty-server-cloudimg-amd64.img
when: test_os_image_present.stat.exists == false
- include: create_bootable_image.yaml
when: test_os_image_present.stat.exists == false and transform_boot_image == true
when: test_os_image_present.stat.exists == false and create_image_via_dib == false
- name: "Creating bootable image"
include: create_bootable_image.yml
when: test_os_image_present.stat.exists == false and transform_boot_image == true and create_image_via_dib == false
- name: "Creating image via disk imae builder"
include: create_dib_image.yml
when: test_os_image_present.stat.exists == false and transform_boot_image == false and create_image_via_dib == true

View File

@ -28,5 +28,10 @@ required_packages_ubuntu:
http_boot_folder: /httpboot
transform_boot_image: false
ironic_url: "http://localhost:6385/"
network_interface: "eth0"
ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub"
dib_env_vars:
DIB_CLOUD_INIT_DATASOURCES: "ConfigDrive"
# extra_dib_elements is a space separated list of elements.
extra_dib_elements: ""
create_image_via_dib: true
transform_boot_image: false

View File

@ -15,7 +15,6 @@ deploy_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network
deploy_image_filename: "trusty-server-cloudimg-amd64.img"
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Transform boot image is intended for use with the Ubuntu trusty image. It makes the image bootable by ihnstalling Grub.
transform_boot_image: true
node_default_network_interface: eth0
# ipv4_subnet_mask is intended for the static ipv4 address assignments.
ipv4_subnet_mask: 255.255.255.0