<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks Fajar it works!<div class=""><br class=""></div><div class="">What I did:</div><div class=""><br class=""></div><div class="">#lets create a new profile </div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc profile copy default nonet</span></div></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">#remove network from the profile </span></span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc profile device remove nonet eth0</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">#create the ’testip' container</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc init ubuntu:18.04 testip --profile nonet</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">#attach the network device to it, with IP address</span></span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc config device add testip eth0 nic nictype=bridged parent=lxdbr0 host_name=testip ipv4.address=10.0.3.203</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">#Woops, didn’t work because I entered the wrong IP network, change IP to the right one</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc config device set testip eth0 ipv4.address 10.115.240.89</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">#check</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lxc list testip</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+--------+---------+-----------------------+----------------------------------------------+------------+-----------+</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+--------+---------+-----------------------+----------------------------------------------+------------+-----------+</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">| testip | RUNNING | 10.115.240.123 (eth0) | fd3f:a1a8:9bb:fb1e:216:3eff:fea5:bf77 (eth0) | PERSISTENT | 0 |</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+--------+---------+-----------------------+----------------------------------------------+------------+-----------+</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">#IT works!</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">A remark</span><span style="background-color: rgb(255, 255, 255);" class=""> about the interface:</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""> i</span><span style="background-color: rgb(255, 255, 255);" class="">t feels not coherent that when you add a device you use <key></span><span style="background-color: rgb(255, 255, 255);" class="">=<value> and when you want to update a value in the device you use <key> <value></span><span style="background-color: rgb(255, 255, 255);" class=""> </span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">An afterthought: </div><div class=""> after re-reading Stéphane Graber’s "Network management with LXD (2.3+)” ( <a href="https://blog.ubuntu.com/2017/02/14/network-management-with-lxd-2-3" class="">https://blog.ubuntu.com/2017/02/14/network-management-with-lxd-2-3</a> ) I realized that the nat internal dns server registers all the container hostnames, so if my Ansible container is on the same lxdbr0 nat network, I coud just reference the different hosts by hostnames and forget about static IP.</div><div class=""><br class=""></div><div class="">—</div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Michel</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class=""><br class=""></div><div class=""><div class="">One way that works is to specify eth0 in the container config file,<br class="">overriding the profile.<br class="">While you're at it you might wan to set host_name as well, so that the<br class="">veth device name on the host side stays the same.<br class=""><br class="">Example:<br class="">devices:<br class=""> eth0:<br class=""> host_name: c1-0<br class=""> ipv4.address: 10.0.3.203<br class=""> name: eth0<br class=""> nictype: bridged<br class=""> parent: lxdbr0<br class=""> type: nic<br class=""><br class="">-- <br class="">Fajar<br class="">_______________________________________________<br class="">lxc-users mailing list<br class=""><a href="mailto:lxc-users@lists.linuxcontainers.org" class="">lxc-users@lists.linuxcontainers.org</a><br class="">http://lists.linuxcontainers.org/listinfo/lxc-users</div></div></blockquote></div><br class=""></div></body></html>