On Sun, 29 Jan 2017, Serge E. Hallyn wrote:
> On Fri, Jan 27, 2017 at 06:38:05AM -0600, Neil Bowers wrote:
> > Thank you so much - this has been bugging me for weeks.
> >
> > I do have a question, however, in regards to the 'write_files' directive -
>
> I'm sorry - I really should start using cloud init more myself after
> which I culd be helpful, but for now I don't know the answers to this,
> so cc:ing Scott (which I should have done in my previous reply).
>
> > since this runs before users are created (and while I understand that
> > having it able to affect more of boot is useful, but it's not documented
> > like that anywhere I can find), if I were to create the file in `/etc/skel`
> > instead, would any created users pick it up from there? Or is that ignored
> > when creating users with cloud-init ?
>
> I should *think* cloud-init creates users the standard way which would
> honor /etc/skel. Scott?
Yes, it uses adduser which will do whatever adduser normally does
(including copying /etc/skel).
>
> > Essentially I'm just trying to set up a simple way to put up and tear down
> > containers that will have all of my defaults in place from the start.
Now... Being off this list and replying to this thread is painful. I ended
up I think deleting a mail that Neil sent to list and copied me, but I'll
respond to it below.
[Neil]
> Just a quick followup, I'll post this to the lxc-users list as well, but I
> thought you might want to know.
> Based on your information, I updated my lxc profile 'test' to contain the
> following:
> name: test
> config:
> limits.memory: 1024MB
> user.user-data:
...
I've tested the following and it seems to function fine.
See attached or http://paste.ubuntu.com/23894177/
I'm guessing you had some formatting issues resulting in odd yaml reading.
$ lxc profile show default
config:
user.user-data: |
#cloud-config
users:
- name: nlbowers
gecos: Neil Bowers
ssh_authorized_keys: ssh-rsa AAAAB3NzaC1y<snip>tHw== smoser@brickies
sudo: 'ALL=(ALL) NOPASSWD:ALL'
groups: sudo
shell: /bin/bash
editor: /bin/nano
write_files:
- owner: root:root
path: /etc/skel/bash_aliases
content: |
alias dir='ls -Alph --color=auto'
apt_proxy: "http://192.168.1.2:8000"
description: Default LXD profile
devices:
eth0:
nictype: bridged
parent: lxdbr0
type: nic
name: default
usedby:
- /1.0/containers/cent6
- /1.0/containers/cent6/snap0
- /1.0/containers/y1
- /1.0/containers/yakkety-1354694
- /1.0/containers/fed24
- /1.0/containers/alpine-build
- /1.0/containers/x2
- /1.0/containers/z1
- /1.0/containers/z2
- /1.0/containers/xx
- /1.0/containers/t1
- /1.0/containers/huge-condor
- /1.0/containers/yy1
_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users