Remove symlink with Ansible

Solution 1:

You have a synatx error in your task. It should be:

- name: Remove symlink
  file:
   path: "/usr/local/bin/dead_symlink"
   state: absent

Ansible is probably looking for the path path=/usr/local/bin/dead_symlink and not for /usr/local/bin/dead_symlink.

Solution 2:

For me in playbook

- name: Deleting Default Configurations
  when: sitelink is success
  file: path=/etc/nginx/site-enabled/default state=absent

above code is working nice for me just replace with your path.