diff --git a/handlers/main.yml b/handlers/main.yml index 018bb275..2da9e103 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -80,11 +80,6 @@ path: "/tmp/rootfs.tar.xz" state: "absent" -- name: Remove metadata archive - file: - path: "/tmp/meta.tar.xz" - state: "absent" - - name: Restart dnsmasq service: name: "lxc-dnsmasq" diff --git a/tasks/lxc_cache_create.yml b/tasks/lxc_cache_create.yml index 1e6c76ba..e5842743 100644 --- a/tasks/lxc_cache_create.yml +++ b/tasks/lxc_cache_create.yml @@ -37,29 +37,19 @@ tags: - skip_ansible_lint -- name: Fetch LXC image-metadata - shell: > - aria2c - --max-connection-per-server=4 - --continue - --allow-overwrite=true - --dir=/tmp - --out=meta.tar.xz - --check-certificate={{ (lxc_hosts_validate_certs | bool) | lower }} - {% for server in lxc_image_cache_server_mirrors %}{{ server }}/{{ lxc_images[0].split(';')[-1] }}/meta.tar.xz {% endfor %} - args: - warn: no - tags: - - skip_ansible_lint - - always - -- name: Place container metadata - unarchive: - src: "/tmp/meta.tar.xz" - dest: "{{ cache_path_fact }}" - remote_src: True - notify: - - Remove metadata archive +- name: Drop container meta-data + template: + src: "meta-data/{{ item }}" + dest: "{{ cache_path_fact }}/{{ item }}" + owner: "root" + group: "root" + mode: "0644" + with_items: + - config + - config.5 + - create-message + - expiry + - templates - name: Set cache expiry shell: "date -d @{{ (cache_time | int) + 31536000 }}" diff --git a/templates/meta-data/config b/templates/meta-data/config new file mode 100644 index 00000000..aa8f1f4d --- /dev/null +++ b/templates/meta-data/config @@ -0,0 +1,2 @@ +lxc.include = LXC_TEMPLATE_CONFIG/{{ lxc_cache_map.distro }}.common.conf +lxc.arch = x86_64 diff --git a/templates/meta-data/config.5 b/templates/meta-data/config.5 new file mode 100644 index 00000000..7573ff31 --- /dev/null +++ b/templates/meta-data/config.5 @@ -0,0 +1,2 @@ +lxc.include = LXC_TEMPLATE_CONFIG/common.conf +lxc.arch = x86_64 diff --git a/templates/meta-data/create-message b/templates/meta-data/create-message new file mode 100644 index 00000000..85d21eec --- /dev/null +++ b/templates/meta-data/create-message @@ -0,0 +1,4 @@ +Created a {{ lxc_cache_map.distro }} container (release={{ lxc_cache_map.release }}, arch={{ lxc_cache_map.arch }}, variant={{ lxc_cache_default_variant }}) + +Use lxc-attach or chroot directly into the rootfs to set a root password +or create user accounts. diff --git a/templates/meta-data/expiry b/templates/meta-data/expiry new file mode 100644 index 00000000..e69de29b diff --git a/templates/meta-data/templates b/templates/meta-data/templates new file mode 100644 index 00000000..15e81481 --- /dev/null +++ b/templates/meta-data/templates @@ -0,0 +1,2 @@ +/etc/hostname +/etc/hosts