--- - name: is log2mail installed? stat: path: /etc/log2mail/config/ #check_mode: no (for migration to Ansible 2.2) always_run: yes register: log2mail_config - block: - name: log2mail proxy config is present template: src: log2mail.j2 dest: /etc/log2mail/config/squid.conf mode: "0640" owner: log2mail group: adm notify: restart log2mail - name: log2mail user is in proxy group user: name: log2mail groups: proxy append: yes state: present notify: restart log2mail when: log2mail_config.stat.exists