Issue 1:
Issue Type:

Bug Report

Ansible Version:

ansible 2.0.1.0

Ansible Configuration:

Environment:

Mac OSX

Summary:

Using tags inside included files and access the tags as variable was working in version 1.7.2. In later version this is broken.

Note: The debug/print statements below are only in there to show the issue (tags not being able to be accessed as variable). The actual issue is that the tags was able to be used in when clause but now is not able to.

Steps To Reproduce:

Create two files as below one yaml includes the other.

ansible-playbook ./anstest.yml

anstest.yml

---
- name: Test tags in when caluse
hosts: localhost
tasks:
- { include: anstest1.yml, tags: ['removefromlb'] }

anstest1.yml

---

- debug: msg="tags yo {{tags}}" # tags could be printed as variable - worked in 1.7.1 - doesn't work in 1.9.1 or 2.0

- name: Remove from lb # how it was being used - worked in 1.7.1 - doesn't work in 1.9.1 or 2.0
debug: msg="hello world"
tags: removefromlb
when: "'removefromlb' in tags"

Expected Results:

Not error.

Actual Results:

Errors out with not being able to print tags variable which leads to issues around usage in when clause.

PLAY [Test tags in when caluse] ************************************************

TASK [setup] *******************************************************************
ESTABLISH LOCAL CONNECTION FOR USER: alvins
127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1457499884.38-255223301464115 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1457499884.38-255223301464115 `" )'
127.0.0.1 PUT /var/folders/gq/j5yrkds57zl8p5kt4fnj1xw00000gp/T/tmpbkzOcR TO /Users/alvins/.ansible/tmp/ansible-tmp-1457499884.38-255223301464115/setup
127.0.0.1 EXEC /bin/sh -c 'LANG=en_AU.UTF-8 LC_ALL=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 /usr/bin/python /Users/alvins/.ansible/tmp/ansible-tmp-1457499884.38-255223301464115/setup; rm -rf "/Users/alvins/.ansible/tmp/ansible-tmp-1457499884.38-255223301464115/" > /dev/null 2>&1'
ok: [localhost]

TASK [include] *****************************************************************
task path: /Users/alvins/git/pocketbook-servers/playbooks-aws/anstest.yml:9
included: /Users/alvins/git/pocketbook-servers/playbooks-aws/anstest1.yml for localhost

TASK [debug] *******************************************************************
task path: /Users/alvins/git/pocketbook-servers/playbooks-aws/anstest1.yml:3
fatal: [localhost]: FAILED! => {"failed": true, "msg": "'tags' is undefined"}
to retry, use: --limit @./anstest.retry

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

Issue 2:
Issue Type:

Bug Report

Ansible Version:

ansible-playbook 2.0.0.2

Ansible Configuration:

nothing special

Environment:

Debian 8.2

Summary:

Ansible-playbook option --list-tags shows no tags

Steps To Reproduce:

ansible-playbook -i inventories/tad-hosts 05-apache.yml -l tadprsc01 --list-tags

Expected Results:

playbook: 05-apache.yml

play #1 (apache-hosts): TAGS: [tag1,tag2,tag3]

TASK TAGS: [tag1,tag2,tag3]

Actual Results:

playbook: 05-apache.yml

play #1 (apache-hosts): TAGS: []

TASK TAGS: []