From 63488139c63e0ad6578da2211ce6188ccd5bb859 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Mon, 23 Jul 2018 08:03:05 +0000 Subject: [PATCH] Allow AIO to automatically use an http proxy This change allows an AIO to automatically configure appropriate settings in global_environment_variables to deploy correctly behind an http proxy. This gives two benefits, new users behind proxies are less likley to fail, and CI behind proxies can test AIO deployments without having to apply any additional configuration. Change-Id: Ib094d61762078a4535ee82b9cb59ebf3ed177be5 --- .../bootstrap-host/files/user_variables_proxy.yml | 11 +++++++++++ .../roles/bootstrap-host/tasks/prepare_aio_config.yml | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/roles/bootstrap-host/files/user_variables_proxy.yml diff --git a/tests/roles/bootstrap-host/files/user_variables_proxy.yml b/tests/roles/bootstrap-host/files/user_variables_proxy.yml new file mode 100644 index 0000000000..30605577a6 --- /dev/null +++ b/tests/roles/bootstrap-host/files/user_variables_proxy.yml @@ -0,0 +1,11 @@ +--- +no_proxy_env: "localhost,127.0.0.1,{{ internal_lb_vip_address }},{{ external_lb_vip_address }},{% for host in groups['all_containers'] %}{{ hostvars[host]['container_address'] }}{% if not loop.last %},{% endif %}{% endfor %}" +http_proxy_env: "{{ lookup('env', 'http_proxy') }}" +https_proxy_env: "{{ lookup('env', 'https_proxy') }}" +global_environment_variables: + HTTP_PROXY: "{{ http_proxy_env }}" + HTTPS_PROXY: "{{ https_proxy_env }}" + http_proxy: "{{ http_proxy_env }}" + https_proxy: "{{ https_proxy_env }}" + NO_PROXY: "{{ no_proxy_env }}" + no_proxy: "{{ no_proxy_env }}" diff --git a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml index c59e258731..6acd03160e 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml @@ -156,6 +156,13 @@ config_overrides: "{{ user_variables_overrides | default({}) }}" config_type: yaml +- name: Set http proxy user variables + copy: + src: "user_variables_proxy.yml" + dest: "/etc/openstack_deploy/user_variables_proxy.yml" + when: + - "lookup('env', 'http_proxy')|length > 0" + - name: Drop the extra user_variables files for this scenario config_template: src: "{{ item.src }}"