When condition is failing in windows ansible

Hi all,

I have written below task to copy a file if it is 64-bit windows OS.

  • name:
    win_shell: ‘wmic os get osarchitecture | findstr “bit”’
    register: result

  • debug: var=result.stdout_lines

  • name:
    win_copy:
    src=‘{{package_PATH}}/vim25.zip’
    dest=‘{{ vim25_PATH }}/vmware/’
    remote_src=yes
    when: result.stdout_lines == ‘64-bit’

while executing task it’s skipping even condition is true.

out put as below:

skipping: [172.31.27.224] => {
“changed”: false,
“skip_reason”: “Conditional result was False”
}

Can any one help me to fix this issue?

Hi all,

I have written below task to copy a file if it is 64-bit windows OS.

- name:
win_shell: 'wmic os get osarchitecture | findstr "bit"'
register: result
- debug: var=result.stdout_lines

- name:
win_copy:
src='{{package_PATH}}/vim25.zip'
dest='{{ vim25_PATH }}/vmware/'
remote_src=yes
when: result.stdout_lines == '64-bit'

while executing task it's skipping even condition is true.

out put as below:

skipping: [172.31.27.224] => {
"changed": false,
"skip_reason": "Conditional result was False"
}

Can any one help me to fix this issue?

1. use Ansible facts to determine OS details (ansible_architecture)
2. stdout_lines is a list so a string match is futile, try stdout or stdout_lines[0]

Regards
        Racke