Hi Alexey, You do not need to quote a whole string here, could you try
when: servers.role == "upstream" -- Best, Igor On Fri, Feb 6, 2015 at 2:27 PM, Alexey Lesovsky <[email protected]> wrote: > Hello all! > I have playbook with following parts: > > vars: > servers: > - { address: "192.168.122.12", role: "upstream" } > - { address: "192.168.122.13", role: "downstream" } > - { address: "192.168.122.14", role: "downstream" } > task: > - name: Task > command: "/usr/sbin/somecommand" > > How I can execute task only on upstream or downstream servers? Any help > appreciated. > > P.S. I try following part, but it doesn't work: > task: > - name: Task > command: "/usr/sbin/somecommand" > when: "servers.role == upstream" > > And got error: > fatal: [vm12-centos7] => error while evaluating conditional: servers.role == > upstream > fatal: [vm13-centos7] => error while evaluating conditional: servers.role == > upstream > fatal: [vm14-centos7] => error while evaluating conditional: servers.role == > upstream > > -- > 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/49234d35-06db-4a7a-8929-9d23ea542f69%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/CAGuanso5xjSaXNKTGsfXmfpOqMKRxnf7xX3UikEpQ7v%3Dedi72w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
