Skip to content

Commit effe6bb

Browse files
committed
Support for only installing select services on a node
1 parent eb1724e commit effe6bb

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

roles/StackStorm.st2/handlers/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,32 @@
88
- name: reload st2
99
become: yes
1010
command: st2ctl reload --register-all
11+
when: "'st2actionrunner' in st2_services"
1112

1213
- name: restart st2actionrunner
1314
become: yes
1415
service:
1516
name: st2actionrunner
1617
state: restarted
18+
when: "'st2actionrunner' in st2_services"
1719

1820
- name: restart st2auth
1921
become: yes
2022
service:
2123
name: st2auth
2224
state: restarted
25+
when: "'st2auth' in st2_services"
2326

2427
- name: restart st2api
2528
become: yes
2629
service:
2730
name: st2api
2831
state: restarted
32+
when: "'st2api' in st2_services"
2933

3034
- name: restart st2stream
3135
become: yes
3236
service:
3337
name: st2stream
3438
state: restarted
39+
when: "'st2stream' in st2_services"

roles/StackStorm.st2/tasks/main.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,13 @@
8787
- name: Install additional Python packages into the st2 virtualenv
8888
become: yes
8989
pip:
90-
name: "{{ item }}"
90+
name: "{{ st2_python_packages }}"
9191
virtualenv: /opt/stackstorm/st2
9292
state: present
9393
register: _task
9494
retries: 5
9595
delay: 3
9696
until: _task is succeeded
97-
with_items: "{{ st2_python_packages }}"
9897
notify:
9998
- restart st2
10099
tags: st2
@@ -142,6 +141,14 @@
142141
loop: "{{ st2_services }}"
143142
tags: st2
144143

144+
- name: Modify st2ctl to only control the given services
145+
become: yes
146+
lineinfile:
147+
path: /opt/stackstorm/st2/bin/st2ctl
148+
regexp: '^COMPONENTS='
149+
line: "COMPONENTS=\"{{ st2_services | join (' ') }}\""
150+
tags: st2
151+
145152
# Since flush handlers does not support conditionals, we need to have a dedicated playbook
146153
# https://github.com/ansible/ansible/issues/41313#issuecomment-520891625
147154
- name: Flush handlers to prepare StackStorm if there are packs to install

roles/StackStorm.st2smoketests/tasks/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
changed_when: no
1212
tags:
1313
- smoke-tests
14+
when: "{{ 'st2actionrunner' in st2_services }}"
1415

1516
- name: st2 installed
1617
command: st2 --version

0 commit comments

Comments
 (0)