Ansible playbooks

Проверка наличия шаблона внутри роли

- name: FIREWALL check interface template exists
  stat:
    path="{{ role_path }}/files/interfaces.{{ ansible_hostname }}"
  delegate_to: localhost
  register: template_exists
- name: FIREWALL /etc/network/interfaces
  copy:
    src: interfaces.{{ ansible_hostname }}
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: "0644"
  when: template_exists.stat.exists

Если вне роли можно использовать {{ playbook_dir }}