allow different name for management module
authorJustin Wind <j.wind@partner.samsung.com>
Tue, 18 Apr 2017 20:40:18 +0000 (13:40 -0700)
committerJustin Wind <j.wind@partner.samsung.com>
Tue, 18 Apr 2017 20:40:18 +0000 (13:40 -0700)
roles/aws-management-infrastructure/tasks/main.yml

index 7db2e1adacc38c4a8a08e45187b92033e48f41e0..bc4d6b08a81dcf9086951dd300bc3e853a9f4398 100644 (file)
@@ -12,7 +12,7 @@
     vpc_id: "{{ vpc.vpc.id }}"
     region: "{{ vpc_region }}"
     state: present
-    name: management-elb
+    name: "{{ module }}-elb"
     description: "sg for internal elb for monitoring management"
     purge_rules: false
     rules:
     vpc_id: "{{ vpc.vpc.id }}"
     region: "{{ vpc_region }}"
     state: present
-    name: management
+    name: "{{ module }}"
     description: "sg for management"
     purge_rules: false
     rules:
     - proto: all
-      group_name: management
+      group_name: "{{ module }}"
     - proto: all
-      group_name: management-elb
+      group_name: "{{ module }}-elb"
   register: sg_management
 
 - name: elb management-int-elb
   ec2_elb_lb:
     region: "{{ vpc_region }}"
     state: present
-    name: management-int-elb
+    name: "{{ module }}-int-elb"
     cross_az_load_balancing: yes
     scheme: internal
     subnets: "{{ MANAGEMENT_SUBNET }}"
     security_group_names:
-    - management-elb
+    - "{{ module }}-elb"
     listeners:
     - protocol: tcp
       load_balancer_port: 22
     region: "{{ vpc_region }}"
     name: "{{ MANAGEMENT_KEY_NAME }}"
     key_material: "{{ item }}"
-  with_file: keys/{{ MANAGEMENT_KEY_NAME }}.pub
+  with_file: ../keys/{{ MANAGEMENT_KEY_NAME }}.pub
 
 - name: management iam
   iam:
-    name: management
+    name: "{{ module }}"
     iam_type: role
     state: present
+  register: role_management
 
 # this is only ansible 2.3+
 # - name: management role policies
@@ -84,6 +85,9 @@
 #     - arn:aws:iam::{{ ACCT_ID }}:policy/base-policy
 #     - arn:aws:iam::{{ ACCT_ID }}:policy/management-policy
 
+- debug:
+    msg: "If next step fails, wait a little while and retry."
+
 - include_role:
     name: launchconfig
   vars: