I'm trying to set up some ansible playbooks to more easily provision proxmox containers with my normal dev environment to be able to quickly test out ideas/apps, etc. For quick stuff like this (which is often temporary) I use dnsmasq to handle dhcp, and then act as a dns for dhcp clients so you can just access the new container by its hostname.
On other linux distros, the default dhcp client reports the machine's hostname to the dhcp server by default, however alpine uses busybox's udhcpc client which doesn't. This is easily fixed by adding "udhcpc_opts -h $HOSTNAME" to /etc/network/interfaces.
Here comes my issue. I want to create a custom alpine template that has enough stuff set up to be able to be able to provision with ansible (specifically, ssh and python), so I did the following steps:
I've tried some alternative methods to get around this:
On other linux distros, the default dhcp client reports the machine's hostname to the dhcp server by default, however alpine uses busybox's udhcpc client which doesn't. This is easily fixed by adding "udhcpc_opts -h $HOSTNAME" to /etc/network/interfaces.
Here comes my issue. I want to create a custom alpine template that has enough stuff set up to be able to be able to provision with ansible (specifically, ssh and python), so I did the following steps:
- create a new container with the default alpine template, with dhcp configured for networking
- install openssh and configure
- install python2
- add "udhcpc_opts -h $HOSTNAME" to /etc/network/interfaces
- add an empty .pve-ignore.interfaces in /etc/network
- create a backup of the template and then move that backup into /var/lib/vz/template/cache on the proxmox host
I've tried some alternative methods to get around this:
- adding a script that re-runs udhcpc in /etc/network/if-up.d
- while this works once the container is booted, it causes the boot process to hang
- adding a script in local.d that re-runs udhcpc.
- This works and doesn't hang the boot sequence, but is also deleted when the container is created.