forked from indigo-dc/ansible-role-consul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
consul.yml
78 lines (71 loc) · 1.98 KB
/
consul.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
- name: Install python-consul
pip: name=python-consul state=present
- name: run consul container with bootstrap
docker_container:
name: consul
image: "{{ consul_image }}"
state: started
detach: True
restart_policy: no
network_mode: bridge
published_ports:
- 8300:8300
- 8301:8301
- 8301:8301/udp
- 8302:8302
- 8302:8302/udp
- 8400:8400
- 8500:8500
- "{{ docker_bridge_ip }}:8600:53"
- "{{ docker_bridge_ip }}:8600:53/udp"
hostname: "{{ ansible_hostname }}"
volumes:
- /mnt:/data
command: -server -advertise "{{consul_advertise}}" -bootstrap-expect "{{consul_bootstrap_expect}}" -ui-dir /ui
when: consul_mode == "server" and consul_bootstrap == "1"
- name: run consul container with join ip
docker_container:
name: consul
image: "{{ consul_image }}"
state: started
detach: True
restart_policy: no
network_mode: bridge
published_ports:
- 8300:8300
- 8301:8301
- 8301:8301/udp
- 8302:8302
- 8302:8302/udp
- 8400:8400
- 8500:8500
- "{{ docker_bridge_ip }}:8600:53"
- "{{ docker_bridge_ip }}:8600:53/udp"
volumes:
- /mnt:/data
hostname: "{{ ansible_hostname }}"
command: -server -advertise "{{consul_advertise}}" -join "{{consul_join_ip}}" -ui-dir /ui
when: consul_mode == "server" and consul_bootstrap == "0"
- name: run consul client container with join ip
docker_container:
name: consul
image: "{{ consul_image }}"
state: started
detach: True
restart_policy: no
network_mode: bridge
published_ports:
- 8300:8300
- 8301:8301
- 8301:8301/udp
- 8302:8302
- 8302:8302/udp
- 8400:8400
- 8500:8500
- "{{ docker_bridge_ip }}:8600:53"
- "{{ docker_bridge_ip }}:8600:53/udp"
volumes:
- /mnt:/data
hostname: "{{ ansible_hostname }}"
command: -advertise "{{consul_advertise}}" -join "{{consul_join_ip}}" -ui-dir /ui
when: consul_mode == "agent"