Skip to content

Commit 66d2e63

Browse files
author
Bryan Kendall
committed
Merge remote-tracking branch 'origin/master' into link-rebased
2 parents 7883012 + f8a05ad commit 66d2e63

11 files changed

Lines changed: 114 additions & 16 deletions

File tree

ansible/consul-services.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- hosts: rabbitmq
3+
- hosts: redis
4+
5+
- hosts: vault
6+
roles:
7+
- { role: consul-services }

ansible/consul-values.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
---
2-
- hosts: "{{ target }}"
2+
- hosts: consul
3+
vars_files:
4+
- "group_vars/alpha-consul.yml"
35
tasks:
4-
- name: make sure `jq` is present
5-
apt:
6-
name=jq
7-
state=present
6+
- name: make sure httplib2 is installed
7+
sudo: yes
8+
apt: package=python-httplib2 state=present
89

9-
- name: get versions in ansible
10-
script: getVersions {{ ansible_default_ipv4.address }}
11-
register: versions_result
10+
- name: put values into consul
11+
run_once: true
12+
when: write_values is defined
13+
uri:
14+
method=PUT
15+
url=http://{{ ansible_default_ipv4.address }}:8500/v1/kv/{{ item.key }}
16+
body="{{ item.value }}"
17+
with_items: "{{ consul_seed }}"
1218

13-
- name: print versions to stdout
14-
debug:
15-
msg="Versions in Consul\n{{ versions_result.stdout }}"
19+
- name: get values from consul
20+
run_once: true
21+
when: read_values is defined
22+
uri:
23+
method=GET
24+
url=http://{{ ansible_default_ipv4.address }}:8500/v1/kv/{{ item.key }}
25+
with_items: "{{ consul_seed }}"
26+
register: values
27+
28+
- name: print values to screen
29+
run_once: true
30+
when: read_values is defined
31+
debug: msg='{{ item.item.key }}: {{ item.json[0].Value | b64decode }}'
32+
with_items: "{{ values.results }}"

ansible/gamma-hosts/hosts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ api
2020
[api]
2121
gamma-api
2222

23+
[consul]
24+
gamma-services
25+
gamma-api
26+
gamma-web
27+
28+
[vault]
29+
gamma-services
30+
2331
[worker]
2432
gamma-api
2533

ansible/gamma-hosts/variables

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ palantiri_rollbar_key=f675e9090d6f483ca4e742af2c7f2f83
3636

3737
[registry:vars]
3838
registry_s3_access_key=AKIAJZQHOFYKTZP52XCQ
39-
registry_s3_bucket=runnableimages.gamma
39+
registry_s3_bucket=runnableimages.beta
4040
registry_s3_secret_key=iOKNwff7HhUnTmHxt1HrJj1lUkrccZTqWvrKi54C
41-
registry_s3_region=us-west-2
41+
registry_s3_region=us-east-1
4242

4343
[shiva:vars]
4444
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q

ansible/group_vars/all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
# registry settings
33
registry_env: "prod"
4+
registry_port: 80
45

56
# for docker stop old container
67
stop_time: 5

ansible/group_vars/alpha-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ container_envs: >
3131
-e MIXPANEL_APP_ID={{ api_mixpanel_app_id }}
3232
-e MONGO=mongodb://{{ api_mongo_auth }}@{{ mongo_hosts }}/{{ api_mongo_database }}
3333
-e MONGO_REPLSET_NAME={{ api_mongo_replset_name }}
34-
-e NAVI_HOST=http://{{ navi_host_addressname }}:{{ navi_port }}
34+
-e NAVI_HOST=http://{{ navi_host_address }}:{{ navi_port }}
3535
-e NEO4J={{ api_neo4j_protocol }}{{ api_neo4j_auth }}@{{ neo4j_host_address }}:{{ api_neo4j_port }}
3636
-e NEW_RELIC_APP_NAME={{ api_new_relic_app_name }}
3737
-e NEW_RELIC_LICENSE_KEY={{ new_relic_license_key }}

ansible/group_vars/alpha-consul.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,23 @@ container_run_args: >
3232
-data-dir /data
3333
{% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] == ansible_default_ipv4.address %}-ui-dir /ui{% endif %}
3434
{% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] != ansible_default_ipv4.address %}-retry-join {{ hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] }}{% endif %}
35+
36+
# some seed values
37+
# pulled 2015/16/11 - Bryan
38+
consul_seed:
39+
- key: node/env
40+
value: "{{ node_env }}"
41+
- key: api/hostname
42+
value: "{{ api_hostname }}"
43+
- key: image-builder/version
44+
value: d1.6.2-v4.0.0
45+
- key: docker-listener/version
46+
value: v1.0.0
47+
- key: filibuster/version
48+
value: v0.1.6
49+
- key: krain/version
50+
value: v0.1.0
51+
- key: sauron/version
52+
value: v2.0.3
53+
- key: charon/version
54+
value: v2.0.2

ansible/group_vars/alpha-web.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ container_run_opts: >
3434
-h {{ name }}
3535
-d
3636
-P
37-
{{ container_envs }}"
37+
{{ container_envs }}

ansible/group_vars/alpha-workers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ container_envs: >
2828
-e MIXPANEL_APP_ID={{ api_mixpanel_app_id }}
2929
-e MONGO=mongodb://{{ api_mongo_auth }}@{{ mongo_hosts }}/{{ api_mongo_database }}
3030
-e MONGO_REPLSET_NAME={{ api_mongo_replset_name }}
31-
-e NAVI_HOST=http://{{ navi_host_addressname }}:{{ navi_port }}
31+
-e NAVI_HOST=http://{{ navi_host_address }}:{{ navi_port }}
3232
-e NEO4J={{ api_neo4j_protocol }}{{ api_neo4j_auth }}@{{ neo4j_host_address }}:{{ api_neo4j_port }}
3333
-e NEW_RELIC_APP_NAME={{ api_new_relic_app_name }}
3434
-e NEW_RELIC_LICENSE_KEY={{ new_relic_license_key }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
- name: make /etc/consul.d folder
3+
sudo: yes
4+
file:
5+
path=/etc/consul.d
6+
state=directory
7+
8+
- name: remove all current configs
9+
sudo: yes
10+
shell: rm -f /etc/consul.d/*.json
11+
12+
- name: put service files in place
13+
sudo: yes
14+
template:
15+
dest=/etc/consul.d/{{ item.name }}.json
16+
src=service.json
17+
with_items:
18+
- name: 'datadog'
19+
host_address: '{{ datadog_host_address }}'
20+
tags: ['master']
21+
port: '{{ datadog_port }}'
22+
- name: 'rabbitmq'
23+
host_address: '{{ rabbit_host_address }}'
24+
tags: ['master']
25+
port: '{{ rabbit_port }}'
26+
- name: 'redis'
27+
host_address: '{{ redis_host_address }}'
28+
tags: ['master']
29+
port: '{{ redis_port }}'
30+
- name: 'registry'
31+
host_address: '{{ registry_host }}'
32+
tags: ['master']
33+
port: '{{ registry_port }}'
34+
35+
- name: send consul SIGUP to reload services
36+
sudo: yes
37+
shell: pkill --signal SIGHUP consul

0 commit comments

Comments
 (0)