use common framework for management infrastructure
[awsible] / roles / autoscalinggroup / tasks / main.yml
index d0c1692acde1e2e75b84586557a252f2dc703259..694f7dce6a860c06c29bd578977603f7d737c0a4 100644 (file)
 - set_fact:
     asg_n:
     - "{{ module }}"
-    - "{{ stack }}"
-    - "{{ country|ternary('c0', '') }}{{ country|default('') }}"
-    - "{{ phase|ternary('d0', '') }}{{ phase|default('') }}"
+    - "{{ stack|default() }}"
+    - "{{ (country|default() != '')|ternary('c0', '') }}{{ country|default('') }}"
+    - "{{ (phase|default() != '')|ternary('d0', '') }}{{ phase|default('') }}"
+
+- set_fact:
+    partial_subnet_ids: "{{ subnet_ids }}"
+  when: subnet_ids is defined
 
 - name: suss out our subnets
+  when: partial_subnet_ids is not defined
   ec2_vpc_subnet_facts:
     region: "{{ vpc_region }}"
     filters:
       propagate_at_launch: yes
     - module: "{{ module }}"
       propagate_at_launch: yes
-    - stack: "{{ stack }}"
+    - stack: "{{ stack|default() }}"
       propagate_at_launch: yes
-    - country: "{{ country }}"
+    - country: "{{ country|default() }}"
       propagate_at_launch: yes
-    - phase: "{{ phase }}"
+    - phase: "{{ phase|default() }}"
       propagate_at_launch: yes