Skip to content

Commit

Permalink
Support for only installing select services on a node
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaludy committed Dec 23, 2020
1 parent eb1724e commit effe6bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions roles/StackStorm.st2/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,32 @@
- name: reload st2
become: yes
command: st2ctl reload --register-all
when: "'st2actionrunner' in st2_services"

- name: restart st2actionrunner
become: yes
service:
name: st2actionrunner
state: restarted
when: "'st2actionrunner' in st2_services"

- name: restart st2auth
become: yes
service:
name: st2auth
state: restarted
when: "'st2auth' in st2_services"

- name: restart st2api
become: yes
service:
name: st2api
state: restarted
when: "'st2api' in st2_services"

- name: restart st2stream
become: yes
service:
name: st2stream
state: restarted
when: "'st2stream' in st2_services"
11 changes: 9 additions & 2 deletions roles/StackStorm.st2/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@
- name: Install additional Python packages into the st2 virtualenv
become: yes
pip:
name: "{{ item }}"
name: "{{ st2_python_packages }}"
virtualenv: /opt/stackstorm/st2
state: present
register: _task
retries: 5
delay: 3
until: _task is succeeded
with_items: "{{ st2_python_packages }}"
notify:
- restart st2
tags: st2
Expand Down Expand Up @@ -142,6 +141,14 @@
loop: "{{ st2_services }}"
tags: st2

- name: Modify st2ctl to only control the given services
become: yes
lineinfile:
path: /opt/stackstorm/st2/bin/st2ctl
regexp: '^COMPONENTS='
line: "COMPONENTS=\"{{ st2_services | join (' ') }}\""
tags: st2

# Since flush handlers does not support conditionals, we need to have a dedicated playbook
# https://github.com/ansible/ansible/issues/41313#issuecomment-520891625
- name: Flush handlers to prepare StackStorm if there are packs to install
Expand Down
1 change: 1 addition & 0 deletions roles/StackStorm.st2smoketests/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
changed_when: no
tags:
- smoke-tests
when: "{{ 'st2actionrunner' in st2_services }}"

- name: st2 installed
command: st2 --version
Expand Down

0 comments on commit effe6bb

Please sign in to comment.