Hi, Trying to write playbook with when conditional statement.
However, it always choose last command (/home/user/<PATH2>/bin/) to execute even though condition matches with another domainname. playbook.yml # command execution Ansible Playbooks - hosts: "{{domainname}}" remote_user: <user> vars_prompt: - name: "domainname" prompt: "Enter domain name" private: no tasks: - name: Copy file to client copy: src=/tmp/{{file_name}} dest=/tmp/ owner=<user> group=user mode=0644 become: yes become_method: su tasks: - name: installing something command: /home/user/*<PATH1>*/bin/ become: yes become_method: su when: ('"{{domainname}}" == "test.com"') or ('"{{domainname}}" == "test1.com"') - command: /home/user/*<PATH2>*/bin/ become: yes become_method: su when: ('"{{domainname}}" == "test5.com"') or ('"{{domainname}}" == "test5.com"') While running above if i will enter *test.com* as a domain name still it will execute command (/home/user/*<PATH2>*/bin/) instead of (/home/user/ *<PATH1>*/bin/) Please correct me where i am making mistake. -- 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/816c5f0c-c3ae-4b6b-915a-0cb70a10def1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.