Issue 1:
ISSUE TYPE

bug report

COMPONENT NAME

ec2_group module

ANSIBLE VERSION

ansible 1.9.0.1

configured module search path = None

OS / ENVIRONMENT

OSX

SUMMARY

Running an ec2_group task fails if the group already exists if and it contains a rule with a cidr_ip that is not either 0.0.0.0/0 or of the form x.x.x.x/32. Rules with cidr_ips such as x.x.x.x/24 succeed the first time, then fail on subsequent runs.

STEPS TO REPRODUCE

Comment in one of the cidr_ip lines to create a task that will either be idempotent or not, as indicated:

- name: Create security group
ec2_group:
name: "foo"
description: test security group
region: eu-west-1
rules:
- proto: tcp
from_port: 80
to_port: 80
# cidr_ip: 0.0.0.0/0 # succeeds on repeated runs
# cidr_ip: 194.82.50.2/32 # succeeds on repeated runs
# cidr_ip: 194.82.50.2/24 # succeeds first time, then fails on repeated runs
# cidr_ip: 194.82.50.2/25 # succeeds first time, then fails on repeated runs

EXPECTED RESULTS

PLAY [localhost] **************************************************************

TASK: [foo | Create security group] *******************************************
ok: [localhost]

PLAY RECAP ********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0

ACTUAL RESULTS

PLAY [localhost] **************************************************************

TASK: [foo | Create security group] *******************************************
failed: [localhost] => {"failed": true, "parsed": false}
Traceback (most recent call last):
File "/Users/rsslldnphy/.ansible/tmp/ansible-tmp-1427989467.61-110551427980538/ec2_group", line 2187, in <module>
main()
File "/Users/rsslldnphy/.ansible/tmp/ansible-tmp-1427989467.61-110551427980538/ec2_group", line 302, in main
group.authorize(rule['proto'], rule['from_port'], rule['to_port'], ip, grantGroup)
File "/usr/local/lib/python2.7/site-packages/boto/ec2/securitygroup.py", line 203, in authorize
dry_run=dry_run)
File "/usr/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 3191, in authorize_security_group
params, verb='POST')
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 1226, in get_status
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidPermission.Duplicate</Code><Message>the specified rule "peer: 194.82.50.0/24, TCP, from port: 80, to port: 80, ALLOW" already exists</Message></Error></Errors><RequestID>7b8b6394-82d5-422d-a037-0aa90c4f0edd</RequestID></Response>

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/rsslldnphy/web.retry

localhost : ok=0 changed=0 unreachable=0 failed=1

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

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

yum

ANSIBLE VERSION

ansible 2.2.0.0

CONFIGURATION

N/A

OS / ENVIRONMENT

CentOS release 6.9 (Final) on source and target.

SUMMARY

When yum has error about "Warning: RPMDB altered outside of yum", ansible's yum command fails with "Failure talking to yum: list index out of range".

STEPS TO REPRODUCE

- name: install anything with yum
yum: name={{ item }} state=present
with_items:
- nodejs
# or any package

On target, someone installed an rpm manually, outside of yum. So running yum history list returns the history, followed by the message "Warning: RPMDB altered outside of yum."

As far as I understand it, this situation shouldn't prevent you from installing new things with yum.

EXPECTED RESULTS

Installs new package

ACTUAL RESULTS

failed: [stats.dev.scivantage.com] (item=[u'nodejs']) => {"failed": true, "item": ["nodejs"], "msg": "Failure talking to yum: list index out of range"}

After fixing the condition on the target (by running rpm --rebuilddb, yum clean all, then installing something manually with yum), the ansible command worked again.