Skip to content

Commit

Permalink
Merge pull request #296 from StackStorm/add_redis
Browse files Browse the repository at this point in the history
Updates to install redis, so can be used as coordination backend
  • Loading branch information
amanda11 authored Apr 30, 2021
2 parents b15ea27 + 14a8f88 commit 5f1a63c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
36 changes: 36 additions & 0 deletions roles/StackStorm.redis/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Install redis
become: yes
package:
name: "{{ redis_package }}"
state: present
register: _task
retries: 5
delay: 3
until: _task is succeeded
tags: redis

- name: Allow redis to be controlled by systemd
become: yes
lineinfile:
dest: /etc/redis/redis.conf
line: supervised systemd
tags: redis
when: ansible_facts.os_family == 'Debian' and ansible_facts.distribution_major_version != "16"

- name: Change bind to be ipv4 only if needed
become: yes
lineinfile:
dest: "{{ '/etc/redis.conf' if ansible_facts.os_family == 'RedHat' else '/etc/redis/redis.conf' }}"
line: "bind 127.0.0.1"
regexp: '^bind '
tags: redis
when: (ansible_facts["all_ipv6_addresses"] | length == 0)

- name: Ensure redis service is enabled and running
become: yes
service:
name: redis
enabled: yes
state: started
tags: redis
2 changes: 2 additions & 0 deletions roles/StackStorm.redis/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Name of redis package to install
redis_package: "{{ 'redis' if ansible_facts.os_family == 'RedHat' else 'redis-server' }}"
6 changes: 6 additions & 0 deletions roles/StackStorm.st2/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ st2_config: {}
# password: random-password123
# messaging:
# url: amqp://st2:[email protected]:5672//
# In StackStorm > 3.4 then redis client libraries are included in the ST2
# package. And therefore redis can be automatically used by setting st2_config
# as follows
#st2_config:
# coordination:
# url: redis://127.0.0.1:6379

# System user from which st2 will execute local/remote shell actions
st2_system_user: stanley
Expand Down
1 change: 1 addition & 0 deletions stackstorm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
roles:
- StackStorm.mongodb
- StackStorm.rabbitmq
- StackStorm.redis
- StackStorm.st2repo
- StackStorm.st2
- StackStorm.nginx
Expand Down

0 comments on commit 5f1a63c

Please sign in to comment.