split msca data volume into role
authorJustin Wind <j.wind@partner.samsung.com>
Fri, 21 Apr 2017 22:12:46 +0000 (15:12 -0700)
committerJustin Wind <j.wind@partner.samsung.com>
Fri, 21 Apr 2017 22:12:46 +0000 (15:12 -0700)
management-d0dev.yml
roles/common/tasks/main.yml
roles/common/templates/awsible.sh.j2 [moved from roles/common/files/awsible.sh with 62% similarity]
roles/msca-data-volume/tasks/main.yml [new file with mode: 0644]
roles/msca-data-volume/tasks/volumes.yml [moved from roles/common/tasks/volumes.yml with 100% similarity]
vpcaccess-d0dev.yml

index c73399afae26ee744972a4579fc750037c4dda1c..4f15980593f29e5fbb7887bb3ea5afea4ddc2e63 100644 (file)
@@ -3,5 +3,6 @@
   become: true
   roles:
   - common
+  - msca-data-volume
   - msca
   - management
index 12c6ff1637fda0e0082a4a2d514c512c70923675..bbed536372c73a654f15142cb613ac3b91248faa 100644 (file)
@@ -1,20 +1,4 @@
 ---
-- name: bootstrap /data
-  stat:
-    path: /data
-  register: datadir
-- include: volumes.yml
-  when: not datadir.stat.exists
-
-- name: Create local asset directory
-  when: ASSET_PATH is defined
-  file:
-    state: directory
-    path: "{{ ASSET_PATH }}"
-    mode: "0755"
-    owner: root
-    group: root
-
 - name: Uninstall outdated python packages
   with_items:
   - aws-cli
   command: /usr/sbin/update-motd
 
 - name: profile stuff
-  copy:
+  template:
     dest: /etc/profile.d/awsible.sh
-    src: awsible.sh
+    src: awsible.sh.j2
     mode: "0644"
     owner: root
     group: root
similarity index 62%
rename from roles/common/files/awsible.sh
rename to roles/common/templates/awsible.sh.j2
index e123c8278c478860b3b39d1263fe6847067119a8..754e828e8426105749777801e2e7eb36f3a98dc0 100644 (file)
@@ -1,4 +1,5 @@
 # configure environment with AWS info
+{% raw %}
 export INSTANCE_ID=`curl -sf http://169.254.169.254/latest/meta-data/instance-id`
 if ! export PUBLIC_HOSTNAME=`curl -sf http://169.254.169.254/latest/meta-data/public-hostname`
 then
@@ -13,10 +14,11 @@ export EC2_AZ=`curl -sf http://169.254.169.254/latest/meta-data/placement/availa
 TMP="${#EC2_AZ}"
 export EC2_REGION="${EC2_AZ:0:$TMP-1}"
 unset TMP
-# export CLOUD_ACCOUNT=awsAcctName...
-# export CLOUD_MODULE=mytags['tags']['module']|default('(no module)')
-# export CLOUD_STACK=stack|None
-# export CLOUD_PHASE=mytags['tags']['phase']|default('None')
-
-# export CLOUD_AUTO_SCALE_GROUP=
+{% endraw %}
+# hard-code here for systems without userdata
+export CLOUD_ACCOUNT={{ ACCT_NAME }}
+export CLOUD_MODULE={{ my_tags['tags']['module']|default('(no module)') }}
+export CLOUD_STACK={{ my_tags['tags']['stack']|default() }}
+export CLOUD_PHASE={{ my_tags['tags']['phase']|default('None') }}
+export CLOUD_AUTO_SCALE_GROUP={{ my_tags['tags']['aws:autoscaling:groupName']|default() }}
 # export CLOUD_LAUNCH_CONFIG=module-stack-country-phase-version
diff --git a/roles/msca-data-volume/tasks/main.yml b/roles/msca-data-volume/tasks/main.yml
new file mode 100644 (file)
index 0000000..3250416
--- /dev/null
@@ -0,0 +1,16 @@
+---
+- name: bootstrap /data
+  stat:
+    path: /data
+  register: datadir
+- include: volumes.yml
+  when: not datadir.stat.exists
+
+- name: Create local asset directory
+  when: ASSET_PATH is defined
+  file:
+    state: directory
+    path: "{{ ASSET_PATH }}"
+    mode: "0755"
+    owner: root
+    group: root
index c8cb69456bafa6924d5d51ef826a97606a5fbefb..1f4bb96a34ad4ca646a3edac7dd947aadb70e649 100644 (file)
@@ -3,6 +3,7 @@
   become: true
   roles:
   - common
+  - msca-data-volume
   - msca
   - vpcaccess
   - role: msca-openvpn