Hi,

> I cant figure out why
> 
> ---
> - hosts: misc
>   become: false
>   gather_facts: yes
>   tasks:
>     - name: get package version
>       shell: rpm -q {{ item }}
>       with_items:
>         - "package1"
>         - "package2"
>         - "package3"
>       register: pkg
> 
>     - debug:
>         msg: "{{ pkg.stdout }}"
> 
> 
> FAILED! => {"msg": "The task includes an option with an undefined
> variable. The error was: 'dict object' has no attribute
> 'stdout'\n\nThe error appears to have been in '/opt/ansible/foo.yml':
> line 14, column 7, but may\nbe elsewhere in the file depending on the
> exact syntax problem.\n\nThe offending line appears to be:\n\n\n    -
> debug:\n      ^ here\n\nexception type: <class
> 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object'
> has no attribute 'stdout'"}

note that you're using a loop for the "get package version" task. The
structure of pkg is different because of that; in particular, pkg has
no attribute stdout (as the error message tells you). You could output
the whole content of pkg with debug to see that.

Cheers,
Felix

-- 
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/20190322210249.6c01a2ab%40rovaniemi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to