Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.1.1.0

config file = /etc/ansible/ansible.cfg

configured module search path = Default w/o overrides

CONFIGURATION

custom role_path

OS / ENVIRONMENT

Ubuntu 12.04

SUMMARY

After upgrade from 2.1.0 to 2.1.1 cannot use group_vars and host_vars in role's defined playbook

STEPS TO REPRODUCE

$ ansible-playbook -i hosts playbooks/playbook.yml

Enter hosts for playbook run: test_group

PLAY [Test playbook] ***********************************************************

TASK [setup] *******************************************************************

ok: [10.10.10.5]

ok: [10.10.10.6]

TASK [common-aliases : set alias] **********************************************

fatal: [10.10.10.5]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'root_mail_aliase' is undefined\n\nThe error appears to have been in '/home/snow/Documents/scripts/ansible/roles/common-aliases/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: set alias\n ^ here\n"}

fatal: [10.10.10.6]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'root_mail_aliase' is undefined\n\nThe error appears to have been in '/home/snow/Documents/scripts/ansible/roles/common-aliases/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: set alias\n ^ here\n"}

$ cat playbook.yml

---
- name: Test playbook
hosts: "{{ hosts }}"
user: root
gather_facts: True
vars_prompt:
- name: hosts
prompt: "Enter hosts for playbook run"
private: no

roles:
#check host_vars/ before run
#check group_vars/ before run
- common-aliases

$ cat group_vars/test_group
root_mail_aliase: "admins@example.com"

$ cat /home/snow/Documents/scripts/ansible/roles/common-aliases/tasks/main.yml

---
- name: set alias
lineinfile: "dest=/etc/aliases insertafter='^#root:' line='root: {{ root_mail_aliase }}'"

EXPECTED RESULTS

Variable root_mail_aliase can be accessible from task

ACTUAL RESULTS

Running the playbook leads to the error above

Issue 2:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.1.1.0

CONFIGURATION

OS / ENVIRONMENT

Ubuntu 16.04

SUMMARY

group_vars are ignored if the inventory is the output of a script that is stored in a subdirectory. This includes the popular ec2 inventory script. This bug was introduced in 2.1.1.0 (2.1.0.0 works fine).

STEPS TO REPRODUCE

inventory/script.sh

#!/bin/sh

echo '{"webservers": ["paperberry"]}'

group_vars/all.yml:

---
frontend_path: /var/www/html

playbooks/webservers.yml:

---
- hosts: all
connection: local
tasks:
- debug: var=frontend_path

Run the following code:

ansible-playbook -i inventory/script.sh playbooks/webservers.yml

EXPECTED RESULTS

ansible 2.1.0.0 shows

ok: [paperberry] => {
"frontend_path": "/var/www/html"
}

ACTUAL RESULTS

ansible 2.1.1.0 shows

ok: [paperberry] => {
"frontend_path": "VARIABLE IS NOT DEFINED!"
}