main.yml 1014 B

1234567891011121314151617181920212223242526
  1. ---
  2. - fail:
  3. msg: "{{ item }} needs to be defined"
  4. when: item is not defined
  5. with_items:
  6. - r_openshift_aws_ami_copy_src_ami
  7. - r_openshift_aws_ami_copy_name
  8. - r_openshift_aws_ami_copy_region
  9. - name: "Create copied AMI image and wait: {{ r_openshift_aws_ami_copy_wait | default(False) }}"
  10. ec2_ami_copy:
  11. region: "{{ r_openshift_aws_ami_copy_region }}"
  12. source_region: "{{ r_openshift_aws_ami_copy_region }}"
  13. name: "{{ r_openshift_aws_ami_copy_name }}"
  14. source_image_id: "{{ r_openshift_aws_ami_copy_src_ami }}"
  15. encrypted: "{{ r_openshift_aws_ami_copy_encrypt | default(False) }}"
  16. kms_key_id: "{{ r_openshift_aws_ami_copy_kms_arn | default(omit) }}"
  17. wait: "{{ r_openshift_aws_ami_copy_wait | default(omit) }}"
  18. tags: "{{ r_openshift_aws_ami_copy_tags }}"
  19. register: copy_result
  20. - debug: var=copy_result
  21. - name: return AMI ID with setfact - openshift_aws_ami_copy_retval_custom_ami
  22. set_fact:
  23. r_openshift_aws_ami_copy_retval_custom_ami: "{{ copy_result.image_id }}"