@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+import json
+import urllib2
+import sys
+URL = 'http://169.254.169.254/latest/user-data'
+try:
+ data = json.load(urllib2.urlopen(URL))
+except:
+ print >> sys.stderr, 'Was not able to connect to the Amazon API'
+ sys.exit(2)
+if data['consul_master'] == '127.0.0.1'
+ print 'i am the master'
@@ -0,0 +1,9 @@
+---
+- name: Install the Consul Cloud Configure Script
+ copy:
+ src: consul_cloud_setup
+ dest: /usr/local/bin/consul_cloud_setup
+ owner: root
+ group: root
+ mode: "0755"
@@ -1,3 +1,4 @@
---
# tasks file for shokunin.ansible-cloud-consul
- include: binary_install.yml
+- include: cloud_configure.yml