From 9bed8376bac333e387b91a4a0cac35f41de693ce Mon Sep 17 00:00:00 2001 From: James Laska Date: Fri, 20 Nov 2015 14:05:22 -0500 Subject: [PATCH] Update AMI copy playbook --- tools/playbooks/inventory | 2 - tools/playbooks/publish_ami.yml | 65 --------------------------------- 2 files changed, 67 deletions(-) delete mode 100644 tools/playbooks/inventory delete mode 100644 tools/playbooks/publish_ami.yml diff --git a/tools/playbooks/inventory b/tools/playbooks/inventory deleted file mode 100644 index f2390f7b27..0000000000 --- a/tools/playbooks/inventory +++ /dev/null @@ -1,2 +0,0 @@ -[local] -127.0.0.1 ansible_connection=local ansible_python_interpreter='/usr/bin/env python' diff --git a/tools/playbooks/publish_ami.yml b/tools/playbooks/publish_ami.yml deleted file mode 100644 index c7af4ded8b..0000000000 --- a/tools/playbooks/publish_ami.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- hosts: local - vars: - src_region: 'us-east-1' - dst_regions: - - us-east-1 - - us-west-1 - - us-west-2 - - eu-central-1 - - eu-west-1 - - ap-northeast-1 - - ap-southeast-1 - - ap-southeast-2 - - sa-east-1 - - tasks: - - fail: - msg: 'No source AMI id defined, please provide a value for variable src_ami_id.' - when: src_ami_id is undefined - - - name: Gather AMI information - ec2_ami_find: - ami_id: '{{ src_ami_id }}' - region: '{{ src_region }}' - no_result_action: fail - register: ami_info - - - name: Assert that the AMI is not already public - assert: - that: 'not {{ item.is_public }}' - with_items: ami_info.results - - - name: Copy AMI to desired regions - command: 'ec2-copy-image --source-region {{ src_region }} --source-ami-id {{ src_ami_id }} --region {{ item }} --client-token {{ src_ami_id }}-{{ item }}' - with_items: dst_regions - register: ami_copy - -# ec2_ami_copy: -# source_region: '{{ src_region }}' -# region: '{{ item }}' -# source_image_id: '{{ ami_info.results[0].ami_id }}' -# name: '{{ ami_info.results[0].name }}' -# description: '{{ ami_info.results[0].description }}' -# tags: '{{ ami_info.results[0].tags }}' -# wait: true -# with_items: dst_regions -# register: ami_copy - - - name: Wait for AMI's to become available - command: 'ec2-describe-images --region {{ item.item }} --filter state=available {{ item.stdout[-12:] }}' - until: ami_available.stdout.find("available") != -1 - retries: 10 - delay: 120 - with_items: ami_copy.results - register: ami_available - - - name: Make image publicly available - command: 'ec2-modify-image-attribute --region {{ item.item }} {{ item.stdout[-12:] }} --launch-permission -a all' - with_items: ami_copy.results - - - name: Display AMI launch URL - debug: - msg: 'https://console.aws.amazon.com/ec2/home?region={{ item.item }}#launchAmi={{ item.stdout[-12:] }}' - with_items: ami_copy.results - when: ami_copy is defined