From 00d1daeccbb121e0cc9e56a1efa6a6f901b83a25 Mon Sep 17 00:00:00 2001 From: Eric Morino Date: Tue, 1 Oct 2019 15:37:04 +0200 Subject: [PATCH] Modification lxc pour buster, car lxc 3 --- lxc-php/tasks/php.yml | 4 ++-- lxc/defaults/main.yml | 2 +- lxc/tasks/create-container.yml | 9 +++++---- lxc/templates/default.conf | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lxc-php/tasks/php.yml b/lxc-php/tasks/php.yml index 909b204f..d2b627f6 100644 --- a/lxc-php/tasks/php.yml +++ b/lxc-php/tasks/php.yml @@ -96,9 +96,9 @@ when: name == 'php73' - name: Configure mailname - lineinfile: + template: + src: mailname.j2 dest: "/var/lib/lxc/{{name}}/rootfs/etc/mailname" - line: "{{ansible_fqdn}}" notify: "Restart opensmtpd" when: name == 'php73' diff --git a/lxc/defaults/main.yml b/lxc/defaults/main.yml index 0e229953..485f2784 100644 --- a/lxc/defaults/main.yml +++ b/lxc/defaults/main.yml @@ -3,7 +3,7 @@ lxc_unprivilegied_containers: false # Network type to use. See lxc.container.conf(5). -lxc_network_type: "none" +lxc_net_0_type: "none" # Partition to bind mount into containers. lxc_mount_part: "/home" diff --git a/lxc/tasks/create-container.yml b/lxc/tasks/create-container.yml index 0b610f82..c022b0fb 100644 --- a/lxc/tasks/create-container.yml +++ b/lxc/tasks/create-container.yml @@ -5,7 +5,7 @@ register: container_exists - name: Create container - command: "lxc-create --name {{name}} --template debian --bdev dir --logfile /var/log/lxc/lxc-{{name}}.log --logpriority INFO -- --arch amd64 --release {{release}}" + command: "lxc-create --name {{name}} --template download --bdev dir --logfile /var/log/lxc/lxc-{{name}}.log --logpriority INFO -- --dist debian --release {{release}} --arch amd64" when: container_exists.stdout_lines == [] #- name: Create container @@ -13,22 +13,23 @@ # name: "{{name}}" # container_log: true # template: download -# state: stopped +# state: started # template_options: "--release {{release}}" +# when: container_exists.stdout_lines == [] - name: Disable network configuration inside container replace: name: "/var/lib/lxc/{{name}}/rootfs/etc/default/networking" regexp: "^#CONFIGURE_INTERFACES=yes" replace: CONFIGURE_INTERFACES=no - when: lxc_network_type == "none" + when: lxc_net_0_type == "none" - name: Disable interface shut down on halt inside container lineinfile: name: "/var/lib/lxc/{{name}}/rootfs/etc/default/halt" line: "NETDOWN=no" when: - - lxc_network_type == "none" + - lxc_net_0_type == "none" - release != "stretch" - release != "buster" diff --git a/lxc/templates/default.conf b/lxc/templates/default.conf index 94e7c1d6..f388422a 100644 --- a/lxc/templates/default.conf +++ b/lxc/templates/default.conf @@ -7,7 +7,7 @@ lxc.id_map = g 0 100000 10000 {% endif %} # Set the default network virtualization method. -lxc.network.type = {{lxc_network_type}} +lxc.net.0.type = {{lxc_net_0_type}} {% if lxc_mount_part %} # Mount {{lxc_mount_part}} into containers. @@ -16,7 +16,7 @@ lxc.mount.entry = {{lxc_mount_part}} {{lxc_mount_part |replace('/', '')}} none b {% endif %} # Only one tty is enough. # This require that you disabled others tty ([2-6]) in systemd. -lxc.tty = 1 +lxc.tty.max = 1 # Run 64bits containers lxc.arch = x86_64