Skip to content

Commit d626d86

Browse files
author
Ryan Sandor Richards
committed
Finished changes needed for staging.
1 parent 927a7e4 commit d626d86

5 files changed

Lines changed: 98 additions & 9 deletions

File tree

ansible/consul-values.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
- name: print values to screen
2929
run_once: true
3030
when: read_values is defined
31-
debug: msg='{{ item.item.key }}: {{ item.json[0].Value | b64decode }}'
31+
debug: msg="{{ item.item.key }}" -> "{{ item.json[0].Value | b64decode }}"
3232
with_items: "{{ values.results }}"

ansible/group_vars/alpha-consul.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ container_run_opts: >
1414
-h {{ inventory_hostname }}
1515
-v /consul:/data
1616
-v /etc/consul.d:/etc/consul.d:ro
17-
-v /var/log:/var/log
1817
-p {{ ansible_default_ipv4.address }}:8300:8300
1918
-p {{ ansible_default_ipv4.address }}:8301:8301
2019
-p {{ ansible_default_ipv4.address }}:8301:8301/udp

ansible/stage-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-1'
10+
});
11+
12+
var params = {
13+
Filters: [
14+
// Only fetch instances that are tagged as docks
15+
{
16+
Name: 'tag:role',
17+
Values: ['dock']
18+
},
19+
// Only fetch running instances
20+
{
21+
Name: 'instance-state-name',
22+
Values: ['running']
23+
},
24+
// Only fetch docks with the tag "env" equal to "staging"
25+
{
26+
Name: 'tag:env',
27+
Values: ['staging']
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/stage-hosts/hosts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ alpha-stage-data
1010
[rabbitmq]
1111
alpha-stage-data
1212

13-
[docks]
14-
10.0.1.120
15-
10.0.1.109
13+
[consul]
14+
alpha-stage-data
15+
alpha-stage-data-2
16+
17+
[vault]
18+
alpha-stage-data
19+
20+
[swarm-manager]
21+
alpha-stage-data
1622

1723
[stage:children]
18-
hipache
24+
consul
1925
docks
20-
redis
26+
hipache
2127
rabbitmq
22-
docks
28+
redis

ansible/stage-hosts/variables

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
21
[stage:vars]
32
ansible_ssh_private_key_file=~/.ssh/Test-runnable.pem
43
domain=runnable3.net
54
node_env=stage
65
rabbit_username=5WE5wsEQmfw9sLsppJ4CEq9Auea8mPC4kgVt3xYqKxbYHPfP
76
rabbit_password=h7n972sPLs5tWGCWe6QPSCnaxDWjvnpEFEA9c9mBqauH3f22
87
registry_host=10.0.1.254
8+
9+
[vault:vars]
10+
vault_auth_token=cab43411-fe6f-4aec-bf04-6e04adc9225a
11+
vault_token_01=67291c58945becae682f3221d5f3d6027e9ae1db85a9e099d8210b447ca452e701
12+
vault_token_02=8f638c534b4c99793926f463fd65a62714ae7e2e8def7b240258b4030cc098e002
13+
vault_token_03=33f01611d39d179492665955425bec8243cbfb23a942657b08a1e1b29d7fdf3903
14+
vault_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
15+
vault_aws_access_key_id=AKIAJ7R4UIM45KH2WGWQ
16+
vault_aws_secret_key=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
17+
vault_aws_region=us-east-1

0 commit comments

Comments
 (0)