main.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. - name: Unpack Promtail binary
  3. unarchive:
  4. src: https://github.com/grafana/loki/releases/download/v2.2.1/promtail-freebsd-amd64.zip
  5. dest: /usr/local/bin/
  6. remote_src: yes
  7. when: ansible_distribution == 'FreeBSD'
  8. - name: Rename Promtail binary
  9. command: mv /usr/local/bin/promtail-freebsd-amd64 /usr/local/bin/promtail
  10. when: ansible_distribution == 'FreeBSD'
  11. - name: Unpack Promtail binary
  12. unarchive:
  13. src: https://github.com/grafana/loki/releases/download/v2.2.1/promtail-linux-amd64.zip
  14. dest: /usr/local/bin/
  15. remote_src: yes
  16. become: true
  17. when: ansible_distribution == 'Ubuntu'
  18. - name: Rename Promtail binary
  19. command: mv /usr/local/bin/promtail-linux-amd64 /usr/local/bin/promtail
  20. become: true
  21. when: ansible_distribution == 'Ubuntu'
  22. - name: Promtail config file installed
  23. template:
  24. src: promtail.varlogs.config.yml.j2
  25. dest: /usr/local/etc/promtail.config.yml
  26. owner: root
  27. mode: 0644
  28. notify: Promtail restarted
  29. when: ansible_distribution == 'FreeBSD'
  30. - name: Promtail rc file installed
  31. copy:
  32. src: promtail.rc
  33. dest: /usr/local/etc/rc.d/promtail
  34. owner: root
  35. mode: 0644
  36. notify: Promtail restarted
  37. when: ansible_distribution == 'FreeBSD'
  38. - name: Promtail config file installed
  39. template:
  40. src: promtail.journal.config.yml.j2
  41. dest: /etc/promtail.config.yml
  42. owner: root
  43. mode: 0644
  44. notify: Promtail restarted
  45. when: ansible_distribution == 'Ubuntu'
  46. - name: Promtail systemd service file installed
  47. copy:
  48. src: promtail.service
  49. dest: /etc/systemd/system/promtail.service
  50. owner: root
  51. mode: 0644
  52. become: true
  53. when: ansible_distribution == 'Ubuntu'