Ansible roles for OpenSLX
Small collection of ansible roles to build a dracut-based initramfs for network boot.
The roles currently support both Ubuntu 16.04.2 and CentOS 7.3.
Currently, it only matches these distribution families but does not check for these exact versions!
setup-dev-tools
Installs basic development packages for the detected distribution:
Ubuntu: build-essential, cmake, git
CentOS: "@development tools", cmake, git
dracut-initramfs-builder
Builds the dracut-based initramfs using the dnbd3-rootfs module (see systemd-init):
* Install needed dependencies to build dracut for the detected distribution
* Checkout git repository for systemd-init
* Build the initramfs for the running kernel
* Extract both initramfs and kernel out of the virtual machine
Depends on setup-dev-tools role (see dracut-initramfs-builder/meta/main.yml).
Usage
Use the provided 'build-dracut-initramfs.yml' playbook for the ansible provisioner in your packer template.
You can use an already created qcow2 image, instead of always generating new packer images. See run-playbook-only.json
for a sample packer template to use an existing qcow2 image and provision them with our playbook.
The template requires the variable 'image_path' to be set, which needs to be the path of the qcow2 image.
If it was generated by packer and the manifest was created, you can simply extract the image path from that:
# Be in same directory as where you built the image with packer with an ansible-roles in that directory, then:
packer build -var-file=base.json -only=qemu -var='image_path='"$(jq -r '.builds[0].files[0].name' < manifest.json)"'' ansible-roles/run-playbook-only.json