-
Notifications
You must be signed in to change notification settings - Fork 1
/
group_vars.j2
45 lines (45 loc) · 1.2 KB
/
group_vars.j2
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
40
41
42
43
44
45
{% set name_key = 'public_dns_name' -%}
{% if use_private_host is defined -%}
{% set name_key = 'private_dns_name' %}
{% endif %}
mongod_link_to: /mnt/data/mongodb
mongod_datadir_prefix: /var/lib/mongodb
mongod_replication: true
{% for item in ec2_instances %}
{% if loop.index == 1 %}
mongod_repl_master: {{ item.public_dns_name }}
{% endif %}
{% endfor %}
mongod_repset_members:
{% for item in ec2_info_one.instances %}
{% if loop.index == 1 %}
"{{ item.public_dns_name }}": west1
{% endif %}
{% endfor %}
{% for item in ec2_info_two.instances %}
{% if loop.index == 1 %}
"{{ item.public_dns_name }}": west2
{% endif %}
{% endfor %}
mongod_replset_name: {{ repset_name }}
mongod_repl_servers:
{% for item in ec2_instances %}
"{{ item.public_dns_name }}": {{ item[name_key] }}
{% endfor %}
mongod_config_servers:
{% for item in ec2_info_one.instances %}
{% if loop.index < 3 %}
- {{ item[name_key] }}:{{ mongo_cs_port }}
{% endif %}
{% endfor %}
{% for item in ec2_info_two.instances %}
{% if loop.index == 1 %}
- {{ item[name_key] }}:{{ mongo_cs_port }}
{% endif %}
{% endfor %}
mongos_servers:
{% for item in ec2_info_one.instances %}
{% if loop.index == 1 %}
- {{ item[name_key] }}
{% endif %}
{% endfor %}