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
- command: /home/user/<PATH2>/bin/
become: yes
become_method: su
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.