You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

  1. ---
  2. - name: Create prometheus user and group
  3. import_tasks: prometheus_user.yml
  4. - name: Download node_exporter from GitHub
  5. get_url:
  6. dest: /tmp/prometheus_node_exporter.tar.gz
  7. url: https://github.com/prometheus/node_exporter/releases/download/v0.13.0/node_exporter-0.13.0.linux-amd64.tar.gz
  8. checksum: sha256:2de5d1e51330c41588ed4c88bc531a3d2dccf6b4d7b99d5782d95cff27a3c049
  9. - name: Create node_exporter directory
  10. file:
  11. path: /opt/prometheus_node_exporter
  12. state: directory
  13. owner: prometheus
  14. group: prometheus
  15. mode: 0755
  16. - name: Extract node_exporter
  17. unarchive:
  18. remote_src: true
  19. src: /tmp/prometheus_node_exporter.tar.gz
  20. dest: /opt/prometheus_node_exporter
  21. owner: prometheus
  22. group: prometheus
  23. extra_opts:
  24. - --strip-components=1
  25. creates: /opt/prometheus_node_exporter/node_exporter
  26. - name: Create node_exporter service file
  27. copy:
  28. src: prometheus_node_exporter.service
  29. dest: /etc/systemd/system/prometheus_node_exporter.service
  30. owner: root
  31. group: root
  32. mode: 0644
  33. - name: Start and enable node_exporter service
  34. service:
  35. name: prometheus_node_exporter
  36. state: started
  37. enabled: true