Issue 1:
Hi

I am having the following issue when applying the variable set below:

ec2_security_groups_test:
- sg_name: test-grup
sg_description: test-group
vpc_id: "vpc-XXXXXX"
region: "{{ region }}"
sg_rules:
- proto: 50
from_port: -1
to_port: -1
cidr_ip: 12.12.12.12/32
- proto: 50
from_port: -1
to_port: -1
cidr_ip: 13.13.13.13/32
- proto: 50
from_port: -1
to_port: -1
group_name: test-group

it will work on the 1st run, but on the second I will have:

<Response><Errors><Error><Code>InvalidPermission.Duplicate</Code><Message>the specified rule "peer: 12.12.12.12/32, protocol: 50, ALLOW" already exists</Message></Error></Errors><RequestID>e890595b-9609-4c31-a611-87da7b5de7ae</RequestID></Response>

I have tried specifying Ports, also "-1".. Nothing seems to work.

If I say TCP or UDP it works fine, but when I specify a numeric port as above I got the issue:

Any possible workaround?

Issue 2:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.1.1.0
config file =
configured module search path = Default w/o overrides

CONFIGURATION

OS / ENVIRONMENT

Amazon Linux 4.4.11-23.53.amzn1.x86_64

SUMMARY

In v2.1.1.0, the add_host module will no longer pick up group_vars if the group name includes a forward slash. This worked in v2.1.0.0 and v2.0.0.1.

STEPS TO REPRODUCE

Create a simple playbook structure as follows:

group_vars/dir1/foo.yml
play.yml

Run ansible-playbook play.yml

#######
# play.yml
#######
- hosts: localhost
gather_facts: no
tasks:
- add_host:
name: '{{inventory_hostname}}'
groups: 'dir1/foo'
- debug: var=bar

#######
# foo.yml
#######
bar: 'abc'

EXPECTED RESULTS

With this playbook, we would expect to see the value of bar printed.

These are the results when running Ansible v2.1.0.0:

ansible-playbook play.yml -vvvv
No config file found; using defaults
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
Loaded callback default of type stdout, v2.0

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [add_host] ****************************************************************
task path: /tmp/test/play.yml:4
creating host via 'add_host': hostname=localhost
changed: [localhost] => {"add_host": {"groups": ["dir1/foo"], "host_name": "localhost", "host_vars": {}}, "changed": true, "invocation": {"module_args": {"groups": "dir1/foo", "name": "localhost"}, "module_name": "add_host"}}

TASK [debug] *******************************************************************
task path: /tmp/test/play.yml:7
ok: [localhost] => {
"bar": "abc"
}

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

ACTUAL RESULTS

In v2.1.1.0, bar is undefined, implying the group_vars/dir1/foo.yml is not being included.

This is what happens when running the same playbook using v2.1.1.0

ansible-playbook play.yml -vvvv
No config file found; using defaults
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
Loaded callback default of type stdout, v2.0

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [add_host] ****************************************************************
task path: /tmp/test/play.yml:4
creating host via 'add_host': hostname=localhost
changed: [localhost] => {"add_host": {"groups": ["dir1/foo"], "host_name": "localhost", "host_vars": {}}, "changed": true, "invocation": {"module_args": {"groups": "dir1/foo", "name": "localhost"}, "module_name": "add_host"}}

TASK [debug] *******************************************************************
task path: /tmp/test/play.yml:7
ok: [localhost] => {
"bar": "VARIABLE IS NOT DEFINED!"
}

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