Skip to content

Commit 6f86f72

Browse files
committed
Merge pull request #197 from CodeNow/cleanup-n-lineinfile
Cleanup n lineinfile
2 parents a227189 + 9be2cac commit 6f86f72

30 files changed

Lines changed: 196 additions & 161 deletions

ansible/beta-hosts/variables

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ shiva_rollbar_key=0526a90faec845d796e1ef5361a00526
4747

4848
[beta:vars]
4949
ansible_ssh_private_key_file=~/.ssh/oregon.pem
50-
datadog_host=10.20.1.59
50+
datadog_host_address=10.20.1.59
5151
datadog_tags=env:beta
5252
domain=runnable-beta.com
5353
new_relic_license_key=338516e0826451c297d44dc60aeaf0a0ca4bfead

ansible/gamma-hosts/variables

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ shiva_rollbar_key=0526a90faec845d796e1ef5361a00526
4747

4848
[gamma:vars]
4949
ansible_ssh_private_key_file=~/.ssh/gamma.pem
50-
datadog_host=10.4.6.251
50+
datadog_host_address=10.4.6.251
5151
datadog_tags=env:gamma
5252
domain=runnable-gamma.com
5353
new_relic_license_key=338516e0826451c297d44dc60aeaf0a0ca4bfead

ansible/group_vars/all.yml

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
registry_env: "prod"
44

55
# for docker stop old container
6-
stop_time: 60
6+
stop_time: 5
77

88
# For docker built containers
99
do_not_push: true
@@ -27,8 +27,6 @@ loggly_token: f673760d-e0b3-4a93-a15e-2862ea074f91
2727
loggly_password: TebejAcutHeH_Ch0tR9ru4anaT6CRu*3
2828
loggly_username: ops
2929

30-
weave_path: "/usr/local/bin/weave"
31-
3230
##
3331
## shared application configs
3432
##
@@ -37,28 +35,71 @@ weave_path: "/usr/local/bin/weave"
3735
api_github_hook_secret: 3V3RYTHINGisAW3S0ME!
3836
api_neo4j_port: 7474
3937
api_neo4j_protocol: http://
38+
api_hostname: api.{{ domain }}
39+
api_port: 80
40+
41+
# astral
42+
pg_database: astral
43+
44+
# charon
45+
charon_port: 53
4046

4147
# datadog
42-
datadog_port: 8125
4348
datadog_api_key: 6488896fe0c811965ef233b96809d70d
49+
datadog_host_address: "{{ ansible_default_ipv4.address }}"
50+
datadog_port: 8125
51+
52+
# detention
53+
detention_host_address: "{{ hostvars[groups['detention'][0]]['ansible_default_ipv4']['address'] }}"
54+
detention_port: 9123
55+
detention_hostname: "detention.{{ domain }}"
4456

4557
# docker
46-
docker_port: 4242
58+
docker_ca_path: /etc/ssl/docker/ca.pem
4759
docker_cert_path: /etc/ssl/docker/cert.pem
4860
docker_key_path: /etc/ssl/docker/key.pem
49-
docker_ca_path: /etc/ssl/docker/ca.pem
61+
docker_port: 4242
5062

5163
# eru
52-
eru_api_host: api.{{ domain }}
64+
eru_port: 57831
65+
eru_hostname: "admin.{{ domain }}"
66+
67+
# mavis
68+
mavis_hostname: "mavis.{{ domain }}"
69+
mavis_port: 3000
70+
71+
# metis
72+
metis_port: 3000
73+
74+
# mongo
75+
mongo_hosts: "{% for host in groups['mongodb'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:27000{% if not loop.last %},{% endif %}{% endfor %}"
76+
77+
# navi
78+
navi_host_address: "{{ hostvars[groups['navi'][0]]['ansible_default_ipv4']['address'] }}"
79+
navi_port: 3567
80+
81+
# neo4j
82+
neo4j_host_address: "{{ hostvars[groups['neo4j'][0]]['ansible_default_ipv4']['address'] }}"
83+
84+
# optimus
85+
optimus_port: 80
86+
optimus_hostname: optimus.{{ domain }}
5387

5488
# rabbit
89+
rabbit_host_address: "{{ hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address'] }}"
5590
rabbit_port: 54321
5691

57-
# astral
58-
pg_database: astral
92+
# redis
93+
redis_host_address: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
94+
redis_port: 6379
95+
96+
# sauron
97+
weave_path: "/usr/local/bin/weave"
5998

6099
# shiva
61100
pg_user: shiva
101+
shiva_port: 3000
62102

63103
# swarm
64104
swarm_master_port: 2375
105+

ansible/group_vars/alpha-api.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,53 @@ rollbar_token: a90d9c262c7c48cfabbd32fd0a1bc61c
66
container_image: registry.runnable.com/runnable/{{ name }}
77
container_tag: "{{ git_branch }}"
88
repo: "git@github.com:CodeNow/{{ name }}.git"
9-
hosted_ports: ["80"]
9+
hosted_ports: ["{{ api_port }}"]
1010
node_version: "0.10.38"
1111
npm_version: "2.8.3"
1212

1313
# for redis
14-
redis_key: "frontend:api.{{ domain }}"
14+
redis_key: "frontend:{{ api_hostname }}"
1515
is_redis_update_required: 'yes'
16-
datadog_host: "{{ ansible_default_ipv4.address }}"
17-
18-
mongo_hosts: "{% for host in groups['mongodb'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:27000{% if not loop.last %},{% endif %}{% endfor %}"
19-
neo4j_host: "{{ hostvars[groups['neo4j'][0]]['ansible_default_ipv4']['address'] }}"
20-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
2116

2217
# for container settings
2318
container_envs: >
24-
-h api
2519
-e AWS_ACCESS_KEY_ID={{ api_aws_access_key_id }}
2620
-e AWS_SECRET_ACCESS_KEY={{ api_aws_secret_access_key }}
27-
-e DATADOG_HOST={{ datadog_host }}
21+
-e DATADOG_HOST={{ datadog_host_address }}
2822
-e DATADOG_PORT={{ datadog_port }}
2923
-e DOMAIN={{ domain }}
30-
-e GITHUB_CALLBACK_URL=https://api.{{ domain }}/auth/github/callback
24+
-e GITHUB_CALLBACK_URL=https://{{ api_hostname }}/auth/github/callback
3125
-e GITHUB_CLIENT_ID={{ api_github_client_id }}
3226
-e GITHUB_CLIENT_SECRET={{ api_github_client_secret }}
3327
-e GITHUB_DEPLOY_KEYS_BUCKET={{ api_github_deploy_keys_bucket }}
34-
-e GITHUB_HOOK_URL=https://api.{{ domain }}/actions/github
28+
-e GITHUB_HOOK_URL=https://{{ api_hostname }}/actions/github
3529
-e HELLO_RUNNABLE_GITHUB_TOKEN={{ api_hello_runnable_github_token }}
36-
-e MAVIS_HOST=http://mavis.{{ domain }}:80
30+
-e MAVIS_HOST=http://{{ mavis_hostname }}:80
3731
-e MIXPANEL_APP_ID={{ api_mixpanel_app_id }}
3832
-e MONGO=mongodb://{{ api_mongo_auth }}@{{ mongo_hosts }}/{{ api_mongo_database }}
3933
-e MONGO_REPLSET_NAME={{ api_mongo_replset_name }}
40-
-e NAVI_HOST=http://navi.{{ domain }}
41-
-e NAVI_HOST=http://{{ hostvars[groups['navi'][0]]['ansible_default_ipv4']['address'] }}:3567
42-
-e NEO4J={{ api_neo4j_protocol }}{{ api_neo4j_auth }}@{{ neo4j_host }}:{{ api_neo4j_port }}
34+
-e NAVI_HOST=http://{{ navi_host_addressname }}:{{ navi_port }}
35+
-e NEO4J={{ api_neo4j_protocol }}{{ api_neo4j_auth }}@{{ neo4j_host_address }}:{{ api_neo4j_port }}
4336
-e NEW_RELIC_APP_NAME={{ api_new_relic_app_name }}
4437
-e NEW_RELIC_LICENSE_KEY={{ new_relic_license_key }}
4538
-e NEW_RELIC_LOG_LEVEL=fatal
4639
-e NEW_RELIC_NO_CONFIG_FILE=true
4740
-e NODE_ENV={{ node_env }}
4841
-e NUM_WORKERS=1
49-
-e OPTIMUS_HOST=http://optimus.{{ domain }}
50-
-e RABBITMQ_HOSTNAME={{ rabbit_host | default(hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address']) }}
42+
-e OPTIMUS_HOST=http://{{ optimus_hostname }}
43+
-e RABBITMQ_HOSTNAME={{ rabbit_host_address }}
5144
-e RABBITMQ_PASSWORD={{ rabbit_password }}
5245
-e RABBITMQ_PORT={{ rabbit_port }}
5346
-e RABBITMQ_USERNAME={{ rabbit_username }}
54-
-e REDIS_IPADDRESS={{ redis_host }}
55-
-e REDIS_PORT=6379
47+
-e REDIS_IPADDRESS={{ redis_host_address }}
48+
-e REDIS_PORT={{ redis_port }}
5649
-e ROLLBAR_KEY={{ api_rollbar_key }}
5750
-e S3_CONTEXT_RESOURCE_BUCKET={{ api_s3_context_bucket }}
5851
-e USER_CONTENT_DOMAIN={{ user_content_domain }}
5952
-e DOCKER_IMAGE_BUILDER_WEAVE_PATH={{ weave_path }}
6053
6154
container_run_opts: >
55+
-h {{ name }}
6256
-d
6357
-P
6458
-v /opt/ssl/docker/{{ name }}:/etc/ssl/docker:ro
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
name: "charon"
2-
app_name: "charon"
2+
app_name: "{{ name }}"
33
app_repo: "git@github.com:CodeNow/{{ name }}.git"
4-
hosted_ports: ["53"]
5-
6-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
7-
redis_port: 6379
4+
hosted_ports: ["{{ charon_port }}"]
85

96
enviroment_vars:
10-
API_HOST: "api.{{ domain }}"
7+
API_HOST: "{{ api_hostname }}"
118
API_TOKEN: "51c61b779f3de616a9639cfc44a22c79fbd8e328"
12-
DATADOG_HOST: "{{ datadog_host }}"
9+
DATADOG_HOST: "{{ datadog_host_address }}"
1310
DATADOG_PORT: "{{ datadog_port }}"
1411
DOMAIN_FILTER: "{{ user_content_domain }}"
1512
PORT: "{{ hosted_ports[0] }}"
16-
REDIS_HOST: "{{ redis_host }}"
13+
REDIS_HOST: "{{ redis_host_address }}"
1714
REDIS_PORT: "{{ redis_port }}"

ansible/group_vars/alpha-detention.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@ name: "detention"
33
container_image: "registry.runnable.com/runnable/{{ name }}"
44
container_tag: "{{ git_branch }}"
55
repo: "git@github.com:CodeNow/{{ name }}.git"
6-
hosted_ports: ["9123"]
6+
hosted_ports: ["{{ detention_port }}"]
77
node_version: "0.12.0"
88
npm_version: "2.1.18"
99

1010
# for redis
11-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
12-
redis_key: "frontend:{{ name }}.{{ domain }}"
11+
redis_key: "frontend:{{ detention_hostname }}"
1312
is_redis_update_required: 'yes'
1413

1514
dockerfile_post_install_commands: [
1615
"npm run grunt"
1716
]
1817

1918
container_envs: >
20-
-h {{ name }}
2119
-e NODE_ENV={{ node_env }}
22-
-e ABSOLUTE_URL=detention.{{ domain }}
20+
-e ABSOLUTE_URL={{ detention_hostname }}
2321
-e PORT={{ hosted_ports[0] }}
2422
25-
container_run_opts: "-d -p {{ hosted_ports[0] }}:{{ hosted_ports[0] }} {{container_envs}}"
23+
container_run_opts: >
24+
-h {{ name }}
25+
-d
26+
-p {{ hosted_ports[0] }}:{{ hosted_ports[0] }}
27+
{{ container_envs }}

ansible/group_vars/alpha-docker-listener.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@ name: docker-listener
44
app_name: "docker-listener"
55
app_repo: "git@github.com:CodeNow/docker-listener.git"
66

7-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
8-
redis_port: 6379
9-
107
enviroment_vars:
11-
DOCKER_CERT_PATH: "/opt/ssl/docker/{{ name }}"
12-
HOST_TAGS: "{{ host_tags | default('default') }}"
138
LOGGLY_TOKEN: "{{ loggly_token }}"
14-
RABBITMQ_HOSTNAME: "{% if rabbit_host is defined %}{{ rabbit_host }}{% else %}{{ hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address'] }}{% endif %}"
9+
RABBITMQ_HOSTNAME: "{{ rabbit_host_address }}"
1510
RABBITMQ_PASSWORD: "{{ rabbit_password }}"
1611
RABBITMQ_PORT: "{{ rabbit_port }}"
1712
RABBITMQ_USERNAME: "{{ rabbit_username }}"
18-
REDIS_IPADDRESS: "{{ redis_host }}"
13+
REDIS_IPADDRESS: "{{ redis_host_address }}"
1914
REDIS_PORT: "{{ redis_port }}"

ansible/group_vars/alpha-eru.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@ name: eru
33
container_image: registry.runnable.com/runnable/{{ name }}
44
container_tag: "{{ git_branch }}"
55
repo: git@github.com:CodeNow/{{ name }}.git
6-
hosted_ports: [57831]
6+
hosted_ports: [{{ eru_port }}]
77
node_version: "0.12.0"
88
npm_version: "2.1.18"
9-
stop_time: 5
109

1110
# for redis
12-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
13-
redis_key: frontend:admin.{{ domain }}
11+
redis_key: frontend:{{ eru_hostname }}
1412
is_redis_update_required: yes
1513

1614
container_envs: >
17-
-h {{ name }}
18-
-e ADMIN_DOMAIN=admin.{{ domain }}
15+
-e ADMIN_DOMAIN={{ eru_hostname }}
1916
-e ADMIN_GITHUB_ID={{ eru_github_id }}
2017
-e ADMIN_GITHUB_SECRET={{ eru_github_secret }}
21-
-e API_HOST={{ eru_api_host }}
18+
-e API_HOST={{ api_hostname }}
2219
-e RUNNABLE_HOST={{ domain }}
2320
-e PORT={{ hosted_ports[0] }}
2421
25-
container_run_opts: -d -p {{ hosted_ports[0] }}:{{ hosted_ports[0] }} {{ container_envs }}
22+
container_run_opts: >
23+
-h {{ name }}
24+
-d
25+
-p {{ hosted_ports[0] }}:{{ hosted_ports[0] }}
26+
{{ container_envs }}

ansible/group_vars/alpha-filibuster.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ name: filibuster
66
app_name: "filibuster"
77
app_repo: "git@github.com:Runnable/Filibuster.git"
88
node_env: "{{ filibuster_env }}"
9+
10+
enviroment_vars: {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# container_kill_start settings
22
name: hipache
3-
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
4-
redis_port: 6379
53

64
container_image: registry.runnable.com/runnable/hipache
75
container_tag: latest
6+
hosted_ports: [ 80, 443 ]
7+
88
container_run_opts: >
99
-d
1010
-p 80:80
1111
-p 443:443
1212
-v /opt/hipache-conf:/host:rw
1313
-v /etc/ssl/certs/{{ domain }}:/etc/ssl/certs/{{ domain }}
1414
-v /etc/ssl/private/{{ domain }}.key:/etc/ssl/private/{{ domain }}.key
15+
1516
container_run_args: /usr/local/bin/hipache --config /host/config.json
16-
hosted_ports: [ 80, 443 ]
1717

1818
# hipache settings
1919
retry_on_error: 0

0 commit comments

Comments
 (0)