- name: "copy telegraf.rpm to destination server" copy: src: "{{ role_path }}/files/telegraf-1.13.0-1.x86_64.rpm" dest: /tmp - name: "install telegraf" yum: name: - /tmp/telegraf-1.13.0-1.x86_64.rpm state: present - name: "Templates telegraf.conf" template: src: "{{role_path}}/templates/telegraf_statistic.conf.j2" dest: /etc/telegraf/telegraf_statistic.conf tags: template - name: "copy telegraf_statistic.service to destination server" copy: src: "{{ role_path }}/files/telegraf_statistic.service" dest: /usr/lib/systemd/system mode: 0644 - name: "Start telegraf" systemd: name: telegraf_statistic.service state: started enabled: yes daemon_reload: yes