# Roles Variables not being Parsed - Playbook vars being applied

**URL:** <https://forum.ansible.com/t/roles-variables-not-being-parsed-playbook-vars-being-applied/19502>\
**Category:** Ansible Developer\
**Created:** [October 14, 2015, 8:34am UTC](https://forum.ansible.com/t/roles-variables-not-being-parsed-playbook-vars-being-applied/19502 "2015-10-14T08:34:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Kerr](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@Chris\_Kerr](https://forum.ansible.com/u/Chris_Kerr)\
**Post date:** [October 14, 2015, 8:34am UTC](https://forum.ansible.com/t/roles-variables-not-being-parsed-playbook-vars-being-applied/19502/1 "2015-10-14T08:34:43Z")

</div>

Hi everyone - Looking for some guidance on what i am missing in relation to calling a role during a playbook.

The issue i am having is this:

I run the playbook fine it carries out the pre\_tasks as expected, however when it gets to call the oracle role, it starts going through the oracle role tasks but it does not pick up the role specific variables in the roles/oracle\_full\_client/vars/main.yml file.  
It still uses the initial vars as defined in the playbook rather than the roles var directory?

Can anyone tell me what i’m doing wrong? I use lvname and volgroup as a default variable name per role. So in this case lvname = apps-was but in the role its calling should be called apps-ora.  
When this runs the playbook its passing apps-was instead of apps-ora!

Do i have to pass the location of the vars role directory somewhere?  
Ansible version is 1.9.2.

Thanks

`

- hosts: all  
become: true  
become\_method: sudo

# Variables

vars:  
base\_dir: “/share/bbscripts/PRD/”  
volgroup: “VolGroup00”  
lvname: “apps-was”  
was\_dir: “/apps/was”  
vol\_size: “2048m”

# Include Vars Files

vars\_files:

- “vars/{{ ansible\_distribution }}/{{ ansible\_distribution\_major\_version }}/vars.yml”

pre\_tasks:

- name: “echo\_distrib”  
shell: echo “{{ ansible\_distribution\_major\_version }}”

# Create apps-was volume

- name: “create\_volume”  
lvol: vg=“{{ volgroup }}” lv=“{{ lvname }}” size=“{{ vol\_size }}”

# RUN ORACLE Role

roles:

- role: oracle\_full\_client

post\_tasks:

- name: “create\_limits.d/95-was.conf”  
copy: src=files/95-was.conf dest=/etc/security/limits.d/95-was.conf mode=0644 force=no

- name: AND SO ON … \>\>\>\>

`

---

<div class="post-metadata">

**Author:** ![Chris\_Kerr](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@Chris\_Kerr](https://forum.ansible.com/u/Chris_Kerr)\
**Post date:** [October 14, 2015, 9:31am UTC](https://forum.ansible.com/t/roles-variables-not-being-parsed-playbook-vars-being-applied/19502/2 "2015-10-14T09:31:22Z")

</div>

Ok so I have answered my own question this time

It is as simple as NOT Stating

vars:

at the beginning of your role/x/vars/main.yml file!

Can’t believe this wasnt in the documentation.

Sorted and playbook ran cool

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok=62 changed=39 unreachable=0 failed=0
