The following lines of code is not working in Ansible version 2.3. Same
code works fine in ansible version 2.0.0
If dm_ami-AMI ID already exists, ansible throws below error
"msg": "Image ami-957313f5 does not exist"
If dm_ami-AMI ID doesn't exist, ansible throws below error
"msg": "The conditional check 'dm_ami.results[0].ami_id is defined' failed.
name: Find the AMI details
ec2_ami_find:
name: '{{ dm_ami_name }}'
region: '{{ aws_region }}'
no_result_action: success
register: dm_ami
ignore_errors: True
debug: msg="DataMoverAMI = {{ dm_ami }}
name: Remove Previous AMI if exists.
ec2_ami:
region: '{{ aws_region }}'
image_id: '{{ dm_ami.results[0].ami_id }}'
state: absent
delete_snapshot: yes
when: dm_ami.results[0].ami_id is defined
name: Create AMI from instance id.
ec2_ami:
instance_id: '{{ dm_instance_id }}'
name: '{{ dm_ami_name }}'
description: '{{ def_ami_description }}'
region: '{{ aws_region }}'
wait: yes
Have anyone noticed this issue? Do we have a workaround other than go back
to the previous ansible version?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/aba0a87b-b12f-4919-804a-4ae467f89b4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.