I am running ansible to copy and execute the script on remote side if script not found. but I am getting this error.
ERROR! conflicting action statements: copy, command
How can i use multiple action in single task.
---
- name: Check if the bb.sh exists
stat:
path: /tmp/bb.sh
register: stat_result
- name: Copy and execute script
copy: src=sync/bb.sh dest=/tmp/sync/ mode=0755
command: sh -c "/bin/sh /tmp/bb.sh"
when: stat_result.stat.exists == False