--- - name: Download the promtail archive get_url: url: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail-linux-amd64.zip" dest: "/tmp/promtail.zip" - name: Extract promtail unarchive: src: "/tmp/promtail.zip" dest: "/tmp" remote_src: yes - name: Move promtail binary copy: src: "/tmp/promtail-linux-amd64" dest: "/usr/local/bin/promtail" remote_src: yes mode: '0755' - name: Create promtail service template: src: "promtail.service.j2" dest: "/etc/systemd/system/promtail.service" mode: '0644' tags: - create_promtail_service - name: Reload systemd to pick up the promtail service systemd: daemon_reload: yes tags: - reload_systemd - name: Enable and start the promtail service systemd: name: promtail state: started enabled: yes tags: - start_promtail - name: Create promtail configuration file directory file: path: /etc/promtail state: directory mode: '0755' - name: Create promtail configuration file template: src: promtail.yml.j2 dest: /etc/promtail/config.yml