Hi, I'm trying to iterate through group of variables and getting an error. After hitting the wall for 1 hour I decided to ask for help.
Here is my role: --- > - name: iterate through group of variables > blockinfile: > dest: /tmp/siema > insertbefore: "^whatever" > block: > "{% for i in groups[item.port|string]%} > port to connect:{{ i }} \n > {% endfor %}" > with_items: > - "{{ some_settings }}" > and variables: some_settings: - { port: '900', domain: 'www.xd.pl' } - { port: '800', domain: 'www.ab.pl' } Error: TASK [block : iterate through group of variables] > ****************************** > fatal: [klient1]: FAILED! => {"failed": true, "msg": "the field 'args' has > an invalid value, which appears to include a variable that is undefined. > The error was: 'dict object' has no attribute u'900'\n\nThe error appears > to have been in '/root/ansible/roles/block/tasks/main.yml': line 2, column > 3, but may\nbe elsewhere in the file depending on the exact syntax > problem.\n\nThe offending line appears to be:\n\n---\n- name: iterate > through group of variables\n ^ here\n"} > to retry, use: --limit @/root/ansible/playbook.retry > Can someone quickly correct me? Regards. -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/21484661-90a7-46be-be06-3d27ebfb40f1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.