Issue 1:
See sample playbook at https://github.com/abdulg/ansible-common-roles

Using ansible 1.4.4.

When using Ansible roles I ran into a problem where common roles were being skipped. The linked repo is a demonstration of the issue. There are 2 roles, role1 and role2, each of which depend on a 3rd role, common.

I have three playbooks, playbook.yml, role1.yml, and role2.yml. The first playbook selects a role to execute based upon a variable passed via the command line. The second 2 simply execute role1 and role2 respectively.

Here is the result of running the role1 playbook:-

⚡ ansible-playbook -i inventory role1.yml

PLAY [Playbook to do role 1] **************************************************

GATHERING FACTS ***************************************************************
ok: [abdul]

TASK: [common | A common task] ************************************************
changed: [abdul]

TASK: [role1 | A role1 task] **************************************************
changed: [abdul]

PLAY RECAP ********************************************************************
abdul : ok=3 changed=2 unreachable=0 failed=0

And as expected, running role2 is similar:-

PLAY [Playbook to do role2] ***************************************************

GATHERING FACTS ***************************************************************
ok: [abdul]

TASK: [common | A common task] ************************************************
changed: [abdul]

TASK: [role2 | A role2 task] **************************************************
changed: [abdul]

PLAY RECAP ********************************************************************
abdul : ok=3 changed=2 unreachable=0 failed=0

But see what happens when I run playbook.yml, wherein I select the role to run via a CL variable. First select to run role1:-

⚡ ansible-playbook -i inventory playbook.yml -e do_role=role1

PLAY [Configure depending on passed in variable] ******************************

GATHERING FACTS ***************************************************************
ok: [abdul]

TASK: [common | A common task] ************************************************
changed: [abdul]

TASK: [role1 | A role1 task] **************************************************
changed: [abdul]

TASK: [role2 | A role2 task] **************************************************
skipping: [abdul]

PLAY RECAP ********************************************************************
abdul : ok=3 changed=2 unreachable=0 failed=0

The roles common and role1 are run, and role2 is skipped. All ok.

Now I select role2 in playbook.yml_:-

⚡ ansible-playbook -i inventory playbook.yml -e do_role=role2

PLAY [Configure depending on passed in variable] ******************************

GATHERING FACTS ***************************************************************
ok: [abdul]

TASK: [common | A common task] ************************************************
skipping: [abdul]

TASK: [role1 | A role1 task] **************************************************
skipping: [abdul]

TASK: [role2 | A role2 task] **************************************************
changed: [abdul]

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

The common role is skipped because role1 is skipped, and common is a dependency of role1. common should be not be skipped because it's a dependency of role2 .

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

iptables.py

ANSIBLE VERSION

ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/my_modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

CONFIGURATION

DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 5
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/my_modules']
DEFAULT_MODULE_UTILS_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/my_module_utils']
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = root
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', u'/usr/share/ansible/roles']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

running CentOS Linux release 7.4.1708
manage CentOS Linux 6.X and 7.X

SUMMARY

i have iptables rule:

iptables -A OUTPUT -p tcp --tcp-flags ALL ACK,RST,SYN,FIN -j DROP

STEPS TO REPRODUCE

- name: TCP ALL ACK,RST,SYN,FIN
iptables:
chain: OUTPUT
protocol: tcp
tcp_flags: flags="ALL" flags_set="ACK,RST,SYN,FIN"
jump: drop

EXPECTED RESULTS

/usr/sbin/iptables -t filter -A OUTPUT -p tcp --tcp-flags ALL ACK,RST,SYN,FIN -j drop

ACTUAL RESULTS

fatal: [192.168.0.151]: FAILED! => {
"changed": false,
"cmd": "/usr/sbin/iptables -t filter -A OUTPUT -p tcp --tcp-flags A,L,L A,C,K,,,R,S,T,,,S,Y,N,,,F,I,N -j drop",
"invocation": {
"module_args": {
"action": "append",
"chain": "OUTPUT",
"comment": null,
"ctstate": [],
"destination": null,
"destination_port": null,
"flush": false,
"fragment": null,
"goto": null,
"icmp_type": null,
"in_interface": null,
"ip_version": "ipv4",
"jump": "drop",
"limit": null,
"limit_burst": null,
"match": [],
"out_interface": null,
"policy": null,
"protocol": "tcp",
"reject_with": null,
"set_counters": null,
"set_dscp_mark": null,
"set_dscp_mark_class": null,
"source": null,
"source_port": null,
"state": "present",
"table": "filter",
"tcp_flags": {
"flags": "ALL",
"flags_set": "ACK,RST,SYN,FIN"
},
"to_destination": null,
"to_ports": null,
"to_source": null,
"uid_owner": null
}
},
"msg": "iptables v1.4.21: Unknown TCP flag `A'\nTry `iptables -h' or 'iptables --help' for more information.",
"rc": 2,
"stderr": "iptables v1.4.21: Unknown TCP flag `A'\nTry `iptables -h' or 'iptables --help' for more information.\n",
"stderr_lines": [
"iptables v1.4.21: Unknown TCP flag `A'",
"Try `iptables -h' or 'iptables --help' for more information."
],
"stdout": "",
"stdout_lines": []
}