geerlingguy/ansible-role-certbot

Symlink generation fails in initial dry-run execution (snap)

tobiashuste opened this issue · 0 comments

When executing the role initially via dry-run the task Symlink certbot into place. fails to execute because the src file is not present.

- name: Symlink certbot into place.
file:
src: /snap/bin/certbot
dest: /usr/bin/certbot
state: link

Error message:

FAILED! => {"changed": false, "msg": "src file does not exist, use \"force=yes\" if you really want to create the link: /snap/bin/certbot", "path": "/usr/bin/certbot", "src": "/snap/bin/certbot"}

My proposed change would be to ignore the error for this task when being run in check mode.

- name: Symlink certbot into place.
  file:
    src: /snap/bin/certbot
    dest: /usr/bin/certbot
    state: link
  ignore_errors: "{{ ansible_check_mode }}"