- hosts: all tasks: - name: Copy Package copy: src=/usr/local/filebeat-6.2.2-linux-x86_64.tar.gz dest=/usr/local/filebeat-6.2.2-linux-x86_64.tar.gz - name: Tar Package shell: cd /usr/local/;tar zxvf filebeat-6.2.2-linux-x86_64.tar.gz - name: Rename Directory shell: mv /usr/local/filebeat-6.2.2-linux-x86_64 /usr/local/filebeat - name: Copy Profile copy: src=/usr/local/kafka.yml dest=/usr/local/filebeat/kafka.yml - name: Add rc.local shell: echo 'nohup /usr/local/filebeat/filebeat -e -c /usr/local/filebeat/kafka.yml >/dev/null 2>&1 &' >> /etc/rc.local - name: Start Service shell: nohup /usr/local/filebeat/filebeat -e -c /usr/local/filebeat/kafka.yml >/dev/null 2>&1 &