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

Matt Green mephi at mephi.co.uk
Wed Oct 19 20:02:37 UTC 2016


I've been effectively building a network interfaces file and pushing it to
the container.
I posted my script here:
https://www.reddit.com/r/homelab/comments/50s7jz/lxd_automation_script/

I'm in the process of moving my build scripts to python, but that shell
script worked.

Matt

On 19 October 2016 at 20:22, Caleb Everett <caleb at calebeverett.io> wrote:

> https://github.com/lxc/lxd/issues/2050
>
> On Wed, Oct 19, 2016 at 4:37 AM, Nicola Volpini <nicola.volpini at kambi.com>
> wrote:
>
>> 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.
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>
>
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20161019/4489a712/attachment.html>


More information about the lxc-users mailing list