solved. 
 

On Sunday, January 17, 2016 at 2:25:53 AM UTC+5:30, bablu wrote:
>
> 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 <http://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 [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/36e2a39a-a977-4d07-9610-18fa98416a5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to