Issue 1:
From @alexmiller422 on 2016-01-26T10:42:28Z

ISSUE TYPE

Bug Report

COMPONENT NAME

ec2 module

ANSIBLE VERSION

N/A

SUMMARY

Starting stopped EC2 instances selected by tags fails when wait is set to 'yes'

Task:

ec2:
region: "{{region}}"
instance_tags: {CustomerID: "{{customer_id}}", Owner: "{{owner}}", Environment: "{{environment_tag}}", Server: all-in-one}
key_name: "{{key_name}}"
assign_public_ip: yes
state: running
wait: yes

Output:

ESTABLISH LOCAL CONNECTION FOR USER: amiller
127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476 )" )
127.0.0.1 PUT /var/folders/6x/3h7k4ch51xsbv40h57h5csd40000gp/T/tmpZy3jwL TO /Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/ec2
127.0.0.1 EXEC LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/ec2; rm -rf "/Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/" > /dev/null 2>&1
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/ec2", line 3582, in <module>
main()
File "/Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/ec2", line 1405, in main
(changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state, instance_tags)
File "/Users/amiller/.ansible/tmp/ansible-tmp-1453803313.05-62519916455476/ec2", line 1308, in startstop_instances
if len(matched_instances) < len(instance_ids):
TypeError: object of type 'NoneType' has no len()

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2"}, "parsed": false}

I believe this is a duplicate of #13030

Copied from original issue: ansible/ansible-modules-core#2886

Issue 2:
ISSUE TYPE

B ug Report

Feature Idea

COMPONENT NAME

ANSIBLE VERSION

ansible 2.3.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.13 (default, Jun 26 2017, 10:20:05) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]

CONFIGURATION

OS / ENVIRONMENT

N/A

SUMMARY

When running a playbook that has a yaml anchor in a task and it is used in a subsequent task that overrides some of the original keys, with no verbosity specified, the user gets ugly warnings.

STEPS TO REPRODUCE

Among some other tasks, I have these:

- &iamuserupdate
name: create present bucket iam users
with_subelements:
- "{{ s3_buckets }}"
- users
when:
- item.0.state|default('present') != 'absent'
iam:
<<: *aws_access
name: "{{ item.1 }}"
iam_type: user
state: "{{ item.0.state|default('present') }}"

# Other tasks, not relevant

- <<: *iamuserupdate
name: delete absent bucket iam users
when:
- item.0.state|default('present') == 'absent'

EXPECTED RESULTS

I don't want to get those ugly warnings for doing something that I did on purpose and expected it to happen: overriding a task definition on some keys that already existed in the previous task.

ACTUAL RESULTS

[WARNING]: While constructing a mapping from /path/roles/aws-
manager/tasks/setup.yaml, line 147, column 3, found a duplicate dict key (name). Using last defined value only.

[WARNING]: While constructing a mapping from /path/roles/aws-
manager/tasks/setup.yaml, line 147, column 3, found a duplicate dict key (when). Using last defined value only.

Those warnings are OK, but only in -v mode at least.