bifrost/playbooks/roles/bifrost-create-dib-image
Julia Kreger 15e1c3f22e Ansible 2.0 compatibility
These changes allow the various playbooks to be executed by
Ansible 1.9.x and 2.0. This was necessary as 2.0 has a number
of changes to the YAML processor, and certain ways of doing
things have naturally had to change.

- Removed pass-through variable when a role is explicitly defined
  with variables passed through to it as updated yaml parser fails
  to handle appropriately.
- Defined a default dib_packages variable of an empty string.
- Changed stray boolean compare to use an is defined check as
  the the parser in Ansible 2.0 does not equate undefined to
  false.
- Explicitly defined the testing_user for the syntax check
  as the check fails without it.
- Revised MySQL module syntax usage to be compatible between
  Ansible 1.9.x and 2.0 development branches.
- Updated some conditionals making string compares with lookups
  which is apparently problematic in Ansible 2.0.

Depends-On: I9d5fa719793896cce00a69dafba738755b45b068
Depends-On: I23e902c8637e142fba23d71467225d48ee265253
Change-Id: I4fec7f44dd9d591388f345b3f449cb44b8e50744
Closes-Bug: 1469862
2015-10-02 12:58:11 +00:00
..
defaults Ansible 2.0 compatibility 2015-10-02 12:58:11 +00:00
meta Cleanup role meta definitions 2015-08-25 19:41:29 -04:00
tasks Correct bug with default value where required 2015-08-27 21:13:21 +00:00
README.md Cleanups on role README files 2015-09-14 13:51:48 -07:00

bifrost-create-dib-image

This role uses diskimage-builder to create a bootable disk image or ramdisk.

Requirements

This role requires:

  • Ansible 1.9

Role Variables

The role can use the disk-image-create or ramdisk-image-create scripts. Which script is used is controlled by the build_ramdisk variable. The default is false.

build_ramdisk: false

The dib_env_vars are settings for the diskimage-builder environment variables which allow settings to be passed to elements that are being utilized to build a disk image. More information on diskimage-builder can be found at: http://git.openstack.org/cgit/openstack/diskimage-builder/

dib_env_vars: DIB_CLOUD_INIT_DATASOURCES: "ConfigDrive" ELEMENTS_PATH: "/opt/stack/diskimage-builder/elements"

The final destination of the image is specified by dib_imagename.

dib_imagename: "/path/to/image.qcow2"

dib_os_element controls which OS will be used to build the image.

dib_os_element: "ubuntu"

dib_elements is a space-separated list of elements that will be added to the resulting disk image.

dib_elements: "vm serial-console simple-init"

dib_packages is a comma-separated list of packages to be installed on the resulting disk image.

dib_packages: "traceroute,python-devel"

All the other command-line options to disk-image-create or ramdisk-image-create can be used by the role. The following is a list of the command-line options, their corresponding variables, and the type of the value to supply. Please refer to the help text for disk-image-create for further information.

| Option | Variable name | Value |

| -x | dib_trace | boolean | | -u | dib_uncompressed | boolean | | -c | dib_clearenv | boolean | | --no-tmpfs | dib_notmpfs | boolean | | --offline | dib_offline | boolean | | -n | dib_skipbase | boolean | | -a | dib_arch | arch | | -o | dib_imagename | /path/to/image | | -t | dib_imagetype | image type | | --image-size | dib_imagesize | size in GB | | --image-cache | dib_imagecache | /path/to/cache | | --max-online-resize | dib_maxresize | size in blocks | | --min-tmpfs | dib_mintmpfs | size in GB | | --mkfs-options | dib_mkfsopts | mkfs flags | | --qemu-img-options | dib_qemuopts | comma-separated list | | --root-label | dib_rootlabel | label | | --ramdisk-element | dib_rdelement | element name | | -t | dib_installtype | source or package |

Dependencies

dib-utils must be installed from pip for the image creation to work.

Example Playbook

  • hosts: localhost connection: local name: "Build DIB image" sudo: yes gather_facts: yes roles:
    • role: bifrost-create-dib-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