mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 16:33:08 -06:00
Merged in DCD-890-make-tags-consistent-with-qs-template (pull request #77)
DCD-890: Rename tag keys to make it consistent with tags exposed by quickstart templates * DCD-890: Rename tag keys to make it consistent with tags exposed by quickstart templates * DCD-869: Store restore tag in an array of one item to force type to a string * DCD-869: Fix yaml lint Approved-by: Steve Smith <ssmith@atlassian.com>
This commit is contained in:
@@ -14,6 +14,11 @@
|
||||
set_fact:
|
||||
ec2_autoscaling_group: "{{ ec2_tags.tags['aws:autoscaling:groupName'] | default('') }}"
|
||||
|
||||
# Because Ansible - https://github.com/ansible/ansible/issues/11905#issuecomment-130496173
|
||||
- name: Set fact to store boolean 'atl_restore_required' value as as array of one string
|
||||
set_fact:
|
||||
atl_restore_required_tag_value: ["{{ atl_restore_required | lower }}"]
|
||||
|
||||
- block:
|
||||
# No existing timestamp, so this is a first run. Persist some metadata into the ASG.
|
||||
- name: Fetch the git revision for this repo
|
||||
@@ -27,20 +32,20 @@
|
||||
- ResourceType: "auto-scaling-group"
|
||||
ResourceId: "{{ ec2_autoscaling_group }}"
|
||||
PropagateAtLaunch: true
|
||||
Key: "atl:deployment:commit"
|
||||
Key: "atl:deployment:commit-id"
|
||||
Value: "{{ git_out.stdout }}"
|
||||
|
||||
- ResourceType: "auto-scaling-group"
|
||||
ResourceId: "{{ ec2_autoscaling_group }}"
|
||||
PropagateAtLaunch: true
|
||||
Key: "atl:deployment:first-run"
|
||||
Key: "atl:deployment:first-run-timestamp"
|
||||
Value: "{{ ansible_date_time.iso8601 }}"
|
||||
|
||||
- ResourceType: "auto-scaling-group"
|
||||
ResourceId: "{{ ec2_autoscaling_group }}"
|
||||
PropagateAtLaunch: true
|
||||
Key: "atl:deployment:restored"
|
||||
Value: "{{ atl_restore_required }}"
|
||||
Key: "atl:deployment:is-stack-restored"
|
||||
Value: "{{ atl_restore_required_tag_value.0 }}"
|
||||
|
||||
|
||||
# Set the tags on the ASG and the local instance. We need to
|
||||
@@ -58,11 +63,11 @@
|
||||
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 }}"
|
||||
"atl:deployment:restored": "{{ atl_restore_required }}"
|
||||
"atl:deployment:commit-id": "{{ git_out.stdout }}"
|
||||
"atl:deployment:first-run-timestamp": "{{ ansible_date_time.iso8601 }}"
|
||||
"atl:deployment:is-stack-restored": "{{ atl_restore_required_tag_value.0 }}"
|
||||
ignore_errors: true
|
||||
|
||||
when:
|
||||
- ec2_autoscaling_group != ''
|
||||
- ec2_instance_tags.tags['atl:deployment:first-run'] is not defined
|
||||
- ec2_instance_tags.tags['atl:deployment:first-run-timestamp'] is not defined
|
||||
|
||||
Reference in New Issue
Block a user