Issue 1:
Issue Type

Bug Report

Ansible Version

$ ansible --version
ansible 2.1.0 (devel c44110bc81) last updated 2016/01/26 14:25:38 (GMT +200)
lib/ansible/modules/core: (detached HEAD 33014c6db1) last updated 2016/01/11 10:48:27 (GMT +200)
lib/ansible/modules/extras: (detached HEAD 82a4cf84be) last updated 2016/01/11 10:48:30 (GMT +200)
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

Distribution: Debian GNU/Linux 8.2 (jessie)

Ansible Configuration

gathering = explicit

pipelining = True

Summary

When assigning tags to roles, tags are not overwritten.

Steps To Reproduce

Here the tree :

├── mydep
│ ├── meta
│ │ └── main.yml
│ └── tasks
│ └── main.yml
├── myrole
│ ├── meta
│ │ └── main.yml
│ └── tasks
│ └── main.yml
└── playbook.yml

File playbook.yml :

- hosts: localhost
roles:
- { role : myrole , tags : 'role1', var : 'one' }
- { role : myrole , tags : 'role2', var : 'two' }
- { role : myrole , var : 'three' }

File myrole/tasks/main.yml and mydep/tasks/main.yml :

---
- name: Debug
debug: msg="{{ var }}"

File myrole/meta/main.yml :

---
allow_duplicates: yes
dependencies:
- { role : mydep }

Expected Results

$ ansible-playbook playbook.yml --list-tasks --list-tags

playbook: playbook.yml

play #1 (localhost): TAGS: []
tasks:
mydep : Debug TAGS: [role1]
myrole : Debug TAGS: [role1]
mydep : Debug TAGS: [role2]
myrole : Debug TAGS: [role2]
mydep : Debug TAGS: []
myrole : Debug TAGS: []
TASK TAGS: [role1, role2]

Actual Results

$ ansible-playbook playbook.yml --list-tasks --list-tags

playbook: playbook.yml

play #1 (localhost): TAGS: []
tasks:
mydep : Debug TAGS: [role1]
myrole : Debug TAGS: [role1]
mydep : Debug TAGS: [role1, role2]
myrole : Debug TAGS: [role2]
mydep : Debug TAGS: [role1]
myrole : Debug TAGS: []
TASK TAGS: [role1, role2]

Sylvain

Issue 2:
using ansible from devel branch (7812c70)

having custom name "some-machine" for a host in hosts file

and exact ip as ansible_ssh_host in corresponding host_vars/some-machine

for ex. copy action fails on:

fatal: [some-machine] => Traceback (most recent call last):
File "/home/psedlak/all/src/ansible/lib/ansible/runner/__init__.py", line 583, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/home/psedlak/all/src/ansible/lib/ansible/runner/__init__.py", line 757, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/home/psedlak/all/src/ansible/lib/ansible/runner/__init__.py", line 990, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/home/psedlak/all/src/ansible/lib/ansible/runner/action_plugins/copy.py", line 179, in run
remote_checksum = self.runner._remote_checksum(conn, tmp_path, dest_file)
File "/home/psedlak/all/src/ansible/lib/ansible/runner/__init__.py", line 1167, in _remote_checksum
inject = self.get_inject_vars(conn.host)
File "/home/psedlak/all/src/ansible/lib/ansible/runner/__init__.py", line 607, in get_inject_vars
host_variables = self.inventory.get_variables(host, vault_password=self.vault_pass)
File "/home/psedlak/all/src/ansible/lib/ansible/inventory/__init__.py", line 443, in get_variables
raise Exception("host not found: %s" % hostname)
Exception: host not found: 10.10.10.1

My guess after quickly looking into the code is that:

copy.run calls _runner.remote_checksum (btw calling (single) underscore method from outside?) passing conn (it does not have hostname avail)

remote_checksum uses inventory.get... which expects hostname but from conn object it gets "just" ip to where connection was initialized

that results in not finding ip value in the inventory (_hosts_cache there has hostnames as keys)

I'm not sure what should be correct behaviour where here. Have inventory use ip's for lookup/caching? There seems to be also conn.delegate which holds the hostname so maybe using that value (if it exists, otherwise continue with .host as it is atm)?

I didn't checked but it seems this was "introduced" (as side effect) by change f1267c0 "Move from md5 to sha1..." when remote_md5 was changed to remote_checksum and instead of doing plain conn.shell.md5 it started consulting HostVars etc, and based on the size of the change I assume it may impact also assemble, fetch, template and unarchive actions.