Issue 1:
Issue Type:

Bug Report

Ansible Version:

ansible --version
ansible 2.0.0 (devel a567f28657) last updated 2015/10/16 13:17:37 (GMT -500)
lib/ansible/modules/core: (detached HEAD 5da7cf696c) last updated 2015/10/16 13:17:37 (GMT -500)
lib/ansible/modules/extras: (detached HEAD 8ce3104bc5) last updated 2015/10/14 12:09:50 (GMT -500)
config file = /Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
configured module search path = None

Ansible Configuration:

Using the ansible.cfg from git with the following change (I need ssh to ForwardAgent=yes) I still get the import warnings.

ssh_args = -o ControlMaster=auto -o ControlPersist=600s -o ForwardAgent=yes

Environment:

OS X Yosemite 10.11

$ python -V

Python 2.7.10

Summary:

Started a discussion on the Ansible Development Google Group. Wasn't sure if the problem is Ansible or my upgrade to El Capitan (10.11) using bisect I think I've narrowed the problem down to a problem in Ansible.

Any play or playbook throws RuntimeWarning.

RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import from ansible import errors

$ git bisect good
d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447 is the first bad commit
commit d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447

$ git bisect log
git bisect start
# bad: [aee6de5a7696520f1fea00a145af055732d8e570] group_names should not include implied 'all', fixes #12763
git bisect bad aee6de5a7696520f1fea00a145af055732d8e570
# good: [cb9f350c8fa74225c3e4e23e720fbbd7e5792548] Merge pull request #12720 from jhawkesworth/test_amc_2147
git bisect good cb9f350c8fa74225c3e4e23e720fbbd7e5792548
# bad: [0526b43b5fd61d2894026960e433b0cc9b72a692] Merge pull request #12757 from mgedmin/py3k
git bisect bad 0526b43b5fd61d2894026960e433b0cc9b72a692
# bad: [ab569cea2253fd70bc8b3f0a2540ac0d075e8c4a] Move to_str alias into ansible.utils.unicode
git bisect bad ab569cea2253fd70bc8b3f0a2540ac0d075e8c4a
# bad: [85abd61001ffa59f92db56080f04fa4287460fe0] Add some more info to docstring
git bisect bad 85abd61001ffa59f92db56080f04fa4287460fe0
# bad: [d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447] Reworking the way all() works in plugin_loader
git bisect bad d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447
# good: [45b803efb44b7cf744ccc365f52f3adbfafed0a0] Properly use test_loader from SharedPluginLoaderObj
git bisect good 45b803efb44b7cf744ccc365f52f3adbfafed0a0
# first bad commit: [d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447] Reworking the way all() works in plugin_loader

Steps To Reproduce:

Any play or playbook produces this Warning.

Expected Results:

No warnings.

Actual Results:

/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks.git/callback_plugins/fix-ssl.py:1: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks' not found while handling absolute import
import ssl
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/context_demo.py:18: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:18: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:19: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import urllib
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:22: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import prettytable
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:27: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:28: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.module_utils.urls import open_url
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:18: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:19: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import time
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:20: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:22: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.utils.unicode import to_bytes
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:23: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:19: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:20: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import smtplib
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:21: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:23: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.utils.unicode import to_bytes
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:24: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:19: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import subprocess
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:20: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:22: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/profile_tasks.py:21: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import time
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/profile_tasks.py:23: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:1: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:2: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:4: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import logging
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:5: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import logging.handlers
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:7: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import socket
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:9: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:1: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:2: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
import datetime
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:3: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from datetime import datetime, timedelta
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:5: RuntimeWarning: Parent module '/Volumes/Warrior1TB/Users/tanner/projects/ansible' not found while handling absolute import
from ansible.plugins.callback import CallbackBase

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

ec2_group module

ANSIBLE VERSION

2.3

SUMMARY

From @edsonmarquezani on 2015-11-28T16:16:27Z

It seems there's some inconsistency regarding EC2 Secutiry Groups rules idempotence (ec2_group module).

Assume the following task (my real code):

- name: "scg-{{ environment_short }}-pub-ec2-{{ group }}-webapp"
ec2_group:
name: "scg-{{ environment_short }}-pub-ec2-{{ group }}-webapp"
vpc_id: "{{ vpc.vpc_id }}"
region: "{{ aws_region }}"
description: "Security group for {{ group }} web application servers."
rules:
- proto: tcp
from_port: 80
to_port: 80
group_id: "scg-{{ environment_short }}-pub-elb-{{ group }}-webapp"
- proto: tcp
from_port: 443
to_port: 443
group_id: "scg-{{ environment_short }}-pub-elb-{{ group }}-webapp"
register: sg3

First time I run it, the security group is successfully created. If I run it again, then I get the following error.

TASK [scg-prd-pub-ec2-tvk-webapp] An exception occurred during task execution. To see the full traceback, use -vvv. The error was: <Response><Errors><Error><Code>InvalidPermission.Duplicate</Code><Message>the specified rule "peer: sg-795f0c1f, TCP, from port: 80, to port: 80, ALLOW" already exists</Message></Error></Errors><RequestID>d2916a1d-923d-4182-a528-5863973e7f2e</RequestID></Response> fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "parsed": false}

What is weird is that I don't get an error like that for all my security groups, but just some of them. I have other tasks on the playbook with ingress rules like that, which keep working after being created.

I'm using Ansible 2.0.0-0.6.rc1 and Boto 2.38, but I have had the same problem with previous version of Ansible as well.

Thanks.

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