Skip to content

Commit

Permalink
Merge pull request #240 from StackStorm/revert-239-patch-3
Browse files Browse the repository at this point in the history
Move proxy settings for Chatops to respective `StackStorm.st2chatops` role
  • Loading branch information
armab authored Apr 15, 2019
2 parents 532abd3 + 138fa33 commit 0f99b77
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion roles/StackStorm.st2/tasks/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions roles/StackStorm.st2chatops/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion stackstorm.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0f99b77

Please sign in to comment.