File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ redis_socket_perm: 755
41
41
# # Replication options
42
42
# Set slaveof just as you would in redis.conf. (e.g. "redis01 6379")
43
43
redis_slaveof : false
44
+ # Ignore manually assigned roles for instances if runtime status can be used instead
45
+ redis_runtime_replication_role : yes
44
46
# Make slaves read-only. "yes" or "no"
45
47
redis_slave_read_only : " yes"
46
48
redis_slave_priority : 100
Original file line number Diff line number Diff line change 17
17
vars :
18
18
redis_facts_cli_port : " {{ redis_port }}"
19
19
when : not redis_sentinel
20
+ register : redis_facts_install_result
20
21
21
22
- name : create redis sentinel facts
22
23
template :
27
28
redis_facts_cli_port : " {{ redis_sentinel_port }}"
28
29
redis_facts_sentinel : yes
29
30
when : redis_sentinel
31
+ register : redis_sentinel_facts_install_result
32
+
33
+ - name : refresh facts due to new fact scripts
34
+ setup :
35
+ when : redis_facts_install_result.changed or redis_sentinel_facts_install_result.changed
Original file line number Diff line number Diff line change 1
1
---
2
2
- include : check_vars.yml
3
3
4
+ - include : local_facts.yml
5
+ when : redis_local_facts|bool
6
+
7
+ - include : runtime_roles.yml
8
+ when : not redis_sentinel and redis_runtime_replication_role
9
+
4
10
- include : install.yml
5
11
6
12
- include : server.yml
13
19
tags :
14
20
- config
15
21
16
- - include : local_facts.yml
17
- when : redis_local_facts|bool
Original file line number Diff line number Diff line change
1
+ - name : set redis to slave automatically
2
+ set_fact :
3
+ redis_slaveof : >-
4
+ {{ ansible_local[redis_service_name].master_host }}
5
+ {{ ansible_local[redis_service_name].master_port }}
6
+ when : >
7
+ ansible_local[redis_service_name].role|default() == 'slave'
8
+
9
+ - name : set redis to master automatically
10
+ set_fact :
11
+ redis_slaveof : ~
12
+ when : >
13
+ ansible_local[redis_service_name].role|default() == 'master'
You can’t perform that action at this time.
0 commit comments