for the sake of completeness here's the playbook and the error message:

(v2.3.2) $ cat role.yml 
- hosts: localhost
  gather_facts: false
  roles:
  - role: myrole
  tasks:
  - debug: 
      var: vars['mydefaultvar']
  - debug: 
      var: myvar
    vars: 
      myvar: "{{ lookup('vars', 'mydefaultvar') }}"
(v2.3.2) $ ansible-playbook role.yml -vvv 
Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: role.yml 
************************************************************************************************************************************************************************************************************************************************************
1 plays in role.yml

PLAY [localhost] 
**************************************************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [debug] 
******************************************************************************************************************************************************************************************************************************************************************
task path: /home/fusillator/Code/ansible/test/role.yml:6
ok: [localhost] => {
    "vars['mydefaultvar']": "myvalue"
}

TASK [debug] 
******************************************************************************************************************************************************************************************************************************************************************
task path: /home/fusillator/Code/ansible/test/role.yml:8
fatal: [localhost]: FAILED! => {
    "failed": true, 
    "msg": "An unhandled exception occurred while running the lookup plugin 
'vars'. Error was a <type 'exceptions.AttributeError'>, original message: 
'LookupModule' object has no attribute 'set_options'"
}
    to retry, use: --limit @/home/fusillator/Code/ansible/test/role.retry

PLAY RECAP 
********************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    
failed=1   

regards

Luca 


Il giorno domenica 17 marzo 2019 18:45:58 UTC+1, fusillator ha scritto:
>
> I managed to install the release 2.3.2.0 with virtualenv on my pc, easier 
> than expected...
>
> @kai 
> I confirm that the variable vars is defined and it works as described at 
> least on my host. 
> I think I tested it in a wrong way (maybe trying to access 
> vars[inventory_hostname][item|basename], but I'm not sure..), I'll double 
> check on Monday 
> By the way I didn't find the variable description in the documentation 
> pages.
>
> @Adam E 
> I also tried to use the lookup plugin vars with ansible 2.3.2
> I copied the plugin code 
> /usr/lib/python2.7/dist-packages/ansible/plugins/lookup/vars.py in a test 
> directory test/lookup_plugins/vars.py
> I regenarate the bytecode (useless) 
> (v2.3.2) $ python -m py_compile vars.py 
> and tested it getting the following failure:
>
> task path: /home/fusillator/Code/ansible/test/role.yml:8
> The full traceback is:
> Traceback (most recent call last):
>   File 
> "/home/fusillator/Code/ansible/v2.3.2/local/lib/python2.7/site-packages/ansible/executor/task_executor.py",
>  
> line 89, in run
>     items = self._get_loop_items()
>   File 
> "/home/fusillator/Code/ansible/v2.3.2/local/lib/python2.7/site-packages/ansible/executor/task_executor.py",
>  
> line 214, in _get_loop_items
>     items = mylookup.run(terms=loop_terms, variables=self._job_vars, 
> wantlist=True)
>   File "/home/fusillator/Code/ansible/test/lookup_plugins/vars.py", line 
> 72, in run
>     self.set_options(direct=kwargs)
> AttributeError: 'LookupModule' object has no attribute 'set_options'
>
> I think the code is not backward compatible with 2.3.2, and I'm a python 
> newbe (not enough devotee) to further investigate on the issue. 
>
> thanks a lot for the support guys. You rock.   
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b40873cf-77db-4dc8-ba19-ce3b02d784f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to