--- - name: Unpack Promtail binary unarchive: src: https://github.com/grafana/loki/releases/download/v2.2.1/promtail-freebsd-amd64.zip dest: /usr/local/bin/ remote_src: yes when: ansible_distribution == 'FreeBSD' - name: Rename Promtail binary command: mv /usr/local/bin/promtail-freebsd-amd64 /usr/local/bin/promtail when: ansible_distribution == 'FreeBSD' - name: Unpack Promtail binary unarchive: src: https://github.com/grafana/loki/releases/download/v2.2.1/promtail-linux-amd64.zip dest: /usr/local/bin/ remote_src: yes become: true when: ansible_distribution == 'Ubuntu' - name: Rename Promtail binary command: mv /usr/local/bin/promtail-linux-amd64 /usr/local/bin/promtail become: true when: ansible_distribution == 'Ubuntu' - name: Promtail config file installed template: src: promtail.varlogs.config.yml.j2 dest: /usr/local/etc/promtail.config.yml owner: root mode: 0644 notify: Promtail restarted when: ansible_distribution == 'FreeBSD' - name: Promtail rc file installed copy: src: promtail.rc dest: /usr/local/etc/rc.d/promtail owner: root mode: 0644 notify: Promtail restarted when: ansible_distribution == 'FreeBSD' - name: Promtail config file installed template: src: promtail.journal.config.yml.j2 dest: /etc/promtail.config.yml owner: root mode: 0644 notify: Promtail restarted when: ansible_distribution == 'Ubuntu' - name: Promtail systemd service file installed copy: src: promtail.service dest: /etc/systemd/system/promtail.service owner: root mode: 0644 become: true when: ansible_distribution == 'Ubuntu'