/
redis.yml
39 lines (31 loc) · 1.13 KB
/
redis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Generating new password...
local_action: shell pwgen 14
register: pwgen_run
become: no
- set_fact: redis_pass="{{ pwgen_run.stdout }}"
- name: Install Redis via yum...
yum: name={{ item }} state=present update_cache=yes
with_items:
- redis
when: ansible_distribution == "CentOS"
- apt_repository:
repo: 'ppa:chris-lea/redis-server'
when: ansible_distribution == "Ubuntu"
- name: Install Redis via apt...
apt: name={{ item }} state=present update_cache=yes
with_items:
- redis-server
when: ansible_distribution == "Ubuntu"
- name: Apply Redis configs...
template: src=redis_centos.conf dest=/etc/redis.conf owner=root group=redis mode=0640
when: ansible_distribution == "CentOS"
- name: Apply Redis configs...
template: src=redis_ubuntu.conf dest=/etc/redis/redis.conf owner=root group=redis mode=0640
when: ansible_distribution == "Ubuntu"
- name: Restart Redis...
service: name=redis state=restarted enabled=yes
when: ansible_distribution == "CentOS"
- name: Restart Redis...
systemd: daemon_reload=yes state=restarted name=redis-server enabled=yes
when: ansible_distribution == "Ubuntu"