Skip to content

Instantly share code, notes, and snippets.

@odyssey4me
Last active July 15, 2016 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odyssey4me/97e0edbb9e46748cdf8775b786f820b6 to your computer and use it in GitHub Desktop.
Save odyssey4me/97e0edbb9e46748cdf8775b786f820b6 to your computer and use it in GitHub Desktop.
A bug related to the use of cloned LXC containers: https://github.com/ansible/ansible-modules-extras/issues/2577
- name: Create containers via host target
hosts: localhost
tasks:
- name: Clean up previous tests
lxc_container:
name: "{{ item }}"
state: absent
with_items:
- overlayfs1
- base1
- overlayfs2
- base2
- name: Create container base1
lxc_container:
name: base1
template: download
state: stopped
backing_store: dir
template_options: --dist ubuntu --release trusty --arch amd64
- name: Check state of base1
command: lxc-info -n base1
- name: Create container overlay1
lxc_container:
name: base1
clone_snapshot: yes
clone_name: overlayfs1
state: started
backing_store: overlayfs
- name: Check state of base1
command: lxc-info -n base1
- name: Check state of overlayfs1
command: lxc-info -n overlayfs1
- name: Create container base2
lxc_container:
name: base2
template: download
state: stopped
backing_store: dir
template_options: --dist ubuntu --release trusty --arch amd64
- name: Check state of base2
command: lxc-info -n base2
- name: Create container via delegation
hosts: overlayfs2
gather_facts: false
tasks:
- name: Create container overlay2
lxc_container:
name: base2
clone_snapshot: yes
clone_name: overlayfs2
state: started
backing_store: overlayfs
delegate_to: localhost
- name: Check state of base2
command: lxc-info -n base2
delegate_to: localhost
- name: Check state of overlayfs2
command: lxc-info -n overlayfs2
delegate_to: localhost
[all]
localhost ansible_connection=local physical_host=localhost ansible_become=True ansible_user=root
overlayfs1 ansible_host=10.100.100.2 physical_host=localhost ansible_become=True ansible_user=root
overlayfs2 ansible_host=10.100.100.3 physical_host=localhost ansible_become=True ansible_user=root
[all_containers]
overlayfs1
overlayfs2
root@lxc-trusty1:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.4 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.4 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
root@lxc-trusty1:~# dpkg-query --list | grep "linux\|lxc"
ii liblxc1 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (library)
ii libselinux1:amd64 2.2.2-1ubuntu0.1 amd64 SELinux runtime shared libraries
ii linux-firmware 1.127.22 all Firmware for Linux kernel drivers
ii linux-generic 3.13.0.88.94 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.13.0-88 3.13.0-88.135 all Header files related to Linux kernel version 3.13.0
ii linux-headers-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel headers for version 3.13.0 on 64 bit x86 SMP
ii linux-headers-generic 3.13.0.88.94 amd64 Generic Linux kernel headers
ii linux-image-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.88.94 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.13.0-92.139 amd64 Linux Kernel Headers for development
ii lxc 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools
ii lxc-dev 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (development)
ii lxc-templates 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (templates)
ii python3-lxc 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (Python 3.x bindings)
ii util-linux 2.20.1-5.1ubuntu20.7 amd64 Miscellaneous system utilities
root@lxc-trusty1:~# uname -a
Linux lxc-trusty1 3.13.0-88-generic #135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@lxc-trusty1:~# pip freeze
ansible==2.1.0.0
cffi==1.7.0
chardet==2.0.1
Cheetah==2.4.4
cloud-init==0.7.5
configobj==4.7.2
cryptography==1.4
distro-info==0.12
enum34==1.1.6
euca2ools==3.0.1
idna==2.1
ipaddress==1.0.16
Jinja2==2.8
jsonpatch==1.3
jsonpointer==1.0
lxc-python2==0.1
lxml==3.3.3
MarkupSafe==0.23
oauth==1.0.1
paramiko==2.0.1
prettytable==0.7.2
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
pyinotify==0.9.4
pyserial==2.6
PyYAML==3.11
requestbuilder==0.1.0b1
requests==2.2.1
six==1.10.0
urllib3==1.7.1
#!/bin/bash
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban \
build-essential python2.7 python-dev \
libssl-dev libffi-dev \
lxc lxc-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
pip install -U lxc-python2 setuptools ansible
root@lxc-trusty1:~# ansible-playbook -i inventory create-containers.yml -vvv
No config file found; using defaults
PLAYBOOK: create-containers.yml ************************************************
2 plays in create-containers.yml
PLAY [Create containers via host target] ***************************************
TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603389.38-231618887831922 `" && echo ansible-tmp-1468603389.38-231618887831922="` echo $HOME/.ansible/tmp/ansible-tmp-1468603389.38-231618887831922 `" ) && sleep 0'
<localhost> PUT /tmp/tmp1MUEqP TO /root/.ansible/tmp/ansible-tmp-1468603389.38-231618887831922/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603389.38-231618887831922/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603389.38-231618887831922/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Clean up previous tests] *************************************************
task path: /root/create-containers.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603389.95-107851565533451 `" && echo ansible-tmp-1468603389.95-107851565533451="` echo $HOME/.ansible/tmp/ansible-tmp-1468603389.95-107851565533451 `" ) && sleep 0'
<localhost> PUT /tmp/tmpnvcWv1 TO /root/.ansible/tmp/ansible-tmp-1468603389.95-107851565533451/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603389.95-107851565533451/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603389.95-107851565533451/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=overlayfs1) => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs1", "lxc_path": null, "name": "overlayfs1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603391.09-32503023819652 `" && echo ansible-tmp-1468603391.09-32503023819652="` echo $HOME/.ansible/tmp/ansible-tmp-1468603391.09-32503023819652 `" ) && sleep 0'
<localhost> PUT /tmp/tmp7r2jd0 TO /root/.ansible/tmp/ansible-tmp-1468603391.09-32503023819652/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603391.09-32503023819652/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603391.09-32503023819652/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=base1) => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603392.63-173020374517159 `" && echo ansible-tmp-1468603392.63-173020374517159="` echo $HOME/.ansible/tmp/ansible-tmp-1468603392.63-173020374517159 `" ) && sleep 0'
<localhost> PUT /tmp/tmpCCNC57 TO /root/.ansible/tmp/ansible-tmp-1468603392.63-173020374517159/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603392.63-173020374517159/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603392.63-173020374517159/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=overlayfs2) => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs2", "lxc_path": null, "name": "overlayfs2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs2", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603393.77-60983552438334 `" && echo ansible-tmp-1468603393.77-60983552438334="` echo $HOME/.ansible/tmp/ansible-tmp-1468603393.77-60983552438334 `" ) && sleep 0'
<localhost> PUT /tmp/tmpMQODHb TO /root/.ansible/tmp/ansible-tmp-1468603393.77-60983552438334/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603393.77-60983552438334/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603393.77-60983552438334/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=base2) => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "absent"}}
TASK [Create container base1] **************************************************
task path: /root/create-containers.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603395.34-203977278115551 `" && echo ansible-tmp-1468603395.34-203977278115551="` echo $HOME/.ansible/tmp/ansible-tmp-1468603395.34-203977278115551 `" ) && sleep 0'
<localhost> PUT /tmp/tmpt5Wq7j TO /root/.ansible/tmp/ansible-tmp-1468603395.34-203977278115551/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603395.34-203977278115551/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603395.34-203977278115551/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "stopped"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603404.76-63446930676501 `" && echo ansible-tmp-1468603404.76-63446930676501="` echo $HOME/.ansible/tmp/ansible-tmp-1468603404.76-63446930676501 `" ) && sleep 0'
<localhost> PUT /tmp/tmpHVQXC1 TO /root/.ansible/tmp/ansible-tmp-1468603404.76-63446930676501/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603404.76-63446930676501/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603404.76-63446930676501/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.012071", "end": "2016-07-15 17:23:24.864480", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:24.852409", "stderr": "", "stdout": "Name: base1\nState: STOPPED", "stdout_lines": ["Name: base1", "State: STOPPED"], "warnings": []}
TASK [Create container overlay1] ***********************************************
task path: /root/create-containers.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603404.9-95318377655098 `" && echo ansible-tmp-1468603404.9-95318377655098="` echo $HOME/.ansible/tmp/ansible-tmp-1468603404.9-95318377655098 `" ) && sleep 0'
<localhost> PUT /tmp/tmpAZDE26 TO /root/.ansible/tmp/ansible-tmp-1468603404.9-95318377655098/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603404.9-95318377655098/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603404.9-95318377655098/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs1", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 26343, "interfaces": ["eth0", "lo"], "ips": [], "name": "base1", "state": "running"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:34
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603406.72-161601368833484 `" && echo ansible-tmp-1468603406.72-161601368833484="` echo $HOME/.ansible/tmp/ansible-tmp-1468603406.72-161601368833484 `" ) && sleep 0'
<localhost> PUT /tmp/tmpw0eUqE TO /root/.ansible/tmp/ansible-tmp-1468603406.72-161601368833484/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603406.72-161601368833484/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603406.72-161601368833484/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.028907", "end": "2016-07-15 17:23:26.833393", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:26.804486", "stderr": "", "stdout": "Name: base1\nState: RUNNING\nPID: 26343\nCPU use: 0.33 seconds\nBlkIO use: 72.00 KiB\nMemory use: 3.13 MiB\nKMem use: 0 bytes\nLink: vethMG9QVR\n TX bytes: 180 bytes\n RX bytes: 90 bytes\n Total bytes: 270 bytes", "stdout_lines": ["Name: base1", "State: RUNNING", "PID: 26343", "CPU use: 0.33 seconds", "BlkIO use: 72.00 KiB", "Memory use: 3.13 MiB", "KMem use: 0 bytes", "Link: vethMG9QVR", " TX bytes: 180 bytes", " RX bytes: 90 bytes", " Total bytes: 270 bytes"], "warnings": []}
TASK [Check state of overlayfs1] ***********************************************
task path: /root/create-containers.yml:37
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603406.87-276707569579500 `" && echo ansible-tmp-1468603406.87-276707569579500="` echo $HOME/.ansible/tmp/ansible-tmp-1468603406.87-276707569579500 `" ) && sleep 0'
<localhost> PUT /tmp/tmpuCT1am TO /root/.ansible/tmp/ansible-tmp-1468603406.87-276707569579500/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603406.87-276707569579500/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603406.87-276707569579500/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs1"], "delta": "0:00:00.011751", "end": "2016-07-15 17:23:26.967583", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:26.955832", "stderr": "", "stdout": "Name: overlayfs1\nState: STOPPED", "stdout_lines": ["Name: overlayfs1", "State: STOPPED"], "warnings": []}
TASK [Create container base2] **************************************************
task path: /root/create-containers.yml:40
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603407.0-102582127059741 `" && echo ansible-tmp-1468603407.0-102582127059741="` echo $HOME/.ansible/tmp/ansible-tmp-1468603407.0-102582127059741 `" ) && sleep 0'
<localhost> PUT /tmp/tmpoBTtY1 TO /root/.ansible/tmp/ansible-tmp-1468603407.0-102582127059741/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603407.0-102582127059741/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603407.0-102582127059741/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "stopped"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:48
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603416.4-164405645070809 `" && echo ansible-tmp-1468603416.4-164405645070809="` echo $HOME/.ansible/tmp/ansible-tmp-1468603416.4-164405645070809 `" ) && sleep 0'
<localhost> PUT /tmp/tmpvybcEF TO /root/.ansible/tmp/ansible-tmp-1468603416.4-164405645070809/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603416.4-164405645070809/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603416.4-164405645070809/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.011571", "end": "2016-07-15 17:23:36.491514", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:36.479943", "stderr": "", "stdout": "Name: base2\nState: STOPPED", "stdout_lines": ["Name: base2", "State: STOPPED"], "warnings": []}
PLAY [Create container via delegation] *****************************************
TASK [Create container overlay2] ***********************************************
task path: /root/create-containers.yml:55
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603416.53-10275468552362 `" && echo ansible-tmp-1468603416.53-10275468552362="` echo $HOME/.ansible/tmp/ansible-tmp-1468603416.53-10275468552362 `" ) && sleep 0'
<localhost> PUT /tmp/tmpAn1Wsz TO /root/.ansible/tmp/ansible-tmp-1468603416.53-10275468552362/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603416.53-10275468552362/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603416.53-10275468552362/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs2", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 27394, "interfaces": ["eth0", "lo"], "ips": [], "name": "base2", "state": "running"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:64
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603418.4-91571879462515 `" && echo ansible-tmp-1468603418.4-91571879462515="` echo $HOME/.ansible/tmp/ansible-tmp-1468603418.4-91571879462515 `" ) && sleep 0'
<localhost> PUT /tmp/tmpq0TtKH TO /root/.ansible/tmp/ansible-tmp-1468603418.4-91571879462515/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603418.4-91571879462515/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603418.4-91571879462515/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.028138", "end": "2016-07-15 17:23:38.512290", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:38.484152", "stderr": "", "stdout": "Name: base2\nState: RUNNING\nPID: 27394\nCPU use: 0.33 seconds\nBlkIO use: 72.00 KiB\nMemory use: 3.05 MiB\nKMem use: 0 bytes\nLink: vethWUODQ5\n TX bytes: 348 bytes\n RX bytes: 258 bytes\n Total bytes: 606 bytes", "stdout_lines": ["Name: base2", "State: RUNNING", "PID: 27394", "CPU use: 0.33 seconds", "BlkIO use: 72.00 KiB", "Memory use: 3.05 MiB", "KMem use: 0 bytes", "Link: vethWUODQ5", " TX bytes: 348 bytes", " RX bytes: 258 bytes", " Total bytes: 606 bytes"], "warnings": []}
TASK [Check state of overlayfs2] ***********************************************
task path: /root/create-containers.yml:68
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468603418.55-69332511805674 `" && echo ansible-tmp-1468603418.55-69332511805674="` echo $HOME/.ansible/tmp/ansible-tmp-1468603418.55-69332511805674 `" ) && sleep 0'
<localhost> PUT /tmp/tmpKFjuaJ TO /root/.ansible/tmp/ansible-tmp-1468603418.55-69332511805674/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468603418.55-69332511805674/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468603418.55-69332511805674/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs2"], "delta": "0:00:00.011656", "end": "2016-07-15 17:23:38.652344", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:23:38.640688", "stderr": "", "stdout": "Name: overlayfs2\nState: STOPPED", "stdout_lines": ["Name: overlayfs2", "State: STOPPED"], "warnings": []}
PLAY RECAP *********************************************************************
localhost : ok=9 changed=8 unreachable=0 failed=0
overlayfs2 : ok=3 changed=3 unreachable=0 failed=0
root@lxc-trusty2:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.4 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.4 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
root@lxc-trusty2:~# dpkg-query --list | grep "linux\|lxc"
ii liblxc1 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (library)
ii libselinux1:amd64 2.2.2-1ubuntu0.1 amd64 SELinux runtime shared libraries
ii linux-firmware 1.127.22 all Firmware for Linux kernel drivers
ii linux-generic 3.13.0.88.94 amd64 Complete Generic Linux kernel and headers
ii linux-generic-lts-xenial 4.4.0.31.21 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.13.0-88 3.13.0-88.135 all Header files related to Linux kernel version 3.13.0
ii linux-headers-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel headers for version 3.13.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-31 4.4.0-31.50~14.04.1 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-generic 3.13.0.88.94 amd64 Generic Linux kernel headers
ii linux-headers-generic-lts-xenial 4.4.0.31.21 amd64 Generic Linux kernel headers
ii linux-image-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.88.94 amd64 Generic Linux kernel image
ii linux-image-generic-lts-xenial 4.4.0.31.21 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.13.0-92.139 amd64 Linux Kernel Headers for development
ii lxc 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools
ii lxc-dev 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (development)
ii lxc-templates 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (templates)
ii python3-lxc 1.0.8-0ubuntu0.3 amd64 Linux Containers userspace tools (Python 3.x bindings)
ii util-linux 2.20.1-5.1ubuntu20.7 amd64 Miscellaneous system utilities
root@lxc-trusty2:~# uname -a
Linux lxc-trusty2 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@lxc-trusty2:~# pip freeze
ansible==2.1.0.0
cffi==1.7.0
chardet==2.0.1
Cheetah==2.4.4
cloud-init==0.7.5
configobj==4.7.2
cryptography==1.4
distro-info==0.12
enum34==1.1.6
euca2ools==3.0.1
idna==2.1
ipaddress==1.0.16
Jinja2==2.8
jsonpatch==1.3
jsonpointer==1.0
lxc-python2==0.1
lxml==3.3.3
MarkupSafe==0.23
oauth==1.0.1
paramiko==2.0.1
prettytable==0.7.2
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
pyinotify==0.9.4
pyserial==2.6
PyYAML==3.11
requestbuilder==0.1.0b1
requests==2.2.1
six==1.10.0
urllib3==1.7.1
#!/bin/bash
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban \
build-essential python2.7 python-dev \
libssl-dev libffi-dev \
lxc lxc-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
pip install -U lxc-python2 setuptools ansible
apt-get install -y --install-recommends linux-generic-lts-xenial
reboot
root@lxc-trusty2:~# ansible-playbook -i inventory create-containers.yml -vvv
No config file found; using defaults
PLAYBOOK: create-containers.yml ************************************************
2 plays in create-containers.yml
PLAY [Create containers via host target] ***************************************
TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.03-163376185579676 `" && echo ansible-tmp-1468605990.03-163376185579676="` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.03-163376185579676 `" ) && sleep 0'
<localhost> PUT /tmp/tmpmJSAHR TO /root/.ansible/tmp/ansible-tmp-1468605990.03-163376185579676/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605990.03-163376185579676/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605990.03-163376185579676/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Clean up previous tests] *************************************************
task path: /root/create-containers.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.6-141705435607508 `" && echo ansible-tmp-1468605990.6-141705435607508="` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.6-141705435607508 `" ) && sleep 0'
<localhost> PUT /tmp/tmpIP6Iyu TO /root/.ansible/tmp/ansible-tmp-1468605990.6-141705435607508/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605990.6-141705435607508/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605990.6-141705435607508/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs1", "lxc_path": null, "name": "overlayfs1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.73-195127327091614 `" && echo ansible-tmp-1468605990.73-195127327091614="` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.73-195127327091614 `" ) && sleep 0'
<localhost> PUT /tmp/tmpnPnHpi TO /root/.ansible/tmp/ansible-tmp-1468605990.73-195127327091614/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605990.73-195127327091614/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605990.73-195127327091614/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.87-6208723118344 `" && echo ansible-tmp-1468605990.87-6208723118344="` echo $HOME/.ansible/tmp/ansible-tmp-1468605990.87-6208723118344 `" ) && sleep 0'
<localhost> PUT /tmp/tmpeBZ1Ac TO /root/.ansible/tmp/ansible-tmp-1468605990.87-6208723118344/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605990.87-6208723118344/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605990.87-6208723118344/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs2", "lxc_path": null, "name": "overlayfs2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs2", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605991.01-28101638370308 `" && echo ansible-tmp-1468605991.01-28101638370308="` echo $HOME/.ansible/tmp/ansible-tmp-1468605991.01-28101638370308 `" ) && sleep 0'
<localhost> PUT /tmp/tmpixAASb TO /root/.ansible/tmp/ansible-tmp-1468605991.01-28101638370308/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605991.01-28101638370308/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605991.01-28101638370308/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "absent"}}
TASK [Create container base1] **************************************************
task path: /root/create-containers.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605991.15-107601506668279 `" && echo ansible-tmp-1468605991.15-107601506668279="` echo $HOME/.ansible/tmp/ansible-tmp-1468605991.15-107601506668279 `" ) && sleep 0'
<localhost> PUT /tmp/tmpUdqOBA TO /root/.ansible/tmp/ansible-tmp-1468605991.15-107601506668279/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605991.15-107601506668279/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605991.15-107601506668279/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "stopped"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606010.94-226883173100737 `" && echo ansible-tmp-1468606010.94-226883173100737="` echo $HOME/.ansible/tmp/ansible-tmp-1468606010.94-226883173100737 `" ) && sleep 0'
<localhost> PUT /tmp/tmpNRtrjO TO /root/.ansible/tmp/ansible-tmp-1468606010.94-226883173100737/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606010.94-226883173100737/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606010.94-226883173100737/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.028885", "end": "2016-07-15 18:06:51.056795", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:06:51.027910", "stderr": "", "stdout": "Name: base1\nState: STOPPED", "stdout_lines": ["Name: base1", "State: STOPPED"], "warnings": []}
TASK [Create container overlay1] ***********************************************
task path: /root/create-containers.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606011.09-123331535939951 `" && echo ansible-tmp-1468606011.09-123331535939951="` echo $HOME/.ansible/tmp/ansible-tmp-1468606011.09-123331535939951 `" ) && sleep 0'
<localhost> PUT /tmp/tmpJPLRrH TO /root/.ansible/tmp/ansible-tmp-1468606011.09-123331535939951/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606011.09-123331535939951/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606011.09-123331535939951/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs1", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 4152, "interfaces": ["eth0", "lo"], "ips": [], "name": "base1", "state": "running"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:34
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.11-186374233119132 `" && echo ansible-tmp-1468606013.11-186374233119132="` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.11-186374233119132 `" ) && sleep 0'
<localhost> PUT /tmp/tmpRm8EdB TO /root/.ansible/tmp/ansible-tmp-1468606013.11-186374233119132/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606013.11-186374233119132/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606013.11-186374233119132/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.051065", "end": "2016-07-15 18:06:53.234706", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:06:53.183641", "stderr": "", "stdout": "Name: base1\nState: RUNNING\nPID: 4152\nCPU use: 0.41 seconds\nBlkIO use: 80.00 KiB\nMemory use: 3.71 MiB\nKMem use: 0 bytes\nLink: vethWOLBRR\n TX bytes: 168 bytes\n RX bytes: 90 bytes\n Total bytes: 258 bytes", "stdout_lines": ["Name: base1", "State: RUNNING", "PID: 4152", "CPU use: 0.41 seconds", "BlkIO use: 80.00 KiB", "Memory use: 3.71 MiB", "KMem use: 0 bytes", "Link: vethWOLBRR", " TX bytes: 168 bytes", " RX bytes: 90 bytes", " Total bytes: 258 bytes"], "warnings": []}
TASK [Check state of overlayfs1] ***********************************************
task path: /root/create-containers.yml:37
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.27-271073072754865 `" && echo ansible-tmp-1468606013.27-271073072754865="` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.27-271073072754865 `" ) && sleep 0'
<localhost> PUT /tmp/tmpdhmd1C TO /root/.ansible/tmp/ansible-tmp-1468606013.27-271073072754865/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606013.27-271073072754865/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606013.27-271073072754865/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs1"], "delta": "0:00:00.026232", "end": "2016-07-15 18:06:53.388625", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:06:53.362393", "stderr": "", "stdout": "Name: overlayfs1\nState: STOPPED", "stdout_lines": ["Name: overlayfs1", "State: STOPPED"], "warnings": []}
TASK [Create container base2] **************************************************
task path: /root/create-containers.yml:40
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.42-249470520637831 `" && echo ansible-tmp-1468606013.42-249470520637831="` echo $HOME/.ansible/tmp/ansible-tmp-1468606013.42-249470520637831 `" ) && sleep 0'
<localhost> PUT /tmp/tmpqdD62U TO /root/.ansible/tmp/ansible-tmp-1468606013.42-249470520637831/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606013.42-249470520637831/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606013.42-249470520637831/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "stopped"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:48
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606022.75-118337137662397 `" && echo ansible-tmp-1468606022.75-118337137662397="` echo $HOME/.ansible/tmp/ansible-tmp-1468606022.75-118337137662397 `" ) && sleep 0'
<localhost> PUT /tmp/tmpWhIbMm TO /root/.ansible/tmp/ansible-tmp-1468606022.75-118337137662397/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606022.75-118337137662397/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606022.75-118337137662397/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.028022", "end": "2016-07-15 18:07:02.852758", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:07:02.824736", "stderr": "", "stdout": "Name: base2\nState: STOPPED", "stdout_lines": ["Name: base2", "State: STOPPED"], "warnings": []}
PLAY [Create container via delegation] *****************************************
TASK [Create container overlay2] ***********************************************
task path: /root/create-containers.yml:55
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606022.9-126013950603574 `" && echo ansible-tmp-1468606022.9-126013950603574="` echo $HOME/.ansible/tmp/ansible-tmp-1468606022.9-126013950603574 `" ) && sleep 0'
<localhost> PUT /tmp/tmpbQ2ZkW TO /root/.ansible/tmp/ansible-tmp-1468606022.9-126013950603574/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606022.9-126013950603574/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606022.9-126013950603574/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs2", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 5138, "interfaces": ["eth0", "lo"], "ips": [], "name": "base2", "state": "running"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:64
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606024.92-16182630387841 `" && echo ansible-tmp-1468606024.92-16182630387841="` echo $HOME/.ansible/tmp/ansible-tmp-1468606024.92-16182630387841 `" ) && sleep 0'
<localhost> PUT /tmp/tmp6UF96y TO /root/.ansible/tmp/ansible-tmp-1468606024.92-16182630387841/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606024.92-16182630387841/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606024.92-16182630387841/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.046785", "end": "2016-07-15 18:07:05.058976", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:07:05.012191", "stderr": "", "stdout": "Name: base2\nState: RUNNING\nPID: 5138\nCPU use: 0.54 seconds\nBlkIO use: 80.00 KiB\nMemory use: 5.49 MiB\nKMem use: 0 bytes\nLink: vethEHYGNV\n TX bytes: 168 bytes\n RX bytes: 258 bytes\n Total bytes: 426 bytes", "stdout_lines": ["Name: base2", "State: RUNNING", "PID: 5138", "CPU use: 0.54 seconds", "BlkIO use: 80.00 KiB", "Memory use: 5.49 MiB", "KMem use: 0 bytes", "Link: vethEHYGNV", " TX bytes: 168 bytes", " RX bytes: 258 bytes", " Total bytes: 426 bytes"], "warnings": []}
TASK [Check state of overlayfs2] ***********************************************
task path: /root/create-containers.yml:68
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468606025.09-85338881212796 `" && echo ansible-tmp-1468606025.09-85338881212796="` echo $HOME/.ansible/tmp/ansible-tmp-1468606025.09-85338881212796 `" ) && sleep 0'
<localhost> PUT /tmp/tmp5AY6QE TO /root/.ansible/tmp/ansible-tmp-1468606025.09-85338881212796/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468606025.09-85338881212796/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468606025.09-85338881212796/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs2"], "delta": "0:00:00.031883", "end": "2016-07-15 18:07:05.204521", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:07:05.172638", "stderr": "", "stdout": "Name: overlayfs2\nState: STOPPED", "stdout_lines": ["Name: overlayfs2", "State: STOPPED"], "warnings": []}
PLAY RECAP *********************************************************************
localhost : ok=9 changed=7 unreachable=0 failed=0
overlayfs2 : ok=3 changed=3 unreachable=0 failed=0
root@lxc-trusty3:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.4 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.4 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
root@lxc-trusty3:~# dpkg-query --list | grep "linux\|lxc"
ii liblxc1 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (library)
ii libselinux1:amd64 2.2.2-1ubuntu0.1 amd64 SELinux runtime shared libraries
ii linux-firmware 1.127.22 all Firmware for Linux kernel drivers
ii linux-generic 3.13.0.88.94 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.13.0-88 3.13.0-88.135 all Header files related to Linux kernel version 3.13.0
ii linux-headers-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel headers for version 3.13.0 on 64 bit x86 SMP
ii linux-headers-generic 3.13.0.88.94 amd64 Generic Linux kernel headers
ii linux-image-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.88.94 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.13.0-92.139 amd64 Linux Kernel Headers for development
ii lxc 2.0.3-0ubuntu1~ubuntu14.04.1 all Transitional package for lxc1
ii lxc-common 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (common tools)
ii lxc-dev 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (development)
ii lxc-templates 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (templates)
ii lxc1 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools
ii lxcfs 2.0.2-0ubuntu1~ubuntu14.04.1 amd64 FUSE based filesystem for LXC
ii python3-lxc 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (Python 3.x bindings)
ii util-linux 2.20.1-5.1ubuntu20.7 amd64 Miscellaneous system utilities
root@lxc-trusty3:~# uname -a
Linux lxc-trusty3 3.13.0-88-generic #135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@lxc-trusty3:~# pip freeze
ansible==2.1.0.0
cffi==1.7.0
chardet==2.0.1
Cheetah==2.4.4
cloud-init==0.7.5
configobj==4.7.2
cryptography==1.4
distro-info==0.12
enum34==1.1.6
euca2ools==3.0.1
idna==2.1
ipaddress==1.0.16
Jinja2==2.8
jsonpatch==1.3
jsonpointer==1.0
lxc-python2==0.1
lxml==3.3.3
MarkupSafe==0.23
oauth==1.0.1
paramiko==2.0.1
prettytable==0.7.2
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
pyinotify==0.9.4
pyserial==2.6
PyYAML==3.11
requestbuilder==0.1.0b1
requests==2.2.1
six==1.10.0
urllib3==1.7.1
#!/bin/bash
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban \
build-essential python2.7 python-dev \
libssl-dev libffi-dev
apt-get -t trusty-backports install -y lxc lxc-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
pip install -U lxc-python2 setuptools ansible
root@lxc-trusty3:~# ansible-playbook -i inventory create-containers.yml -vvv
No config file found; using defaults
PLAYBOOK: create-containers.yml ************************************************
2 plays in create-containers.yml
PLAY [Create containers via host target] ***************************************
TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.06-222473004689938 `" && echo ansible-tmp-1468604967.06-222473004689938="` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.06-222473004689938 `" ) && sleep 0'
<localhost> PUT /tmp/tmpdbMTut TO /root/.ansible/tmp/ansible-tmp-1468604967.06-222473004689938/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604967.06-222473004689938/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604967.06-222473004689938/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Clean up previous tests] *************************************************
task path: /root/create-containers.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.61-65008224053334 `" && echo ansible-tmp-1468604967.61-65008224053334="` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.61-65008224053334 `" ) && sleep 0'
<localhost> PUT /tmp/tmpViBcfD TO /root/.ansible/tmp/ansible-tmp-1468604967.61-65008224053334/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604967.61-65008224053334/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604967.61-65008224053334/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs1", "lxc_path": null, "name": "overlayfs1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.72-130810428450012 `" && echo ansible-tmp-1468604967.72-130810428450012="` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.72-130810428450012 `" ) && sleep 0'
<localhost> PUT /tmp/tmprCkmhg TO /root/.ansible/tmp/ansible-tmp-1468604967.72-130810428450012/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604967.72-130810428450012/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604967.72-130810428450012/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.83-89299629298115 `" && echo ansible-tmp-1468604967.83-89299629298115="` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.83-89299629298115 `" ) && sleep 0'
<localhost> PUT /tmp/tmp95Eus6 TO /root/.ansible/tmp/ansible-tmp-1468604967.83-89299629298115/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604967.83-89299629298115/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604967.83-89299629298115/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs2", "lxc_path": null, "name": "overlayfs2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs2", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.94-98658629144822 `" && echo ansible-tmp-1468604967.94-98658629144822="` echo $HOME/.ansible/tmp/ansible-tmp-1468604967.94-98658629144822 `" ) && sleep 0'
<localhost> PUT /tmp/tmpe5uYE2 TO /root/.ansible/tmp/ansible-tmp-1468604967.94-98658629144822/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604967.94-98658629144822/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604967.94-98658629144822/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "absent"}}
TASK [Create container base1] **************************************************
task path: /root/create-containers.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468604968.06-209184475971762 `" && echo ansible-tmp-1468604968.06-209184475971762="` echo $HOME/.ansible/tmp/ansible-tmp-1468604968.06-209184475971762 `" ) && sleep 0'
<localhost> PUT /tmp/tmpId0Dk8 TO /root/.ansible/tmp/ansible-tmp-1468604968.06-209184475971762/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468604968.06-209184475971762/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468604968.06-209184475971762/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "stopped"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605005.04-135743136240877 `" && echo ansible-tmp-1468605005.04-135743136240877="` echo $HOME/.ansible/tmp/ansible-tmp-1468605005.04-135743136240877 `" ) && sleep 0'
<localhost> PUT /tmp/tmpFsWd1O TO /root/.ansible/tmp/ansible-tmp-1468605005.04-135743136240877/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605005.04-135743136240877/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605005.04-135743136240877/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.004146", "end": "2016-07-15 17:50:05.125178", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:05.121032", "stderr": "", "stdout": "Name: base1\nState: STOPPED", "stdout_lines": ["Name: base1", "State: STOPPED"], "warnings": []}
TASK [Create container overlay1] ***********************************************
task path: /root/create-containers.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605005.16-88633648172493 `" && echo ansible-tmp-1468605005.16-88633648172493="` echo $HOME/.ansible/tmp/ansible-tmp-1468605005.16-88633648172493 `" ) && sleep 0'
<localhost> PUT /tmp/tmpHRttW7 TO /root/.ansible/tmp/ansible-tmp-1468605005.16-88633648172493/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605005.16-88633648172493/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605005.16-88633648172493/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs1", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 17181, "interfaces": ["eth0", "lo"], "ips": [], "name": "base1", "state": "running"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:34
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.61-65152681112907 `" && echo ansible-tmp-1468605007.61-65152681112907="` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.61-65152681112907 `" ) && sleep 0'
<localhost> PUT /tmp/tmpHPQ_KE TO /root/.ansible/tmp/ansible-tmp-1468605007.61-65152681112907/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605007.61-65152681112907/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605007.61-65152681112907/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.007198", "end": "2016-07-15 17:50:07.711252", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:07.704054", "stderr": "", "stdout": "Name: base1\nState: RUNNING\nPID: 17181\nCPU use: 0.33 seconds\nBlkIO use: 120.00 KiB\nMemory use: 2.89 MiB\nKMem use: 0 bytes\nLink: vethV0SUFA\n TX bytes: 90 bytes\n RX bytes: 258 bytes\n Total bytes: 348 bytes", "stdout_lines": ["Name: base1", "State: RUNNING", "PID: 17181", "CPU use: 0.33 seconds", "BlkIO use: 120.00 KiB", "Memory use: 2.89 MiB", "KMem use: 0 bytes", "Link: vethV0SUFA", " TX bytes: 90 bytes", " RX bytes: 258 bytes", " Total bytes: 348 bytes"], "warnings": []}
TASK [Check state of overlayfs1] ***********************************************
task path: /root/create-containers.yml:37
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.75-134506384465189 `" && echo ansible-tmp-1468605007.75-134506384465189="` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.75-134506384465189 `" ) && sleep 0'
<localhost> PUT /tmp/tmpYU4shC TO /root/.ansible/tmp/ansible-tmp-1468605007.75-134506384465189/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605007.75-134506384465189/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605007.75-134506384465189/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs1"], "delta": "0:00:00.004619", "end": "2016-07-15 17:50:07.833833", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:07.829214", "stderr": "", "stdout": "Name: overlayfs1\nState: STOPPED", "stdout_lines": ["Name: overlayfs1", "State: STOPPED"], "warnings": []}
TASK [Create container base2] **************************************************
task path: /root/create-containers.yml:40
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.87-176910554198628 `" && echo ansible-tmp-1468605007.87-176910554198628="` echo $HOME/.ansible/tmp/ansible-tmp-1468605007.87-176910554198628 `" ) && sleep 0'
<localhost> PUT /tmp/tmpGuYAge TO /root/.ansible/tmp/ansible-tmp-1468605007.87-176910554198628/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605007.87-176910554198628/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605007.87-176910554198628/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "stopped"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:48
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605017.27-5902452965669 `" && echo ansible-tmp-1468605017.27-5902452965669="` echo $HOME/.ansible/tmp/ansible-tmp-1468605017.27-5902452965669 `" ) && sleep 0'
<localhost> PUT /tmp/tmpzJxOnq TO /root/.ansible/tmp/ansible-tmp-1468605017.27-5902452965669/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605017.27-5902452965669/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605017.27-5902452965669/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.004186", "end": "2016-07-15 17:50:17.354467", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:17.350281", "stderr": "", "stdout": "Name: base2\nState: STOPPED", "stdout_lines": ["Name: base2", "State: STOPPED"], "warnings": []}
PLAY [Create container via delegation] *****************************************
TASK [Create container overlay2] ***********************************************
task path: /root/create-containers.yml:55
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605017.4-93115936468113 `" && echo ansible-tmp-1468605017.4-93115936468113="` echo $HOME/.ansible/tmp/ansible-tmp-1468605017.4-93115936468113 `" ) && sleep 0'
<localhost> PUT /tmp/tmp4kkTAm TO /root/.ansible/tmp/ansible-tmp-1468605017.4-93115936468113/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605017.4-93115936468113/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605017.4-93115936468113/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs2", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 20801, "interfaces": ["eth0", "lo"], "ips": [], "name": "base2", "state": "running"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:64
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605019.8-264125865481113 `" && echo ansible-tmp-1468605019.8-264125865481113="` echo $HOME/.ansible/tmp/ansible-tmp-1468605019.8-264125865481113 `" ) && sleep 0'
<localhost> PUT /tmp/tmpdwpkVF TO /root/.ansible/tmp/ansible-tmp-1468605019.8-264125865481113/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605019.8-264125865481113/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605019.8-264125865481113/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.007037", "end": "2016-07-15 17:50:19.885454", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:19.878417", "stderr": "", "stdout": "Name: base2\nState: RUNNING\nPID: 20801\nCPU use: 0.29 seconds\nBlkIO use: 124.00 KiB\nMemory use: 2.95 MiB\nKMem use: 0 bytes\nLink: veth24NWPT\n TX bytes: 168 bytes\n RX bytes: 222 bytes\n Total bytes: 390 bytes", "stdout_lines": ["Name: base2", "State: RUNNING", "PID: 20801", "CPU use: 0.29 seconds", "BlkIO use: 124.00 KiB", "Memory use: 2.95 MiB", "KMem use: 0 bytes", "Link: veth24NWPT", " TX bytes: 168 bytes", " RX bytes: 222 bytes", " Total bytes: 390 bytes"], "warnings": []}
TASK [Check state of overlayfs2] ***********************************************
task path: /root/create-containers.yml:68
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468605019.92-14238254348608 `" && echo ansible-tmp-1468605019.92-14238254348608="` echo $HOME/.ansible/tmp/ansible-tmp-1468605019.92-14238254348608 `" ) && sleep 0'
<localhost> PUT /tmp/tmpLP6yme TO /root/.ansible/tmp/ansible-tmp-1468605019.92-14238254348608/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468605019.92-14238254348608/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468605019.92-14238254348608/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs2"], "delta": "0:00:00.004362", "end": "2016-07-15 17:50:20.006530", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 17:50:20.002168", "stderr": "", "stdout": "Name: overlayfs2\nState: STOPPED", "stdout_lines": ["Name: overlayfs2", "State: STOPPED"], "warnings": []}
PLAY RECAP *********************************************************************
localhost : ok=9 changed=7 unreachable=0 failed=0
overlayfs2 : ok=3 changed=3 unreachable=0 failed=0
root@lxc-trusty4:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.4 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.4 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
root@lxc-trusty4:~# dpkg-query --list | grep "linux\|lxc"
ii liblxc1 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (library)
ii libselinux1:amd64 2.2.2-1ubuntu0.1 amd64 SELinux runtime shared libraries
ii linux-firmware 1.127.22 all Firmware for Linux kernel drivers
ii linux-generic 3.13.0.88.94 amd64 Complete Generic Linux kernel and headers
ii linux-generic-lts-xenial 4.4.0.31.21 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.13.0-88 3.13.0-88.135 all Header files related to Linux kernel version 3.13.0
ii linux-headers-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel headers for version 3.13.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-31 4.4.0-31.50~14.04.1 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-generic 3.13.0.88.94 amd64 Generic Linux kernel headers
ii linux-headers-generic-lts-xenial 4.4.0.31.21 amd64 Generic Linux kernel headers
ii linux-image-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-88-generic 3.13.0-88.135 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-31-generic 4.4.0-31.50~14.04.1 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.88.94 amd64 Generic Linux kernel image
ii linux-image-generic-lts-xenial 4.4.0.31.21 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.13.0-92.139 amd64 Linux Kernel Headers for development
ii lxc 2.0.3-0ubuntu1~ubuntu14.04.1 all Transitional package for lxc1
ii lxc-common 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (common tools)
ii lxc-dev 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (development)
ii lxc-templates 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (templates)
ii lxc1 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools
ii lxcfs 2.0.2-0ubuntu1~ubuntu14.04.1 amd64 FUSE based filesystem for LXC
ii python3-lxc 2.0.3-0ubuntu1~ubuntu14.04.1 amd64 Linux Containers userspace tools (Python 3.x bindings)
ii util-linux 2.20.1-5.1ubuntu20.7 amd64 Miscellaneous system utilities
root@lxc-trusty4:~# uname -a
Linux lxc-trusty4 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@lxc-trusty4:~# pip freeze
ansible==2.1.0.0
cffi==1.7.0
chardet==2.0.1
Cheetah==2.4.4
cloud-init==0.7.5
configobj==4.7.2
cryptography==1.4
distro-info==0.12
enum34==1.1.6
euca2ools==3.0.1
idna==2.1
ipaddress==1.0.16
Jinja2==2.8
jsonpatch==1.3
jsonpointer==1.0
lxc-python2==0.1
lxml==3.3.3
MarkupSafe==0.23
oauth==1.0.1
paramiko==2.0.1
prettytable==0.7.2
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
pyinotify==0.9.4
pyserial==2.6
PyYAML==3.11
requestbuilder==0.1.0b1
requests==2.2.1
six==1.10.0
urllib3==1.7.1
#!/bin/bash
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban \
build-essential python2.7 python-dev \
libssl-dev libffi-dev
apt-get install -y --install-recommends linux-generic-lts-xenial
reboot
apt-get -t trusty-backports install -y lxc lxc-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
pip install -U lxc-python2 setuptools ansible
root@lxc-trusty4:~# ansible-playbook -i inventory create-containers.yml -vvv
No config file found; using defaults
PLAYBOOK: create-containers.yml ************************************************
2 plays in create-containers.yml
PLAY [Create containers via host target] ***************************************
TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607114.99-142089035313581 `" && echo ansible-tmp-1468607114.99-142089035313581="` echo $HOME/.ansible/tmp/ansible-tmp-1468607114.99-142089035313581 `" ) && sleep 0'
<localhost> PUT /tmp/tmpexxbTy TO /root/.ansible/tmp/ansible-tmp-1468607114.99-142089035313581/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607114.99-142089035313581/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607114.99-142089035313581/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Clean up previous tests] *************************************************
task path: /root/create-containers.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.59-148655762308025 `" && echo ansible-tmp-1468607115.59-148655762308025="` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.59-148655762308025 `" ) && sleep 0'
<localhost> PUT /tmp/tmpI2A64H TO /root/.ansible/tmp/ansible-tmp-1468607115.59-148655762308025/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607115.59-148655762308025/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607115.59-148655762308025/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs1", "lxc_path": null, "name": "overlayfs1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.7-134506425173082 `" && echo ansible-tmp-1468607115.7-134506425173082="` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.7-134506425173082 `" ) && sleep 0'
<localhost> PUT /tmp/tmpDkmKYL TO /root/.ansible/tmp/ansible-tmp-1468607115.7-134506425173082/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607115.7-134506425173082/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607115.7-134506425173082/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.81-151876706818943 `" && echo ansible-tmp-1468607115.81-151876706818943="` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.81-151876706818943 `" ) && sleep 0'
<localhost> PUT /tmp/tmpGHMySl TO /root/.ansible/tmp/ansible-tmp-1468607115.81-151876706818943/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607115.81-151876706818943/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607115.81-151876706818943/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs2", "lxc_path": null, "name": "overlayfs2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs2", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.93-200814058182291 `" && echo ansible-tmp-1468607115.93-200814058182291="` echo $HOME/.ansible/tmp/ansible-tmp-1468607115.93-200814058182291 `" ) && sleep 0'
<localhost> PUT /tmp/tmpRbKwEW TO /root/.ansible/tmp/ansible-tmp-1468607115.93-200814058182291/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607115.93-200814058182291/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607115.93-200814058182291/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "absent"}}
TASK [Create container base1] **************************************************
task path: /root/create-containers.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607116.06-212343688232441 `" && echo ansible-tmp-1468607116.06-212343688232441="` echo $HOME/.ansible/tmp/ansible-tmp-1468607116.06-212343688232441 `" ) && sleep 0'
<localhost> PUT /tmp/tmpR5NS5Y TO /root/.ansible/tmp/ansible-tmp-1468607116.06-212343688232441/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607116.06-212343688232441/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607116.06-212343688232441/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "stopped"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607144.37-179163859200037 `" && echo ansible-tmp-1468607144.37-179163859200037="` echo $HOME/.ansible/tmp/ansible-tmp-1468607144.37-179163859200037 `" ) && sleep 0'
<localhost> PUT /tmp/tmpGAUd94 TO /root/.ansible/tmp/ansible-tmp-1468607144.37-179163859200037/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607144.37-179163859200037/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607144.37-179163859200037/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.004007", "end": "2016-07-15 18:25:44.454268", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:44.450261", "stderr": "", "stdout": "Name: base1\nState: STOPPED", "stdout_lines": ["Name: base1", "State: STOPPED"], "warnings": []}
TASK [Create container overlay1] ***********************************************
task path: /root/create-containers.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607144.49-42545694389733 `" && echo ansible-tmp-1468607144.49-42545694389733="` echo $HOME/.ansible/tmp/ansible-tmp-1468607144.49-42545694389733 `" ) && sleep 0'
<localhost> PUT /tmp/tmpe7b1X2 TO /root/.ansible/tmp/ansible-tmp-1468607144.49-42545694389733/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607144.49-42545694389733/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607144.49-42545694389733/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs1", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 7590, "interfaces": ["eth0", "lo"], "ips": [], "name": "base1", "state": "running"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:34
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.43-204817282165752 `" && echo ansible-tmp-1468607146.43-204817282165752="` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.43-204817282165752 `" ) && sleep 0'
<localhost> PUT /tmp/tmpWhL_jc TO /root/.ansible/tmp/ansible-tmp-1468607146.43-204817282165752/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607146.43-204817282165752/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607146.43-204817282165752/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.006096", "end": "2016-07-15 18:25:46.525232", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:46.519136", "stderr": "", "stdout": "Name: base1\nState: RUNNING\nPID: 7590\nCPU use: 0.28 seconds\nBlkIO use: 96.00 KiB\nMemory use: 2.97 MiB\nKMem use: 0 bytes\nLink: vethB721EV\n TX bytes: 90 bytes\n RX bytes: 90 bytes\n Total bytes: 180 bytes", "stdout_lines": ["Name: base1", "State: RUNNING", "PID: 7590", "CPU use: 0.28 seconds", "BlkIO use: 96.00 KiB", "Memory use: 2.97 MiB", "KMem use: 0 bytes", "Link: vethB721EV", " TX bytes: 90 bytes", " RX bytes: 90 bytes", " Total bytes: 180 bytes"], "warnings": []}
TASK [Check state of overlayfs1] ***********************************************
task path: /root/create-containers.yml:37
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.56-272019048578693 `" && echo ansible-tmp-1468607146.56-272019048578693="` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.56-272019048578693 `" ) && sleep 0'
<localhost> PUT /tmp/tmpaJfjWk TO /root/.ansible/tmp/ansible-tmp-1468607146.56-272019048578693/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607146.56-272019048578693/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607146.56-272019048578693/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs1"], "delta": "0:00:00.003951", "end": "2016-07-15 18:25:46.646065", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:46.642114", "stderr": "", "stdout": "Name: overlayfs1\nState: STOPPED", "stdout_lines": ["Name: overlayfs1", "State: STOPPED"], "warnings": []}
TASK [Create container base2] **************************************************
task path: /root/create-containers.yml:40
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.68-54309365133121 `" && echo ansible-tmp-1468607146.68-54309365133121="` echo $HOME/.ansible/tmp/ansible-tmp-1468607146.68-54309365133121 `" ) && sleep 0'
<localhost> PUT /tmp/tmpaqrAjB TO /root/.ansible/tmp/ansible-tmp-1468607146.68-54309365133121/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607146.68-54309365133121/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607146.68-54309365133121/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "stopped"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:48
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607156.38-9429128166700 `" && echo ansible-tmp-1468607156.38-9429128166700="` echo $HOME/.ansible/tmp/ansible-tmp-1468607156.38-9429128166700 `" ) && sleep 0'
<localhost> PUT /tmp/tmpJMfQiS TO /root/.ansible/tmp/ansible-tmp-1468607156.38-9429128166700/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607156.38-9429128166700/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607156.38-9429128166700/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.003659", "end": "2016-07-15 18:25:56.472617", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:56.468958", "stderr": "", "stdout": "Name: base2\nState: STOPPED", "stdout_lines": ["Name: base2", "State: STOPPED"], "warnings": []}
PLAY [Create container via delegation] *****************************************
TASK [Create container overlay2] ***********************************************
task path: /root/create-containers.yml:55
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607156.52-39928001960271 `" && echo ansible-tmp-1468607156.52-39928001960271="` echo $HOME/.ansible/tmp/ansible-tmp-1468607156.52-39928001960271 `" ) && sleep 0'
<localhost> PUT /tmp/tmpwavXsQ TO /root/.ansible/tmp/ansible-tmp-1468607156.52-39928001960271/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607156.52-39928001960271/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607156.52-39928001960271/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs2", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 11065, "interfaces": ["eth0", "lo"], "ips": [], "name": "base2", "state": "running"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:64
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607158.49-228199656901512 `" && echo ansible-tmp-1468607158.49-228199656901512="` echo $HOME/.ansible/tmp/ansible-tmp-1468607158.49-228199656901512 `" ) && sleep 0'
<localhost> PUT /tmp/tmpYvhKNq TO /root/.ansible/tmp/ansible-tmp-1468607158.49-228199656901512/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607158.49-228199656901512/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607158.49-228199656901512/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.006347", "end": "2016-07-15 18:25:58.593378", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:58.587031", "stderr": "", "stdout": "Name: base2\nState: RUNNING\nPID: 11065\nCPU use: 0.36 seconds\nBlkIO use: 128.00 KiB\nMemory use: 3.30 MiB\nKMem use: 0 bytes\nLink: vethIPI7PN\n TX bytes: 90 bytes\n RX bytes: 132 bytes\n Total bytes: 222 bytes", "stdout_lines": ["Name: base2", "State: RUNNING", "PID: 11065", "CPU use: 0.36 seconds", "BlkIO use: 128.00 KiB", "Memory use: 3.30 MiB", "KMem use: 0 bytes", "Link: vethIPI7PN", " TX bytes: 90 bytes", " RX bytes: 132 bytes", " Total bytes: 222 bytes"], "warnings": []}
TASK [Check state of overlayfs2] ***********************************************
task path: /root/create-containers.yml:68
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607158.63-226714169012069 `" && echo ansible-tmp-1468607158.63-226714169012069="` echo $HOME/.ansible/tmp/ansible-tmp-1468607158.63-226714169012069 `" ) && sleep 0'
<localhost> PUT /tmp/tmpRGbfC6 TO /root/.ansible/tmp/ansible-tmp-1468607158.63-226714169012069/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607158.63-226714169012069/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607158.63-226714169012069/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs2"], "delta": "0:00:00.004294", "end": "2016-07-15 18:25:58.718840", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:25:58.714546", "stderr": "", "stdout": "Name: overlayfs2\nState: STOPPED", "stdout_lines": ["Name: overlayfs2", "State: STOPPED"], "warnings": []}
PLAY RECAP *********************************************************************
localhost : ok=9 changed=7 unreachable=0 failed=0
overlayfs2 : ok=3 changed=3 unreachable=0 failed=0
root@lxc-xenial1:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
root@lxc-xenial1:~# dpkg-query --list | grep "linux\|lxc"
ii console-setup-linux 1.108ubuntu15 all Linux specific part of console-setup
ii liblxc1 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools (library)
ii libselinux1:amd64 2.4-3build2 amd64 SELinux runtime shared libraries
ii linux-base 4.0ubuntu1 all Linux image base package
ii linux-headers-4.4.0-28 4.4.0-28.47 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-28-generic 4.4.0-28.47 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-generic 4.4.0.28.30 amd64 Generic Linux kernel headers
ii linux-headers-virtual 4.4.0.28.30 amd64 Transitional package.
ii linux-image-4.4.0-28-generic 4.4.0-28.47 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-virtual 4.4.0.28.30 amd64 This package will always depend on the latest minimal generic kernel image.
ii linux-libc-dev:amd64 4.4.0-31.50 amd64 Linux Kernel Headers for development
ii linux-virtual 4.4.0.28.30 amd64 Minimal Generic Linux kernel and headers
ii lxc 2.0.3-0ubuntu1~ubuntu16.04.1 all Transitional package for lxc1
ii lxc-common 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools (common tools)
ii lxc-dev 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools (development)
ii lxc-templates 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools (templates)
ii lxc1 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools
ii lxcfs 2.0.1-0ubuntu1~16.04.1 amd64 FUSE based filesystem for LXC
ii python3-lxc 2.0.3-0ubuntu1~ubuntu16.04.1 amd64 Linux Containers userspace tools (Python 3.x bindings)
ii util-linux 2.27.1-6ubuntu3.1 amd64 miscellaneous system utilities
root@lxc-xenial1:~# uname -a
Linux lxc-xenial1 4.4.0-28-generic #47-Ubuntu SMP Fri Jun 24 10:09:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@lxc-xenial1:~# pip freeze
ansible==2.1.0.0
anyjson==0.3.3
cffi==1.7.0
cryptography==1.4
enum34==1.1.6
idna==2.1
ipaddress==1.0.16
Jinja2==2.8
lxc-python2==0.1
MarkupSafe==0.23
paramiko==2.0.1
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
python-cjson==1.1.0
pyxenstore==0.0.2
PyYAML==3.11
six==1.10.0
root@lxc-xenial1:~# ansible-playbook -i inventory create-containers.yml -vvv
No config file found; using defaults
PLAYBOOK: create-containers.yml ************************************************
2 plays in create-containers.yml
PLAY [Create containers via host target] ***************************************
TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.09-271813758484692 `" && echo ansible-tmp-1468607883.09-271813758484692="` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.09-271813758484692 `" ) && sleep 0'
<localhost> PUT /tmp/tmp_EfJc7 TO /root/.ansible/tmp/ansible-tmp-1468607883.09-271813758484692/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607883.09-271813758484692/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607883.09-271813758484692/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Clean up previous tests] *************************************************
task path: /root/create-containers.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.78-103380542820979 `" && echo ansible-tmp-1468607883.78-103380542820979="` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.78-103380542820979 `" ) && sleep 0'
<localhost> PUT /tmp/tmpvxO5mW TO /root/.ansible/tmp/ansible-tmp-1468607883.78-103380542820979/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607883.78-103380542820979/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607883.78-103380542820979/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs1", "lxc_path": null, "name": "overlayfs1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.95-251585415925547 `" && echo ansible-tmp-1468607883.95-251585415925547="` echo $HOME/.ansible/tmp/ansible-tmp-1468607883.95-251585415925547 `" ) && sleep 0'
<localhost> PUT /tmp/tmpvm6k_w TO /root/.ansible/tmp/ansible-tmp-1468607883.95-251585415925547/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607883.95-251585415925547/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607883.95-251585415925547/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base1) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base1", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.13-106411527104957 `" && echo ansible-tmp-1468607884.13-106411527104957="` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.13-106411527104957 `" ) && sleep 0'
<localhost> PUT /tmp/tmpuM73Ly TO /root/.ansible/tmp/ansible-tmp-1468607884.13-106411527104957/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607884.13-106411527104957/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607884.13-106411527104957/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=overlayfs2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "overlayfs2", "lxc_path": null, "name": "overlayfs2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "overlayfs2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "overlayfs2", "state": "absent"}}
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.31-113670600955614 `" && echo ansible-tmp-1468607884.31-113670600955614="` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.31-113670600955614 `" ) && sleep 0'
<localhost> PUT /tmp/tmp785YGI TO /root/.ansible/tmp/ansible-tmp-1468607884.31-113670600955614/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607884.31-113670600955614/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607884.31-113670600955614/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=base2) => {"changed": false, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "absent", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "item": "base2", "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "absent"}}
TASK [Create container base1] **************************************************
task path: /root/create-containers.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.49-1059507811823 `" && echo ansible-tmp-1468607884.49-1059507811823="` echo $HOME/.ansible/tmp/ansible-tmp-1468607884.49-1059507811823 `" ) && sleep 0'
<localhost> PUT /tmp/tmpP8lPk8 TO /root/.ansible/tmp/ansible-tmp-1468607884.49-1059507811823/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607884.49-1059507811823/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607884.49-1059507811823/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base1", "state": "stopped"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607906.03-183159926908858 `" && echo ansible-tmp-1468607906.03-183159926908858="` echo $HOME/.ansible/tmp/ansible-tmp-1468607906.03-183159926908858 `" ) && sleep 0'
<localhost> PUT /tmp/tmpSd4TJt TO /root/.ansible/tmp/ansible-tmp-1468607906.03-183159926908858/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607906.03-183159926908858/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607906.03-183159926908858/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.004127", "end": "2016-07-15 18:38:26.184072", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:26.179945", "stderr": "", "stdout": "Name: base1\nState: STOPPED", "stdout_lines": ["Name: base1", "State: STOPPED"], "warnings": []}
TASK [Create container overlay1] ***********************************************
task path: /root/create-containers.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607906.22-205365691230669 `" && echo ansible-tmp-1468607906.22-205365691230669="` echo $HOME/.ansible/tmp/ansible-tmp-1468607906.22-205365691230669 `" ) && sleep 0'
<localhost> PUT /tmp/tmpe2wK6B TO /root/.ansible/tmp/ansible-tmp-1468607906.22-205365691230669/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607906.22-205365691230669/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607906.22-205365691230669/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs1", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base1", "lxc_path": null, "name": "base1", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 14306, "interfaces": ["eth0", "lo"], "ips": [], "name": "base1", "state": "running"}}
TASK [Check state of base1] ****************************************************
task path: /root/create-containers.yml:34
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.27-116850626241577 `" && echo ansible-tmp-1468607908.27-116850626241577="` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.27-116850626241577 `" ) && sleep 0'
<localhost> PUT /tmp/tmpmOWQZ8 TO /root/.ansible/tmp/ansible-tmp-1468607908.27-116850626241577/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607908.27-116850626241577/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607908.27-116850626241577/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base1"], "delta": "0:00:00.006826", "end": "2016-07-15 18:38:28.416045", "invocation": {"module_args": {"_raw_params": "lxc-info -n base1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:28.409219", "stderr": "", "stdout": "Name: base1\nState: RUNNING\nPID: 14306\nCPU use: 0.42 seconds\nBlkIO use: 128.00 KiB\nMemory use: 3.38 MiB\nKMem use: 0 bytes\nLink: vethNMJRXQ\n TX bytes: 258 bytes\n RX bytes: 90 bytes\n Total bytes: 348 bytes", "stdout_lines": ["Name: base1", "State: RUNNING", "PID: 14306", "CPU use: 0.42 seconds", "BlkIO use: 128.00 KiB", "Memory use: 3.38 MiB", "KMem use: 0 bytes", "Link: vethNMJRXQ", " TX bytes: 258 bytes", " RX bytes: 90 bytes", " Total bytes: 348 bytes"], "warnings": []}
TASK [Check state of overlayfs1] ***********************************************
task path: /root/create-containers.yml:37
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.45-78662093375808 `" && echo ansible-tmp-1468607908.45-78662093375808="` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.45-78662093375808 `" ) && sleep 0'
<localhost> PUT /tmp/tmpuQGz18 TO /root/.ansible/tmp/ansible-tmp-1468607908.45-78662093375808/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607908.45-78662093375808/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607908.45-78662093375808/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs1"], "delta": "0:00:00.004198", "end": "2016-07-15 18:38:28.594392", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs1", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:28.590194", "stderr": "", "stdout": "Name: overlayfs1\nState: STOPPED", "stdout_lines": ["Name: overlayfs1", "State: STOPPED"], "warnings": []}
TASK [Create container base2] **************************************************
task path: /root/create-containers.yml:40
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.64-45472536743765 `" && echo ansible-tmp-1468607908.64-45472536743765="` echo $HOME/.ansible/tmp/ansible-tmp-1468607908.64-45472536743765 `" ) && sleep 0'
<localhost> PUT /tmp/tmproGms_ TO /root/.ansible/tmp/ansible-tmp-1468607908.64-45472536743765/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607908.64-45472536743765/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607908.64-45472536743765/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "dir", "clone_name": null, "clone_snapshot": false, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "stopped", "template": "download", "template_options": "--dist ubuntu --release trusty --arch amd64", "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"init_pid": -1, "interfaces": [], "ips": [], "name": "base2", "state": "stopped"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:48
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607918.15-149051987558809 `" && echo ansible-tmp-1468607918.15-149051987558809="` echo $HOME/.ansible/tmp/ansible-tmp-1468607918.15-149051987558809 `" ) && sleep 0'
<localhost> PUT /tmp/tmpJ2Tunq TO /root/.ansible/tmp/ansible-tmp-1468607918.15-149051987558809/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607918.15-149051987558809/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607918.15-149051987558809/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.004407", "end": "2016-07-15 18:38:38.308310", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:38.303903", "stderr": "", "stdout": "Name: base2\nState: STOPPED", "stdout_lines": ["Name: base2", "State: STOPPED"], "warnings": []}
PLAY [Create container via delegation] *****************************************
TASK [Create container overlay2] ***********************************************
task path: /root/create-containers.yml:55
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607918.36-53661322685016 `" && echo ansible-tmp-1468607918.36-53661322685016="` echo $HOME/.ansible/tmp/ansible-tmp-1468607918.36-53661322685016 `" ) && sleep 0'
<localhost> PUT /tmp/tmp8n0vhC TO /root/.ansible/tmp/ansible-tmp-1468607918.36-53661322685016/lxc_container
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607918.36-53661322685016/lxc_container; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607918.36-53661322685016/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "invocation": {"module_args": {"archive": false, "archive_compression": "gzip", "archive_path": null, "backing_store": "overlayfs", "clone_name": "overlayfs2", "clone_snapshot": true, "config": null, "container_command": null, "container_config": null, "container_log": false, "container_log_level": "INFO", "directory": null, "fs_size": "5G", "fs_type": "ext4", "lv_name": "base2", "lxc_path": null, "name": "base2", "state": "started", "template": "ubuntu", "template_options": null, "thinpool": null, "vg_name": "lxc", "zfs_root": null}, "module_name": "lxc_container"}, "lxc_container": {"cloned": true, "init_pid": 17753, "interfaces": ["eth0", "lo"], "ips": [], "name": "base2", "state": "running"}}
TASK [Check state of base2] ****************************************************
task path: /root/create-containers.yml:64
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607920.37-266381410761024 `" && echo ansible-tmp-1468607920.37-266381410761024="` echo $HOME/.ansible/tmp/ansible-tmp-1468607920.37-266381410761024 `" ) && sleep 0'
<localhost> PUT /tmp/tmpIOGg2R TO /root/.ansible/tmp/ansible-tmp-1468607920.37-266381410761024/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607920.37-266381410761024/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607920.37-266381410761024/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "base2"], "delta": "0:00:00.006191", "end": "2016-07-15 18:38:40.520317", "invocation": {"module_args": {"_raw_params": "lxc-info -n base2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:40.514126", "stderr": "", "stdout": "Name: base2\nState: RUNNING\nPID: 17753\nCPU use: 0.36 seconds\nBlkIO use: 112.00 KiB\nMemory use: 2.84 MiB\nKMem use: 0 bytes\nLink: vethLJUX9F\n TX bytes: 90 bytes\n RX bytes: 132 bytes\n Total bytes: 222 bytes", "stdout_lines": ["Name: base2", "State: RUNNING", "PID: 17753", "CPU use: 0.36 seconds", "BlkIO use: 112.00 KiB", "Memory use: 2.84 MiB", "KMem use: 0 bytes", "Link: vethLJUX9F", " TX bytes: 90 bytes", " RX bytes: 132 bytes", " Total bytes: 222 bytes"], "warnings": []}
TASK [Check state of overlayfs2] ***********************************************
task path: /root/create-containers.yml:68
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1468607920.56-235916470469825 `" && echo ansible-tmp-1468607920.56-235916470469825="` echo $HOME/.ansible/tmp/ansible-tmp-1468607920.56-235916470469825 `" ) && sleep 0'
<localhost> PUT /tmp/tmpU1EjRD TO /root/.ansible/tmp/ansible-tmp-1468607920.56-235916470469825/command
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1468607920.56-235916470469825/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1468607920.56-235916470469825/" > /dev/null 2>&1 && sleep 0'
changed: [overlayfs2 -> localhost] => {"changed": true, "cmd": ["lxc-info", "-n", "overlayfs2"], "delta": "0:00:00.003965", "end": "2016-07-15 18:38:40.710090", "invocation": {"module_args": {"_raw_params": "lxc-info -n overlayfs2", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-07-15 18:38:40.706125", "stderr": "", "stdout": "Name: overlayfs2\nState: STOPPED", "stdout_lines": ["Name: overlayfs2", "State: STOPPED"], "warnings": []}
PLAY RECAP *********************************************************************
localhost : ok=9 changed=7 unreachable=0 failed=0
overlayfs2 : ok=3 changed=3 unreachable=0 failed=0
#!/bin/bash
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban \
build-essential python2.7 python-dev \
libssl-dev libffi-dev \
lxc lxc-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
pip install -U lxc-python2 setuptools ansible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment