From 0aba2aa21f9c172e40c4e5edf0e881d2eb77b5be Mon Sep 17 00:00:00 2001 From: Eugen C Date: Mon, 15 Apr 2019 18:23:06 +0300 Subject: [PATCH 1/3] Revert "st2chatops also may need proxies" --- roles/StackStorm.st2/tasks/proxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/StackStorm.st2/tasks/proxy.yml b/roles/StackStorm.st2/tasks/proxy.yml index 9d85404d..45f2b54c 100644 --- a/roles/StackStorm.st2/tasks/proxy.yml +++ b/roles/StackStorm.st2/tasks/proxy.yml @@ -10,7 +10,7 @@ # NB: Empty ENV var cast to 'None' string in Ansible state: "{{ 'present' if ansible_facts.env.get(item.1, 'None') != 'None' else 'absent' }}" vars: - _services: [st2api, st2actionrunner, st2chatops] + _services: [st2api, st2actionrunner] _proxy_vars: [http_proxy, https_proxy, no_proxy] loop: '{{ _services|product(_proxy_vars)|list }}' notify: From 9e9f6e46adca06f155a15bb492f4ea9580ce755d Mon Sep 17 00:00:00 2001 From: armab Date: Mon, 15 Apr 2019 18:32:49 +0300 Subject: [PATCH 2/3] Configure st2chatops to work via proxy --- roles/StackStorm.st2chatops/tasks/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/roles/StackStorm.st2chatops/tasks/main.yml b/roles/StackStorm.st2chatops/tasks/main.yml index 5692756c..d6ba3e89 100644 --- a/roles/StackStorm.st2chatops/tasks/main.yml +++ b/roles/StackStorm.st2chatops/tasks/main.yml @@ -181,6 +181,23 @@ notify: restart st2chatops tags: st2chatops +# Update proxy env vars in st2chatops service config file +- name: Configure st2chatops to work via proxy + become: yes + lineinfile: + dest: /etc/{{ 'default' if ansible_facts.pkg_mgr == 'apt' else 'sysconfig' }}/{{ item.0 }} + create: yes + regexp: '^{{ item.1 }}=' + line: "{{ item.1 }}={{ ansible_facts.env.get(item.1) }}" + # NB: Empty ENV var cast to 'None' string in Ansible + state: "{{ 'present' if ansible_facts.env.get(item.1, 'None') != 'None' else 'absent' }}" + vars: + _services: [st2chatops] + _proxy_vars: [http_proxy, https_proxy, no_proxy] + loop: '{{ _services|product(_proxy_vars)|list }}' + notify: + - restart st2chatops + - name: Ensure st2chatops service is enabled and running become: yes service: From 138fa337d4a37c0edd723bec370de2cbea733b0b Mon Sep 17 00:00:00 2001 From: armab Date: Mon, 15 Apr 2019 22:20:46 +0300 Subject: [PATCH 3/3] Fix ' [WARNING]: could not parse environment value, skipping: [u'{{ st2_proxy_env | default(None) }}']' --- stackstorm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stackstorm.yml b/stackstorm.yml index 49ae3b4c..c8036f25 100644 --- a/stackstorm.yml +++ b/stackstorm.yml @@ -1,7 +1,7 @@ --- - name: Install st2 hosts: all - environment: "{{ st2_proxy_env | default(None) }}" + environment: "{{ st2_proxy_env | default({}) }}" roles: - StackStorm.mongodb - StackStorm.rabbitmq