Variable president - default and variable in playbook

32 views
Skip to first unread message

Ben Wright

unread,
Feb 14, 2017, 1:20:35 PM2/14/17
to Ansible Project
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

Kai Stian Olstad

unread,
Feb 15, 2017, 10:08:57 AM2/15/17
to ansible...@googlegroups.com
On 13. feb. 2017 22:28, Ben Wright wrote:
> 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.


--
Kai Stian Olstad

Ben Wright

unread,
Feb 16, 2017, 1:36:24 AM2/16/17
to Ansible Project, ansible-pr...@olstad.com
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
Reply all
Reply to author
Forward
0 new messages