ansible playbook 安装 node exporter

---
- 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

  

posted @ 2023-01-10 15:21  大川哥  阅读(90)  评论(0编辑  收藏  举报