Allow variable control over lxc_template task enviroment

This allows a deployer to configure a proxy server that is
only applied to these LXC cache tasks. This is sometimes preferable
to configuring such a proxy in the host's enviroment variables. It
may also be preferable to running a private LXC image server and specifying
it using the `lxc_image_cache_server` variable.

Change-Id: I884478c8bf699af2facbc106f745470eaf697ffd
This commit is contained in:
Travis Truman 2016-12-06 17:18:00 -05:00
parent 63f1da1dc6
commit 1eb088d49a
4 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,11 @@
# cache will be updated. By default this timeout is set to 1 day. # cache will be updated. By default this timeout is set to 1 day.
lxc_cache_timeout: 86400 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 # Set the package install state for distribution and pip packages
# Options are 'present' and 'latest' # Options are 'present' and 'latest'
lxc_hosts_package_state: "latest" lxc_hosts_package_state: "latest"

View File

@ -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.

View File

@ -25,6 +25,7 @@
delay: 10 delay: 10
until: cache_download_primary | success until: cache_download_primary | success
failed_when: false failed_when: false
environment: "{{ lxc_cache_environment }}"
tags: tags:
- lxc-cache - lxc-cache
- lxc-cache-download - lxc-cache-download
@ -41,6 +42,7 @@
retries: 3 retries: 3
delay: 10 delay: 10
until: cache_download_secondary | success until: cache_download_secondary | success
environment: "{{ lxc_cache_environment }}"
tags: tags:
- lxc-cache - lxc-cache
- lxc-cache-download - lxc-cache-download

View File

@ -45,6 +45,7 @@
retries: 3 retries: 3
delay: 10 delay: 10
until: cache_download|success until: cache_download|success
environment: "{{ lxc_cache_environment }}"
when: when:
- lxc_container_backing_store is defined - lxc_container_backing_store is defined
- lxc_container_backing_store == 'overlayfs' - lxc_container_backing_store == 'overlayfs'
@ -60,6 +61,7 @@
retries: 3 retries: 3
delay: 10 delay: 10
until: cache_download|success until: cache_download|success
environment: "{{ lxc_cache_environment }}"
when: when:
- lxc_container_backing_store is defined - lxc_container_backing_store is defined
- lxc_container_backing_store == 'lvm' - lxc_container_backing_store == 'lvm'