Assuming index.php exists in the role’s files subdirectory:
- copy:
src: index.php
dest: /var/www/index.php
force: no
The decisive property is force. As the documentation explains, the default is yes, which will replace the remote file when contents are different than the source. If no, the file will only be transferred if the destination does not exist.