--- - name: Install logstash become: true apt: name: logstash state: present update_cache: yes when: ansible_os_family == "Debian" - name: Start and enable logstash become: true service: name: logstash state: started enabled: yes when: ansible_os_family == "Debian" - name: Copy logstash config file become: true copy: src: logstash.conf dest: /etc/logstash/conf.d/logstash.conf when: ansible_os_family == "Debian"