|
|
@ -2,10 +2,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
- name: Install redis server |
|
|
|
- name: Install redis server |
|
|
|
yum: name=redis state=present |
|
|
|
yum: name=redis state=present |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Check if /etc/redis dir exists |
|
|
|
|
|
|
|
stat: path=/etc/redis |
|
|
|
|
|
|
|
register: redis_etc_dir |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
- name: Deploy redis configuration |
|
|
|
- name: Deploy redis configuration |
|
|
|
template: src=redis.conf.j2 dest=/etc/redis.conf |
|
|
|
template: src=redis.conf.j2 dest={{ (redis_etc_dir.stat.isdir) | ternary('/etc/redis/redis.conf','/etc/redis.conf') }} |
|
|
|
notify: restart redis |
|
|
|
notify: restart redis |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
- name: Deploy pre and post backup hooks |
|
|
|
- name: Deploy pre and post backup hooks |
|
|
|
copy: src={{ item.script }} dest=/etc/backup/{{ item.hook }}.d/{{ item.script }} mode=755 |
|
|
|
copy: src={{ item.script }} dest=/etc/backup/{{ item.hook }}.d/{{ item.script }} mode=755 |
|
|
@ -14,9 +21,11 @@ |
|
|
|
hook: pre |
|
|
|
hook: pre |
|
|
|
- script: 'redis_delete_dumps.sh' |
|
|
|
- script: 'redis_delete_dumps.sh' |
|
|
|
hook: post |
|
|
|
hook: post |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
- name: Disable redis-sentinel |
|
|
|
- name: Disable redis-sentinel |
|
|
|
service: name=redis-sentinel state=stopped enabled=no |
|
|
|
service: name=redis-sentinel state=stopped enabled=no |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
- name: Handle redis port |
|
|
|
- name: Handle redis port |
|
|
|
iptables_raw: |
|
|
|
iptables_raw: |
|
|
@ -24,8 +33,10 @@ |
|
|
|
state: "{{ (redis_src_ip | length > 0) | ternary('present','absent') }}" |
|
|
|
state: "{{ (redis_src_ip | length > 0) | ternary('present','absent') }}" |
|
|
|
rules: "-A INPUT -m state --state NEW -p tcp --dport {{ redis_port }} -s {{ redis_src_ip | join(',') }} -j ACCEPT" |
|
|
|
rules: "-A INPUT -m state --state NEW -p tcp --dport {{ redis_port }} -s {{ redis_src_ip | join(',') }} -j ACCEPT" |
|
|
|
when: iptables_manage | default(True) |
|
|
|
when: iptables_manage | default(True) |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
- name: Start and enable the service |
|
|
|
- name: Start and enable the service |
|
|
|
service: name=redis state=started enabled=yes |
|
|
|
service: name=redis state=started enabled=True |
|
|
|
|
|
|
|
tags: redis |
|
|
|
|
|
|
|
|
|
|
|
... |
|
|
|
... |
|
|
|