Skip to content

Commit 1e5ccfb

Browse files
author
anandkumarpatel
committed
Merge pull request #214 from CodeNow/consul-value
Consul Values for Dock Services
2 parents 21b7039 + b10d175 commit 1e5ccfb

16 files changed

Lines changed: 109 additions & 55 deletions

ansible/charon.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
- hosts: redis
3+
- hosts: consul
34

45
- hosts: docks
56
vars_files:
6-
- "group_vars/alpha-charon.yml"
7+
- group_vars/alpha-charon.yml
78
roles:
8-
- { role: notify, tags: "notify" }
9-
- { role: git_node_service, tags: "deploy" }
9+
- { role: notify, tags: [notify] }
10+
- { role: git_node_service, tags: [deploy] }
11+
- { role: consul_value, tags: [deploy, consul_value] }

ansible/docker-listener.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
22
- hosts: rabbitmq
33
- hosts: redis
4+
- hosts: consul
45

56
- hosts: docks
67
vars_files:
7-
- "group_vars/alpha-docker-listener.yml"
8+
- group_vars/alpha-docker-listener.yml
89
roles:
9-
- { role: notify, tags: "notify" }
10+
- { role: notify, tags: [notify] }
1011
- { role: build_essential }
1112
- { role: docker_client }
12-
- { role: git_node_service, tags: "deploy" }
13+
- { role: git_node_service, tags: [deploy] }
14+
- { role: consul_value, tags: [deploy, consul_value] }

ansible/filibuster.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
2+
- hosts: consul
3+
24
- hosts: docks
35
vars_files:
4-
- "group_vars/alpha-filibuster.yml"
6+
- group_vars/alpha-filibuster.yml
57
roles:
6-
- { role: notify, tags: "notify" }
7-
- { role: git_node_service, tags: "deploy" }
8-
8+
- { role: notify, tags: [notify] }
9+
- { role: git_node_service, tags: [deploy] }
10+
- { role: consul_value, tags: [deploy, consul_value] }

ansible/group_vars/all.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# registry settings
3-
registry_env: "prod"
3+
registry_env: prod
44
registry_port: 80
55

66
# for docker stop old container
@@ -15,8 +15,8 @@ container_run_args: ""
1515
# REPO_BASE for getting dockerfiles
1616
repo_base: "{{ lookup('env','REPO_BASE') }}"
1717

18-
dockerfile: "basic_node/Dockerfile"
19-
base_dockerfile: "node_base"
18+
dockerfile: basic_node/Dockerfile
19+
base_dockerfile: node_base
2020

2121
docker_config: runnable
2222

@@ -57,7 +57,7 @@ datadog_port: 8125
5757
# detention
5858
detention_host_address: "{{ hostvars[groups['detention'][0]]['ansible_default_ipv4']['address'] }}"
5959
detention_port: 9123
60-
detention_hostname: "detention.{{ domain }}"
60+
detention_hostname: detention.{{ domain }}
6161

6262
# docker
6363
docker_ca_path: /etc/ssl/docker/ca.pem
@@ -67,14 +67,14 @@ docker_port: 4242
6767

6868
# eru
6969
eru_port: 57831
70-
eru_hostname: "admin.{{ domain }}"
70+
eru_hostname: admin.{{ domain }}
7171

7272
# fluffy
7373
fluffy_port: 80
7474
fluffy_hostname: "fluffy.{{ domain }}"
7575

7676
# mavis
77-
mavis_hostname: "mavis.{{ domain }}"
77+
mavis_hostname: mavis.{{ domain }}
7878
mavis_port: 3000
7979

8080
# metis
@@ -114,3 +114,7 @@ swarm_host_address: "{{ hostvars[groups['swarm-manager'][0]]['ansible_default_ip
114114
navi_mongo_database: navi
115115
navi_mongo_host_address: "{{ hostvars[groups['mongo-navi'][0]]['ansible_default_ipv4']['address'] }}"
116116
navi_mongo_port: 27017
117+
118+
# consul
119+
consul_hostname: "{{ hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] }}"
120+
consul_port: 8500
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
name: "charon"
1+
name: charon
22
app_name: "{{ name }}"
3-
app_repo: "git@github.com:CodeNow/{{ name }}.git"
3+
app_repo: git@github.com:CodeNow/{{ name }}.git
44
hosted_ports: ["{{ charon_port }}"]
55

66
enviroment_vars:
77
API_HOST: "{{ api_hostname }}"
8-
API_TOKEN: "51c61b779f3de616a9639cfc44a22c79fbd8e328"
8+
API_TOKEN: 51c61b779f3de616a9639cfc44a22c79fbd8e328
99
DATADOG_HOST: "{{ datadog_host_address }}"
1010
DATADOG_PORT: "{{ datadog_port }}"
1111
DOMAIN_FILTER: "{{ user_content_domain }}"
1212
PORT: "{{ hosted_ports[0] }}"
1313
REDIS_HOST: "{{ redis_host_address }}"
1414
REDIS_PORT: "{{ redis_port }}"
15+
16+
# consul values
17+
consul_values:
18+
- key: "{{ name }}/version"
19+
value: "{{ git_branch }}"

ansible/group_vars/alpha-consul.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ container_run_args: >
3131
-config-dir /etc/consul.d
3232
-client 0.0.0.0
3333
-recursor 8.8.8.8
34-
{% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] == ansible_default_ipv4.address %}-bootstrap-expect {{ groups['consul'] | length }}{% endif %}
34+
{% if consul_hostname == ansible_default_ipv4.address %}-bootstrap-expect {{ groups['consul'] | length }}{% endif %}
3535
-data-dir /data
36-
{% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] == ansible_default_ipv4.address %}-ui-dir /ui{% endif %}
37-
{% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] != ansible_default_ipv4.address %}-retry-join {{ hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] }}{% endif %}
36+
{% if consul_hostname == ansible_default_ipv4.address %}-ui-dir /ui{% endif %}
37+
{% if consul_hostname != ansible_default_ipv4.address %}-retry-join {{ consul_hostname }}{% endif %}
3838
> /var/log/consul.log 2>&1
3939
4040
# some seed values
@@ -44,15 +44,3 @@ consul_seed:
4444
value: "{{ node_env }}"
4545
- key: api/hostname
4646
value: "{{ api_hostname }}"
47-
- key: image-builder/version
48-
value: d1.6.2-v4.0.0
49-
- key: docker-listener/version
50-
value: v1.0.0
51-
- key: filibuster/version
52-
value: v0.1.6
53-
- key: krain/version
54-
value: v0.1.0
55-
- key: sauron/version
56-
value: v2.0.3
57-
- key: charon/version
58-
value: v2.0.2
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: docker-listener
22

33
# upstart template variables
4-
app_name: "docker-listener"
5-
app_repo: "git@github.com:CodeNow/docker-listener.git"
4+
app_name: docker-listener
5+
app_repo: git@github.com:CodeNow/docker-listener.git
66

77
enviroment_vars:
88
LOGGLY_TOKEN: "{{ loggly_token }}"
@@ -12,3 +12,8 @@ enviroment_vars:
1212
RABBITMQ_USERNAME: "{{ rabbit_username }}"
1313
REDIS_IPADDRESS: "{{ redis_host_address }}"
1414
REDIS_PORT: "{{ redis_port }}"
15+
16+
# consul values
17+
consul_values:
18+
- key: "{{ name }}/version"
19+
value: "{{ git_branch }}"

ansible/group_vars/alpha-filibuster.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ filibuster_env: default
33
name: filibuster
44

55
# upstart template variables
6-
app_name: "filibuster"
7-
app_repo: "git@github.com:Runnable/Filibuster.git"
6+
app_name: filibuster
7+
app_repo: git@github.com:Runnable/Filibuster.git
88
node_env: "{{ filibuster_env }}"
99

10-
enviroment_vars: {}
10+
enviroment_vars: {}
11+
12+
# consul values
13+
consul_values:
14+
- key: "{{ name }}/version"
15+
value: "{{ git_branch }}"
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
app_name: "image-builder"
1+
app_name: image-builder
22
name: "{{ app_name }}"
33
# namespace (can include "registry.runnable.com:")
44
image_builder_docker_namespace: runnable/image-builder
55

66
# we need to push this
77
do_not_push: false
8+
9+
# consul values
10+
consul_values:
11+
- key: "{{ name }}/version"
12+
value: "{{ git_branch }}"

ansible/group_vars/alpha-krain.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ name: krain
44
krain_env: default
55

66
# upstart template variables
7-
app_name: "krain"
8-
app_repo: "git@github.com:CodeNow/krain.git"
7+
app_name: krain
8+
app_repo: git@github.com:CodeNow/krain.git
99
node_env: "{{ krain_env }}"
1010

11-
enviroment_vars: {}
11+
enviroment_vars: {}
12+
13+
# consul values
14+
consul_values:
15+
- key: "{{ name }}/version"
16+
value: "{{ git_branch }}"

0 commit comments

Comments
 (0)