[lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

Nicola Volpini nicola.volpini at kambi.com
Wed Oct 19 11:37:35 UTC 2016


Hello
> ATM what I do is either use dnsmasq to provide DHCP or stop the
> container and push a preconfigured interfaces file...
>
> lxc file push interfaces.tmp CONTAINER/etc/network/interfaces
Same approach we are using, but with Ansible as our
"bootstrapper/configurer".

I've been successfully able to do the following:

1. generate instance-specific config in the form of a cloud-init file
2. create container
3. take down network on the container by running lxc exec ... ifdown -a
4. generate the container's nw config file on the LXD host via ansible
and push it to the container via "lxc push" (and remove the default
configs if necessary)
5. bring up network on the container by running lxc exec ... ifup -a

The cloud-init config is used to inject the ssh key, setup the ssh
daemon+config and create an ansible-remote user. That user is necessary
for ansible to do later more complex configs by directly accessing the
container over ssh, as you would do for a normal ansible host.

Something cleaner would be cool, possibly integrated in cloud-init itself.

I guess this is somehow possible by creating your custom images and
customizing the templates section of the metadata.yaml file, as outlined
in the last part of this article
https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/

CONFIDENTIALITY NOTICE: This email message (and any attachment) is intended only for the individual or entity to which it is addressed. The information in this email is confidential and may contain information that is legally privileged or exempt from disclosure under applicable law. If you are not the intended recipient, you are strictly prohibited from reading, using, publishing or disseminating such information and upon receipt, must permanently delete the original and destroy any copies. We take steps to protect against viruses and other defects but advise you to carry out your own checks and precautions as Kambi does not accept any liability for any which remain. Thank you for your co-operation.


More information about the lxc-users mailing list