---
- name: install node-exporter conf
hosts: lichuan
gather_facts: false
ignore_errors: yes
tasks:
- name: copy node-exporter.tgz
copy: src=/root/node_exporter/node_exporter-1.3.1.linux-amd64.tar.gz dest=/usr/local/src/ owner=root group=root mode=0644
- name: install node-exporter
shell: tar -zxvf /usr/local/src/node_exporter-1.3.1.linux-amd64.tar.gz -C /usr/local/
- name: start node-exporter
shell: nohup /usr/local/node_exporter-1.3.1.linux-amd64/node_exporter &> /var/log/node_exporter.log &
- name: start noboot
shell: echo 'nohup /usr/local/node_exporter-1.3.1.linux-amd64/node_exporter &> /var/log/node_exporter.log &' >> /etc/rc.local && chmod +x /etc/rc.local