Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include_role does not complain about undefined variables #54786

Closed
nkakouros opened this issue Apr 3, 2019 · 1 comment · Fixed by #54791
Closed

include_role does not complain about undefined variables #54786

nkakouros opened this issue Apr 3, 2019 · 1 comment · Fixed by #54791
Assignees
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team. verified This issue has been verified/reproduced by maintainer

Comments

@nkakouros
Copy link
Contributor

SUMMARY

include_role does not complain when an undefined variable is used in one of the keywords, yet ansible exits with 1.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

include_role

ANSIBLE VERSION
ansible 2.8.0.dev0
  config file = /home/nikos/Projects/ansible-demo/ansible.cfg
  configured module search path = ['/home/nikos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/nikos/Projects/ansible/lib/ansible
  executable location = /home/nikos/Projects/ansible/bin/ansible
  python version = 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
CONFIGURATION
DEFAULT_HOST_LIST(/home/nikos/Projects/ansible-demo/ansible.cfg) = ['/home/nikos/Projects/ansible-demo/inventory']
DEFAULT_ROLES_PATH(/home/nikos/Projects/ansible-demo/ansible.cfg) = ['/home/nikos/Projects/ansible-demo/roles', '/home/nikos/Projects']

OS / ENVIRONMENT

Arch linux latest

STEPS TO REPRODUCE
---

- hosts: localhost
  become: yes
  vars:
    roles:
      - sss.qqq
  gather_facts: no
  tasks:
    - include_role:
        name: "{{ role_name }}"
        apply:
          # tags: "{{ role | regex_replace('.*', '') }}"
          tags: "{{ role_name }}"
      loop: "{{ roles }}"
      tags: always
EXPECTED RESULTS

Some error about the undefined variable.

ACTUAL RESULTS
[nikos@nikos-laptop ansible-demo]$ ANSIBLE_CONFIG=ansible.cfg ansible-playbook -i inventory play1.yml 
 [WARNING]: Found variable using reserved name: roles


PLAY [localhost] *****************************************************************************************************************************************************************************

TASK [include_role : {{ role_name }}] ********************************************************************************************************************************************************

PLAY RECAP ***********************************************************************************************************************************************************************************


@ansibot
Copy link
Contributor

ansibot commented Apr 3, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 3, 2019
@sivel sivel added P3 Priority 3 - Approved, No Time Limitation verified This issue has been verified/reproduced by maintainer labels Apr 3, 2019
@sivel sivel self-assigned this Apr 3, 2019
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Apr 3, 2019
mattclay pushed a commit to mattclay/ansible that referenced this issue Apr 8, 2019
* Don't swallow exceptions when processing included files. Fixes ansible#54786
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team. verified This issue has been verified/reproduced by maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants