DCD-890: Add setting the metadata on the local instance too.

This commit is contained in:
Steve Smith
2020-01-14 11:30:00 +11:00
parent ce52f34742
commit f311337a16

View File

@@ -33,13 +33,25 @@
Key: "atl:deployment:first-run"
Value: "{{ ansible_date_time.iso8601 }}"
- name: Set the first-run tags on the ASG
# Set the tags on the ASG and the local instance. We need to
# ignore errors as it's possible we don't have the permissions,
# and we can't check up-front.
- name: Set the first-run tags on the ASG ("FAIL" is not critical)
command: "aws autoscaling
create-or-update-tags
--region {{ ansible_ec2_placement_region }}
--tags '{{ deployment_firstrun_meta | to_json }}'"
ignore_errors: true
- name: Set the tags on the local instance ("FAIL" is not critical)
ec2_tag:
region: "{{ ansible_ec2_placement_region }}"
resource: "{{ ansible_ec2_instance_id }}"
tags:
"atl:deployment:commit": "{{ git_out.stdout }}"
"atl:deployment:first-run": "{{ ansible_date_time.iso8601 }}"
ignore_errors: true
when:
- ec2_autoscaling_group != ''
- ec2_instance_tags.tags['atl:deployment:first-run'] is not defined
ignore_errors: true