# Variable president - default and variable in playbook

**URL:** <https://forum.ansible.com/t/variable-president-default-and-variable-in-playbook/23721>\
**Category:** Ansible Project\
**Created:** [February 13, 2017, 9:28pm UTC](https://forum.ansible.com/t/variable-president-default-and-variable-in-playbook/23721 "2017-02-13T21:28:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Wright](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Ben\_Wright](https://forum.ansible.com/u/Ben_Wright)\
**Post date:** [February 13, 2017, 9:28pm UTC](https://forum.ansible.com/t/variable-president-default-and-variable-in-playbook/23721/1 "2017-02-13T21:28:29Z")

</div>

Hi

Please bear with me.  
I have created a role and in the defaults/main.yml I have created a variable tibco\_install\_bin for which I have a value.  
I have created a playbook, and within that playbook I have created other variable for when the role is run:

roles:

- { role: tibco-install1,

common\_global\_vari: global\_vari1,

show\_vari\_dump: True,

business\_works: { install\_sw: True,

install\_name: BW,

install\_version: 5.13.0,

spec\_name: 26gl23,

silent\_name: TIBCOUniversalInstaller-,

tibco\_install\_bin: TIBCOUniversalInstaller-lnx-x86-64.bin,

bit\_ver: -64 },

business\_works\_hf5: { install\_sw: False,

install\_name: BW,

install\_version: 5.13.0\_HF-005,

spec\_name: ,

silent\_name: TIBCOUniversalInstaller-,

tibco\_install\_bin: TIBCOUniversalInstaller-lnx-x86-64.bin,

bit\_ver: -64 },

I have created a “with\_item” loop for each of the items, such as, business\_works, business\_works\_hf5 to do various things I as go through the installation process. Everything else seems to work fine until I use this variable tibco\_install\_bin (example below).

- name: Make sure the silent installer is executable

file:

path: “{{ install\_path }}/{{ item.install\_name }}-{{ item.install\_version }}/{{ tibco\_install\_bin }}”

state: file

mode: 0755

when: item.install\_sw == True

with\_items:

- “{{ rv }}”

- “{{ tibco\_tra }}”

- “{{ tibco\_tra\_hf2 }}”

- “{{ dbdrivers }}”

- “{{ dbdrivers\_hf1 }}”

- “{{ business\_works }}”

- “{{ business\_works\_hf5 }}”

- “{{ ems }}”

When I get this error below, but one can clearly see the variable is defined in the message above, please what am I missing?

TASK [tibco-install1 : Copy the silent file into place with the appropriate configuration] \*\*\*

ok: [ansiclie50] =\> (item={u’bit\_ver’: None, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86.bin’, u’spec\_name’: None, u’install\_version’: u’8.4.4’, u’install\_sw’: True, u’install\_name’: u’rv’})

ok: [ansiclie51] =\> (item={u’bit\_ver’: None, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86.bin’, u’spec\_name’: None, u’install\_version’: u’8.4.4’, u’install\_sw’: True, u’install\_name’: u’rv’})

changed: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller\_‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’5.10.0’, u’install\_sw’: True, u’install\_name’: u’TRA’})

changed: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller\_‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’5.10.0’, u’install\_sw’: True, u’install\_name’: u’TRA’})

changed: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’2.0.1’, u’install\_sw’: True, u’install\_name’: u’dbdrivers’})

changed: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’2.0.1’, u’install\_sw’: True, u’install\_name’: u’dbdrivers’})

changed: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: u’26gl23’, u’install\_version’: u’5.13.0’, u’install\_sw’: True, u’install\_name’: u’BW’})

changed: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: u’26gl23’, u’install\_version’: u’5.13.0’, u’install\_sw’: True, u’install\_name’: u’BW’})

TASK [tibco-install1 : Make sure the silent installer is executable] \*\*\*\*\*\*\*\*\*\*\*

failed: [ansiclie50] (item={u’bit\_ver’: None, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86.bin’, u’spec\_name’: None, u’install\_version’: u’8.4.4’, u’install\_sw’: True, u’install\_name’: u’rv’}) =\> {“failed”: true, “item”: {“bit\_ver”: null, “install\_name”: “rv”, “install\_sw”: true, “install\_version”: “8.4.4”, “silent\_name”: “TIBCOUniversalInstaller-”, “spec\_name”: null, “tibco\_install\_bin”: “TIBCOUniversalInstaller-lnx-x86.bin”}, “msg”: “file (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is absent, cannot continue”, “path”: “/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin”, “state”: “absent”}

failed: [ansiclie51] (item={u’bit\_ver’: None, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86.bin’, u’spec\_name’: None, u’install\_version’: u’8.4.4’, u’install\_sw’: True, u’install\_name’: u’rv’}) =\> {“failed”: true, “item”: {“bit\_ver”: null, “install\_name”: “rv”, “install\_sw”: true, “install\_version”: “8.4.4”, “silent\_name”: “TIBCOUniversalInstaller-”, “spec\_name”: null, “tibco\_install\_bin”: “TIBCOUniversalInstaller-lnx-x86.bin”}, “msg”: “file (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is absent, cannot continue”, “path”: “/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin”, “state”: “absent”}

ok: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller\_‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’5.10.0’, u’install\_sw’: True, u’install\_name’: u’TRA’})

ok: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller\_‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’5.10.0’, u’install\_sw’: True, u’install\_name’: u’TRA’})

ok: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’2.0.1’, u’install\_sw’: True, u’install\_name’: u’dbdrivers’})

ok: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: None, u’install\_version’: u’2.0.1’, u’install\_sw’: True, u’install\_name’: u’dbdrivers’})

ok: [ansiclie50] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: u’26gl23’, u’install\_version’: u’5.13.0’, u’install\_sw’: True, u’install\_name’: u’BW’})

ok: [ansiclie51] =\> (item={u’bit\_ver’: -64, u’silent\_name’: u’TIBCOUniversalInstaller-‘, u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86-64.bin’, u’spec\_name’: u’26gl23’, u’install\_version’: u’5.13.0’, u’install\_sw’: True, u’install\_name’: u’BW’})

to retry, use: --limit @/home/bwright/.ansible-retry/pb-install.retry

Help is appreciated.

Best

Ben

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 15, 2017, 3:08pm UTC](https://forum.ansible.com/t/variable-president-default-and-variable-in-playbook/23721/2 "2017-02-15T15:08:32Z")

</div>

> When I get this error below, but one can clearly see the variable is  
> defined in the message above, please what am I missing?
> 
> TASK [tibco-install1 : Copy the silent file into place with the appropriate  
> configuration] \*\*\*

\<snip/\>

> failed: [ansiclie50] (item={u'bit\_ver': None, u'silent\_name':  
> u'TIBCOUniversalInstaller-', u'tibco\_install\_bin':  
> u'TIBCOUniversalInstaller-lnx-x86.bin', u'spec\_name': None,  
> u'install\_version': u'8.4.4', u'install\_sw': True, u'install\_name': u'rv'})  
> =\> {"failed": true, "item": {"bit\_ver": null, "install\_name": "rv",  
> "install\_sw": true, "install\_version": "8.4.4", "silent\_name":  
> "TIBCOUniversalInstaller-", "spec\_name": null, "tibco\_install\_bin":  
> "TIBCOUniversalInstaller-lnx-x86.bin"}, "msg": "file  
> (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is  
> absent, cannot continue", "path":  
> "/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin",  
> "state": "absent"}
> 
> failed: [ansiclie51] (item={u'bit\_ver': None, u'silent\_name':  
> u'TIBCOUniversalInstaller-', u'tibco\_install\_bin':  
> u'TIBCOUniversalInstaller-lnx-x86.bin', u'spec\_name': None,  
> u'install\_version': u'8.4.4', u'install\_sw': True, u'install\_name': u'rv'})  
> =\> {"failed": true, "item": {"bit\_ver": null, "install\_name": "rv",  
> "install\_sw": true, "install\_version": "8.4.4", "silent\_name":  
> "TIBCOUniversalInstaller-", "spec\_name": null, "tibco\_install\_bin":  
> "TIBCOUniversalInstaller-lnx-x86.bin"}, "msg": "file  
> (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is  
> absent, cannot continue", "path":  
> "/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin",  
> "state": "absent"}

Kind of hard to see what's going on.  
But these two tasks fails on ansiclie50 and ansiclie51 because the path does not exist.

"file (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is absent, cannot continue"

You need to investigate why they don't exist on these two hosts.

---

<div class="post-metadata">

**Author:** ![Ben\_Wright](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Ben\_Wright](https://forum.ansible.com/u/Ben_Wright)\
**Post date:** [February 15, 2017, 5:18pm UTC](https://forum.ansible.com/t/variable-president-default-and-variable-in-playbook/23721/3 "2017-02-15T17:18:12Z")

</div>

Hi Kai

Thanks for your response, however this is about variables rather than files being present, this is the directory listing:

[tibcosvc@xxxxxxxxx rv-8.4.4]$ ls

assemblies product\_rv\_8.4.4\_FeatureConfig.xml TIBCOUniversalInstaller-lnx-x86.bin TIB\_rv\_8.4.4\_docinfo.html

licenses README.LINUX TIBCOUniversalInstaller-rv.silent TIB\_rv\_8.4.4\_license.pdf

[tibcosvc@xxxxxxxxx rv-8.4.4]$

You can see that the TIBCOUniversalInstaller-lnx-x86.bin is present.  
The variables I have declared for the installation binary is tibco\_install\_bin is specific for that software/version - rv-8.4.4 see error message:  
failed: [ansiclie50] (item={u’bit\_ver’: None, u’silent\_name’: u’TIBCOUniversalInstaller-‘, **u’tibco\_install\_bin’: u’TIBCOUniversalInstaller-lnx-x86.bin’** , u’spec\_name’: None, u’install\_version’: u’8.4.4’, u’install\_sw’: True, u’install\_name’: u’rv’}) =\> {“failed”: true, “item”: {“bit\_ver”: null, “install\_name”: “rv”, “install\_sw”: true, “install\_version”: “8.4.4”, “silent\_name”: “TIBCOUniversalInstaller-”, “spec\_name”: null, “tibco\_install\_bin”: “TIBCOUniversalInstaller-lnx-x86.bin”}, “msg”: “file (/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin) is absent, cannot continue”, “path”: “/opt/tibco/installs/rv-8.4.4/TIBCOUniversalInstaller-lnx-x86-64.bin”, “state”: “absent”}

My role task calls this variable when it runs,

path: “{{ install\_path }}/{{ item.install\_name }}-{{ item.install\_version }}/ **{{ tibco\_install\_bin }}** ”

But it seems that this variable does not take priority over the default I have set? So what am I doing wrong?

Many thanks

Ben
