Issue 1:
when using multiple inventory files defining different groups for the same hosts, ansible adds the hosts multiple times to the inventory list.

version: 1.4.4+dfsg-1 (from debian jessie)

same problem with current devel 00b3f62

reproduce:

use files from https://gist.github.com/g-k-r/8599442

run ansible all --list

run ansible group2 --list and compare with ansible type2 --list

actual output:

$ ansible all --list
www.google.com
www.yahoo.com
www.yahoo.com
$ ansible group2 --list
www.yahoo.com
$ ansible type2 --list
www.yahoo.com
www.yahoo.com

note when the group is defined in both files like [type1] this does not happen.

$ ansible type1 --list
www.google.com

expected output: www.yahoo.com shows up once only i.e.

$ ansible all --list
www.google.com
www.yahoo.com
$ ansible group2 --list
www.yahoo.com
$ ansible type2 --list
www.yahoo.com

additional information:

to verify that tasks would actually be executed multiple times use

$ ansible all -m debug -a '"msg=TEST {{inventory_hostname}}"'
www.google.com | success >> {
"msg": "TEST www.google.com"
}

www.yahoo.com | success >> {
"msg": "TEST www.yahoo.com"
}

www.yahoo.com | success >> {
"msg": "TEST www.yahoo.com"
}

Issue 2:
Issue Type:

Bug Report

Ansible Version:

Current latest devel. Also 1.6 and assorted versions in between.

$ ansible --version
ansible 1.8 (devel 2eda9a3a47) last updated 2014/10/10 18:43:36 (GMT +100)
lib/ansible/modules/core: (detached HEAD 5af8d55b03) last updated 2014/10/10 18:43:44 (GMT +100)
lib/ansible/modules/extras: (detached HEAD 681db4ce2c) last updated 2014/10/10 18:43:45 (GMT +100)
v2/ansible/modules/core: (detached HEAD cb69744bce) last updated 2014/10/08 10:13:54 (GMT +100)
v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 2014/10/08 10:14:38 (GMT +100)

Environment:

Ansible run on Ubuntu 12.04.5 LTS. Clients Centos 6.5 (the bug manifests locally and remotely).

Summary:

Ansible's 'copy' module has a parameter, 'content'. Although jinja2 expansions in the content parameter appear to be supported, they don't work as expected, specifically they do not mimic the behaviour of the template module with the same content. Quoting appears to be mangled in some cases, and ansible can be made to throw exceptions with others. A content value '{{x}}', where a var x is defined with quotes within, will not necessarily result in the quotes (and whitespace) being preserved.

Steps To Reproduce:

Create a playbook called 'test.yml':

---
- name: quote mangling
hosts: all

vars:
content: a="q "

tasks:
- name: test copy
action: copy
content="{{content}}"
dest=/tmp/content

You may also need an ansible_hosts like this:

localhost

Then run ansible-playbook like this:

ansible-playbook -l localhost -c local test.yml

Output looks like this:

PLAY [quote mangling] *************************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [test copy] *************************************************************
ok: [localhost]

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

Expected Results:

The expected result is a file in /tmp/content containing this:

a="q "

Actual Results:

What I actually get in the file is:

"a="q

No trailing space; quotes have been re-inserted wrongly.

Other cases

Remove the second quote in the var definition. Ansible rejects the input:

fatal: [localhost] => error parsing argument string 'content="a="q" dest=/tmp/content', try quoting the entire line.

I believe I managed to make ansible throw an exception with one variation, however I cannot reproduce that now; possibly dependent on the version of ansible.