Browse Source

Merge pull request #7060 from mwoodson/master

Automatic merge from submit-queue.

aws ami: make it so the tags from the orinal AMI are used with the newly created AMI
OpenShift Merge Robot 7 years ago
parent
commit
1ab6b4201a
1 changed files with 14 additions and 1 deletions
  1. 14 1
      roles/openshift_aws/tasks/seal_ami.yml

+ 14 - 1
roles/openshift_aws/tasks/seal_ami.yml

@@ -10,6 +10,19 @@
   delay: 3
   until: instancesout.instances|length > 0
 
+- name: fetch the ami used to create the instance
+  ec2_ami_find:
+    region: "{{ openshift_aws_region }}"
+    ami_id: "{{ instancesout.instances[0]['image_id'] }}"
+  register: original_ami_out
+  retries: 20
+  delay: 3
+  until: original_ami_out.results|length > 0
+
+- name: combine the tags of the original ami with newly created ami
+  set_fact:
+    l_openshift_aws_ami_tags: "{{ original_ami_out.results[0]['tags'] | combine(openshift_aws_ami_tags) }}"
+
 - name: bundle ami
   ec2_ami:
     instance_id: "{{ instancesout.instances.0.instance_id }}"
@@ -17,7 +30,7 @@
     state: present
     description: "This was provisioned {{ ansible_date_time.iso8601 }}"
     name: "{{ openshift_aws_ami_name }}"
-    tags: "{{ openshift_aws_ami_tags }}"
+    tags: "{{ l_openshift_aws_ami_tags }}"
     wait: yes
   register: amioutput