Skip to content

Commit dc76c6d

Browse files
committed
Merge pull request #225 from CodeNow/add-ec2-inventory
Add ec2 inventory
2 parents f0a41bc + 91d1f18 commit dc76c6d

12 files changed

Lines changed: 1117 additions & 0 deletions

File tree

ansible/beta-hosts/variables

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,37 @@ registry_host=10.20.1.55
6060
swarm_token=d363b783f03a845a2c82b081bfe8443e
6161
user_content_domain=runnablecloud.com
6262
api_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
63+
64+
[ec2:vars]
65+
env=beta
66+
aws_custid=437258487404
67+
vpc_id=vpc-9e84e1fb
68+
security_groups:
69+
- sg_api
70+
- sg_bastion
71+
- sg_dock
72+
- sg_hipache
73+
- sg_mongo
74+
- sg_nat
75+
- sg_navi
76+
- sg_neo4j
77+
- sg_rabbit
78+
- sg_rds
79+
- sg_redis
80+
- sg_services
81+
- sg_userland
82+
- sg_web
83+
sg_api=sg-a6e684c2
84+
sg_bastion=sg-6bc8060f
85+
sg_dock=sg-d6e684b2
86+
sg_hipache=sg-1935727d
87+
sg_mongo=sg-13c30d77
88+
sg_nat=sg-4f07742b
89+
sg_navi=sg-8de684e9
90+
sg_neo4j=sg-78dd131c
91+
sg_rabbit=sg-42a76e26
92+
sg_rds=sg-a27f36c6
93+
sg_redis=sg-81d01ee5
94+
sg_services=sg-950172f1
95+
sg_userland=sg-5a28663e
96+
sg_web=sg-58da143c

ansible/delta-hosts/docks.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
var aws = require('aws-sdk');
6+
var ec2 = new aws.EC2({
7+
accessKeyId: 'AKIAJ3RCYU6FCULAJP2Q',
8+
secretAccessKey: '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',
9+
region: 'us-west-2'
10+
});
11+
12+
var params = {
13+
Filters: [
14+
// Only search for docks in the cluster security group
15+
{
16+
Name: 'instance.group-id',
17+
Values: ['sg-577a0d33']
18+
},
19+
// Only fetch instances that are tagged as docks
20+
{
21+
Name: 'tag:role',
22+
Values: ['dock']
23+
},
24+
// Only fetch running instances
25+
{
26+
Name: 'instance-state-name',
27+
Values: ['running']
28+
}
29+
]
30+
};
31+
32+
ec2.describeInstances(params, function (err, data) {
33+
if (err) {
34+
console.error("An error occurred: ", err);
35+
process.exit(1);
36+
}
37+
38+
// Get a set of instances from the describe response
39+
var instances = [];
40+
data.Reservations.forEach(function (res) {
41+
res.Instances.forEach(function (instance) {
42+
instances.push(instance);
43+
});
44+
});
45+
46+
// Map the instances to their private ip addresses
47+
// NOTE This will work locally because of the wilcard ssh proxy in the config
48+
var hosts = instances.map(function (instance) {
49+
return instance.PrivateIpAddress;
50+
});
51+
52+
var hostVars = {};
53+
instances.forEach(function (instance) {
54+
for (var i = 0; i < instance.Tags.length; i++) {
55+
if (instance.Tags[i].Key === 'org') {
56+
hostVars[instance.PrivateIpAddress] = {
57+
host_tags: instance.Tags[i].Value + ',build,run'
58+
};
59+
}
60+
}
61+
});
62+
63+
// Output the resulting JSON
64+
// NOTE http://docs.ansible.com/ansible/developing_inventory.html
65+
console.log(JSON.stringify(
66+
{
67+
docks: {
68+
hosts: hosts
69+
},
70+
_meta : {
71+
hostvars : hostVars
72+
}
73+
}
74+
));
75+
});

ansible/delta-hosts/hosts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[bastion]
2+
delta-bastion
3+
4+
[hipache]
5+
delta-hipache httpsCheckForBackend80=false prependIncomingPort=true subDomainDepth=4
6+
delta-userland-hipache domain=runnableapp.com httpsCheckForBackend80=true prependIncomingPort=true subDomainDepth=3
7+
8+
[mongodb]
9+
delta-mongo-us-west-2a
10+
delta-mongo-us-west-2b
11+
delta-mongo-us-west-2c
12+
13+
[neo4j]
14+
delta-neo4j
15+
16+
[api_group:children]
17+
worker
18+
api
19+
20+
[api]
21+
delta-api
22+
23+
[consul]
24+
delta-services
25+
delta-api
26+
delta-web
27+
28+
[vault]
29+
delta-services
30+
31+
[worker]
32+
delta-api
33+
34+
[eru]
35+
delta-services
36+
37+
[navi]
38+
delta-navi
39+
40+
[charon]
41+
delta-services
42+
43+
[khronos]
44+
delta-services
45+
46+
[mavis]
47+
delta-services
48+
49+
[optimus]
50+
delta-services
51+
52+
[detention]
53+
delta-services
54+
55+
[palantiri]
56+
delta-services
57+
58+
[rabbitmq]
59+
delta-rabbit
60+
61+
[web]
62+
delta-web
63+
64+
[redis]
65+
delta-redis
66+
67+
[redis-slave]
68+
delta-redis-slave
69+
70+
[shiva]
71+
delta-services
72+
73+
[registry]
74+
delta-registry
75+
76+
[swarm-manager]
77+
delta-services
78+
79+
[docks]
80+
81+
[delta:children]
82+
bastion
83+
hipache
84+
mongodb
85+
api
86+
web
87+
redis
88+
redis-slave
89+
docks
90+
registry
91+
neo4j
92+
navi
93+
charon
94+
khronos
95+
mavis
96+
optimus
97+
rabbitmq
98+
eru
99+
shiva
100+
swarm-manager
101+
102+
[admin]
103+
delta-admin
104+
105+
[local]
106+
localhost,
107+
127.0.0.1
108+
109+
[ec2:children]
110+
admin
111+
local
112+
113+
[targets]
114+
localhost ansible_connection=local bastion_name=delta-bastion

ansible/delta-hosts/variables

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
[api_group:vars]
2+
api_aws_access_key_id=AKIAIDC4WVMTCGV7KRVQ
3+
api_aws_secret_access_key=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
4+
api_github_client_id=b6072dc57062faca7fcb
5+
api_github_client_secret=ba73a9294dc4bfaa7ed02ba187f73918506e4293
6+
api_github_deploy_keys_bucket=runnable.deploykeys.production
7+
api_mixpanel_app_id=c41affa4b08818443365c526cbb51606
8+
api_mongo_auth=api:3f5210b8-8fe3-11e5-8e62-07b6eff19ecb
9+
api_mongo_database=delta
10+
api_mongo_replset_name=delta-rs0
11+
api_neo4j_auth=neo4j:oqGlRV1KTpaqbHDkdlJz
12+
api_new_relic_app_name=delta-api-production
13+
api_rollbar_key=a90d9c262c7c48cfabbd32fd0a1bc61c
14+
api_s3_context_bucket=runnable.context.resources.production
15+
16+
[docks:vars]
17+
docker_config=docks
18+
19+
[eru:vars]
20+
eru_github_id=8abb08f83f6d1c52bd1a
21+
eru_github_secret=74a23ee56486d57b14f292283cb04625f600917c
22+
23+
[khronos:vars]
24+
khronos_mongo_auth=api:oW4c7x9Wiv28oiNBy2Bc
25+
khronos_mongo_database=delta
26+
khronos_mongo_replset_name=delta
27+
28+
[optimus:vars]
29+
optimus_aws_access_id=AKIAJPA2ZYSVVA5V7XXQ
30+
optimus_aws_secret_id=5V70AUxfIyHeLvlYZe0xaYevDAdgTOWOn5G7nHlt
31+
optimus_github_deploy_keys_bucket=runnable.deploykeys.production
32+
33+
[palantiri:vars]
34+
palantiri_rollbar_key=f675e9090d6f483ca4e742af2c7f2f83
35+
36+
[registry:vars]
37+
registry_s3_access_key=AKIAJK5EN7W6E62A3C3Q
38+
registry_s3_bucket=runnableimages.alpha
39+
registry_s3_secret_key=ZFLePZdrHUNhTzuV4Ir/NgwPWOnU41Ur9DbH6UAp
40+
registry_s3_region=us-east-1
41+
42+
[shiva:vars]
43+
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q
44+
aws_secret_access_key=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
45+
shiva_rollbar_key=0526a90faec845d796e1ef5361a00526
46+
47+
[vault:vars]
48+
vault_auth_token=e22c3ebc-11cf-653b-7df0-79d78a499458
49+
vault_token_01=71d7b4754686013c8b9cfb22bafae79c661849dcd67c483c89efba12c0466aa201
50+
vault_token_02=794d6f7a3459c332a1fd2bbcc9230a7f84f1639806039ee8be547828cd7ab03a02
51+
vault_token_03=2e67faeffe4343c038d0f3210bdb83f3d3a5bc468975cf13e977ce9b5922aefe03
52+
vault_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
53+
vault_aws_access_key_id=AKIAJ7R4UIM45KH2WGWQ
54+
vault_aws_secret_key=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
55+
vault_aws_region=us-east-1
56+
57+
[delta:vars]
58+
ansible_ssh_private_key_file=~/.ssh/delta.pem
59+
datadog_host_address=10.8.5.63
60+
datadog_tags=env:delta
61+
domain=runnable-delta.com
62+
mongo_port=27017
63+
new_relic_license_key=338516e0826451c297d44dc60aeaf0a0ca4bfead
64+
node_env=production-delta
65+
pg_host=delta-infrastructure-db.cnksgdqarobf.us-west-2.rds.amazonaws.com
66+
pg_pass=e9G7zYRCxYmxG9HQ8J9x2BDB
67+
rabbit_password=wKK7g7NWKpQXEeSzyWB7mIpxZIL8H2mDSf3Q6czR3Vk
68+
rabbit_username=o2mdLh9N9Ke2GzhoK8xsruYPhIQFN7iEL44dQJoq7OM
69+
registry_host=10.8.4.126
70+
swarm_token=d363b783f03a845a2c82b081bfe8443e
71+
user_content_domain=runnableapp.com
72+
api_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
73+
74+
[ec2:vars]
75+
aws_access_key=AKIAIB3IJCCJZQWQMVSQ
76+
aws_secret_key=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
77+
aws_custid=437258487404
78+
sg_hipache=sg-7fd7fb1b
79+
sg_api=sg-0bf7db6f
80+
sg_neo4j=sg-a9d0fccd
81+
sg_bastion=sg-99d6fafd
82+
sg_dock=sg-6cd7fb08
83+
sg_mongo=sg-00d7fb64
84+
sg_rds=sg-65d2fe01
85+
sg_web=sg-51d2fe35
86+
sg_services=sg-71d2fe15
87+
sg_userland=sg-41d2fe25
88+
sg_nat=sg-3082cc54
89+
sg_rabbit=sg-92d1fdf6
90+
sg_redis=sg-6ed2fe0a
91+
sg_navi=sg-e5d7fb81
92+
env=delta
93+
region=us-west-2
94+
vpc_id=vpc-864c6be3

ansible/gamma-hosts/variables

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,22 @@ registry_host=10.4.4.82
7070
swarm_token=d363b783f03a845a2c82b081bfe8443e
7171
user_content_domain=runnable.ninja
7272
api_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
73+
74+
[ec2:vars]
75+
env=gamma
76+
aws_custid=437258487404
77+
vpc_id=vpc-c53464a0
78+
sg_api=sg-3b0c7b5f
79+
sg_bastion=sg-91eb81f5
80+
sg_dock=sg-577a0d33
81+
sg_hipache=sg-e70c7883
82+
sg_mongo=sg-977a0df3
83+
sg_nat=sg-b595ffd1
84+
sg_navi=sg-45633421
85+
sg_neo4j=sg-ff60179b
86+
sg_rabbit=sg-44b7cb201
87+
sg_rds=sg-081e596c
88+
sg_redis=sg-477b0c23
89+
sg_services=sg-8c6710e8
90+
sg_userland=sg-12ce9876
91+
sg_web=sg-fe8bf49a

ansible/group_vars/ec2_sg.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
app_name: "ec2"
3+
git_branch: "null"

ansible/local/hosts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[local]
2+
localhost
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- name: create AWS SG
2+
ec2_group:
3+
name: "{{ sg_name }}"
4+
description: "{{ env }} security policy for {{ descr }}"
5+
vpc_id: "{{ vpc_id }}"
6+
region: "{{ region }}"

0 commit comments

Comments
 (0)