summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws
diff options
context:
space:
mode:
authorMatt Woodson <mwoodson@redhat.com>2018-02-07 17:21:03 -0500
committerMatt Woodson <mwoodson@redhat.com>2018-02-07 17:23:18 -0500
commit94b2f03d5bd9ada69527a1f420067e10246ac4c8 (patch)
tree47e2c253e95b921007aab7a66c3ec4823fea400a /roles/openshift_aws
parent178a71a0952adc5a4137f2c0acae8e5d2cf71c62 (diff)
downloadopenshift-94b2f03d5bd9ada69527a1f420067e10246ac4c8.tar.gz
openshift-94b2f03d5bd9ada69527a1f420067e10246ac4c8.tar.bz2
openshift-94b2f03d5bd9ada69527a1f420067e10246ac4c8.tar.xz
openshift-94b2f03d5bd9ada69527a1f420067e10246ac4c8.zip
aws ami: make it so the tags from the orinal AMI are used with the newly created AMI
Diffstat (limited to 'roles/openshift_aws')
-rw-r--r--roles/openshift_aws/tasks/seal_ami.yml15
1 files changed, 14 insertions, 1 deletions
diff --git a/roles/openshift_aws/tasks/seal_ami.yml b/roles/openshift_aws/tasks/seal_ami.yml
index 74877d5c7..c1cb37a3b 100644
--- a/roles/openshift_aws/tasks/seal_ami.yml
+++ b/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