I have not tested but you want to do something like the following:

- set_fact
    win_copy_src_var: phoenix_x86
  when:  "{{ ansible_architecture }} == 32-bit"

- set_fact
    win_copy_src_var: phoenix_x64
  when:  "{{ ansible_architecture }} == 64-bit"

- name: copy_phoenix_folder
  win_copy:
    src: "{{ win_copy_src_var }}"
    dest: c:\\

There might be better solutions depending on the structure of your playbook.

Thanks,
Martin

On Fri, Jun 7, 2019 at 2:58 PM Deepak Asawa <deepakasawa2...@gmail.com> wrote:
>
> Hi,
>
> - name: copy_phoenix_folder
>   win_copy:
>          src: phoenix_x86
>          when:  "{{ ansible_architecture }} == 32-bit"
>          src: phoenix_x64
>          when:  "{{ ansible_architecture }} == 64-bit"
>          dest: c:\\
>
> I have written above code but scr will always be set to phoenix_x64, giving 
> below warning
>
>  [WARNING]: While constructing a mapping from 
> /etc/ansible/roles/deepak_role/tasks/copy_phoenix_folder.yml, line 3, column 
> 10, found a duplicate dict key (when). Using
> last defined value only.
>
> where phoenix_x86 and phoenix_x64 are the folders copied in files folder of 
> role.
>
> Please guide me so that the scr should be set to phoenix_x86 when 
> ansible_architecture is "32-bit" and it should set to phoenix_x64 when 
> ansible_architecture is "64-bit"
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-devel/e84c2ba3-9e42-49e7-ad00-d92bcab9e5a5%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 Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CADDq2EPazWR_816jL2fPgZf4Ez4AXktkzMG7JR9X%2BB1Y8wUMCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to