win_command and when condition

8 views
Skip to first unread message

syam rhel

unread,
Jun 25, 2020, 2:25:28 AM6/25/20
to Ansible Project
Hi,

Im trying to rename the file using win_command if the file exists using when condition, other wise it won't execute the command, but it is failing, Can any one suggest.

- name: Rename the file based on condition
  win_command: cmd.exe /c rename D:\\{{item,name}}-filename.json  {{item.name}}.filename.json-{{ ansible_date_time.date}}
  when: {{item.name}}-filename.json,stat.exists
  loop: {{ variable}}


Thank you,



Reply all
Reply to author
Forward
0 new messages