
Using systemd-nspawn gives us more flexibility in what hardware the agent can see. With this setup, the network is not virtualized, and the /dev inside the container looks nearly identical to the one in the host. Also added RestartSec=30s to the unit file because without this, systemd will respawn the agent every 100ms if it dies (say, because DHCP hasn't completed yet). Since it retries a max of 5 times per 60s, unless the restart value is set higher it will be marked 'failed' forever and not retry. Adding this prevents that. Change-Id: Ic64ab4b0824595683e5428464512594dd90eed83
ironic-python-agent CoreOS Image builder.
Builds a CoreOS image suitable for running the ironic-python-agent on a server.
Requirements
Must be run from a linux machine with a working docker installation and python-pip
Run the following locally or from a virtualenv to install the python requirements
pip install -r requirements.txt
Build Instructions
To create a docker repository and embed it into a CoreOS pxe image:
make
To just create the docker repository in oem/container.tar.gz:
make docker
To embed the oem/ directory into a CoreOS pxe image:
Note: In order to have the ability to ssh into the created image, you need to pass ssh keys in via the kernel command line for CoreOS, or create oem/authorized_keys with the keys you need added before building the image.
make coreos
Booting the agent with this image
To boot the image, it should be booted via PXE. Here's an example ipxe configuration (replace my-web-server with the IP/hostname of the http server hosting your image):
#!ipxe
dhcp
kernel http://my-web-server/coreos_production_pxe.vmlinuz root=squashfs: state=tmpfs:
initrd http://my-web-server/coreos_production_pxe_image-oem.cpio.gz
boot
You can either embed a configuration file into the image, or set configuration options via the kernel command line. Values most people will need are:
ipa-api-url=http://ironic-api-server:6385
ipa-advertise-host=ip-of-server-running-agent
But any config value supported in the agent can be given to the agent via the kernel command line, which allows the use of the same agent image across environments because it contains no state.