12345678910111213141516171819202122232425262728293031323334353637383940 |
- ---
- # tasks file for node_exporter
- - name: Download and unpack node_exporter
- unarchive:
- src: "{{ node_exporter_download_url }}"
- dest: /tmp
- remote_src: True
- - name: Copy node_exporter to /usr/local/bin
- copy:
- remote_src: True
- src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}/node_exporter"
- dest: /usr/local/bin
- mode: 0744
- notify: Restart node_exporter
- - name: Ensure systemd service is up to date
- register: node_exporter_systemd
- template:
- src: node_exporter.service.j2
- dest: /etc/systemd/system/node_exporter.service
- notify: Restart node_exporter
- - name: Reload systemd
- when: node_exporter_systemd|changed
- shell: systemctl daemon-reload
- - name: Ensure node_exporter is running and enabled
- service:
- name: node_exporter
- state: running
- enabled: yes
- - name: Ensure node_exporter nginx config is up to date
- template:
- src: node_exporter_nginx.j2
- dest: "/etc/nginx/site-include/{{ ansible_fqdn }}/node_exporter.conf"
- notify: Reload nginx
|