diff --git a/defaults/main.yml b/defaults/main.yml index d5873ef5..bfd69ce3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -78,8 +78,13 @@ lxc_image_compression_ratio: 0 # dest: "/etc/issue" lxc_container_cache_files: [] +# The DNS name of the LXD server to source the base container cache from lxc_image_cache_server: images.linuxcontainers.org +# The keyservers to use when validating GPG keys for the downloaded cache +lxc_image_cache_primary_keyserver: hkp://p80.pool.sks-keyservers.net:80 +lxc_image_cache_secondary_keyserver: hkp://keyserver.ubuntu.com:80 + ## Default download template options ## This can be customized to use a local build server and options. ## By default these options will be fulfilled by the distro specific diff --git a/releasenotes/notes/lxc-cache-gpg-156169a867d4653f.yaml b/releasenotes/notes/lxc-cache-gpg-156169a867d4653f.yaml new file mode 100644 index 00000000..b2e0b433 --- /dev/null +++ b/releasenotes/notes/lxc-cache-gpg-156169a867d4653f.yaml @@ -0,0 +1,7 @@ +--- +features: + - The lxc_hosts role can now make use of a primary and secondary gpg + keyserver for gpg validation of the downloaded cache. Setting the + servers to use can be done using the + ``lxc_image_cache_primary_keyserver`` and + ``lxc_image_cache_secondary_keyserver`` variables. diff --git a/tasks/lxc_cache.yml b/tasks/lxc_cache.yml index 8178515e..13aaa3ac 100644 --- a/tasks/lxc_cache.yml +++ b/tasks/lxc_cache.yml @@ -19,11 +19,28 @@ template: "download" state: stopped backing_store: "dir" - template_options: "{{ lxc_cache_download_template_options }}" - register: cache_download + template_options: "{{ lxc_cache_download_template_options }} --keyserver {{ lxc_image_cache_primary_keyserver }}" + register: cache_download_primary retries: 3 delay: 10 - until: cache_download|success + until: cache_download_primary | success + ignore_errors: yes + tags: + - lxc-cache + - lxc-cache-download + +- name: Create base container + lxc_container: + name: "LXC_NAME" + template: "download" + state: stopped + backing_store: "dir" + template_options: "{{ lxc_cache_download_template_options }} --keyserver {{ lxc_image_cache_secondary_keyserver }}" + when: cache_download_primary | failed + register: cache_download_secondary + retries: 3 + delay: 10 + until: cache_download_secondary | success tags: - lxc-cache - lxc-cache-download