diff --git a/defaults/main.yml b/defaults/main.yml index 5f0b5279..8a73c5d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,6 +17,11 @@ # cache will be updated. By default this timeout is set to 1 day. lxc_cache_timeout: 86400 +# Environment to use when building LXC caches +# You can set http_proxy environment variables here for example +# if you would like to proxy all image downloads +lxc_cache_environment: {} + # Set the package install state for distribution and pip packages # Options are 'present' and 'latest' lxc_hosts_package_state: "latest" diff --git a/releasenotes/notes/lxc_cache_environment-f14701a7f8f4b8ca.yaml b/releasenotes/notes/lxc_cache_environment-f14701a7f8f4b8ca.yaml new file mode 100644 index 00000000..f331d00b --- /dev/null +++ b/releasenotes/notes/lxc_cache_environment-f14701a7f8f4b8ca.yaml @@ -0,0 +1,5 @@ +--- +features: + - The variable ``lxc_cache_environment`` has been added. This dictionary + can be overridden by deployers to set HTTP proxy environment variables that + will be applied to all lxc container download tasks. diff --git a/tasks/lxc_cache.yml b/tasks/lxc_cache.yml index 04b1e4c9..d11d510a 100644 --- a/tasks/lxc_cache.yml +++ b/tasks/lxc_cache.yml @@ -25,6 +25,7 @@ delay: 10 until: cache_download_primary | success failed_when: false + environment: "{{ lxc_cache_environment }}" tags: - lxc-cache - lxc-cache-download @@ -41,6 +42,7 @@ retries: 3 delay: 10 until: cache_download_secondary | success + environment: "{{ lxc_cache_environment }}" tags: - lxc-cache - lxc-cache-download diff --git a/tasks/lxc_cache_create.yml b/tasks/lxc_cache_create.yml index fd72ff96..a5352185 100644 --- a/tasks/lxc_cache_create.yml +++ b/tasks/lxc_cache_create.yml @@ -45,6 +45,7 @@ retries: 3 delay: 10 until: cache_download|success + environment: "{{ lxc_cache_environment }}" when: - lxc_container_backing_store is defined - lxc_container_backing_store == 'overlayfs' @@ -60,6 +61,7 @@ retries: 3 delay: 10 until: cache_download|success + environment: "{{ lxc_cache_environment }}" when: - lxc_container_backing_store is defined - lxc_container_backing_store == 'lvm'