On 10/07/19 8:32 PM, Kunalsing Thakur wrote:
Where did 'item' come from? Usually, when you use a task in a loop, you can access the loop item via the variable 'item'. I don't see a loop in your playbook.file.txt rpmname: version rpmname: version Playbook:- - hosts: all gather_facts: false tasks: - name: store the value shell: cat /etc/ansible/playbooks/file.txt register: versions - name: Ansible Dictionary variable Example debug: msg: "rpmname is {{ item.key}} and value is {{item.value}}"i want to access multiple key values in ansible -playbook to perform operation. looks like something is missing to access that values.
In your example, look at versions.stdout for file contents. Or use the Slurp module to read file contents.
- Sudheer S -- 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/9d0260ae-ee54-179c-2da6-cdf0fd565843%40techchorus.net. For more options, visit https://groups.google.com/d/optout.
