summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws_ami_copy/tasks/main.yml
blob: bcccd40425b049e819eef6ed960dc5635aba4df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
- fail:
    msg: "{{ item }} needs to be defined"
  when: item is not defined
  with_items:
  - r_openshift_aws_ami_copy_src_ami
  - r_openshift_aws_ami_copy_name
  - r_openshift_aws_ami_copy_region

- name: "Create copied AMI image and wait: {{ r_openshift_aws_ami_copy_wait | default(False) }}"
  ec2_ami_copy:
    region: "{{ r_openshift_aws_ami_copy_region }}"
    source_region: "{{ r_openshift_aws_ami_copy_region }}"
    name: "{{ r_openshift_aws_ami_copy_name }}"
    source_image_id: "{{ r_openshift_aws_ami_copy_src_ami }}"
    encrypted: "{{ r_openshift_aws_ami_copy_encrypt | default(False) }}"
    kms_key_id: "{{ r_openshift_aws_ami_copy_kms_arn | default(omit) }}"
    wait: "{{ r_openshift_aws_ami_copy_wait | default(omit) }}"
    tags: "{{ r_openshift_aws_ami_copy_tags }}"
  register: copy_result

- debug: var=copy_result

- name: return AMI ID with setfact - openshift_aws_ami_copy_retval_custom_ami
  set_fact:
    r_openshift_aws_ami_copy_retval_custom_ami: "{{ copy_result.image_id }}"