Skip to content
Snippets Groups Projects
install.yml 1.3 KiB
Newer Older
jurgenhaas's avatar
jurgenhaas committed
---
# file: roles/netdata/tasks/install.yml

- name: Clone NetData
jurgenhaas's avatar
jurgenhaas committed
  git:
    accept_hostkey: yes
jurgenhaas's avatar
jurgenhaas committed
    repo: "https://github.com/netdata/netdata.git"
jurgenhaas's avatar
jurgenhaas committed
    dest: "/opt/netdata"
    force: yes
jurgenhaas's avatar
jurgenhaas committed
    version: '{{ netdata_version }}'
jurgenhaas's avatar
jurgenhaas committed
  register: netdata_clone
  when: netdata_local_archive is not defined
  notify:
    - Restart NetData
- name: Extract NetData Archive
    src: /opt/{{ netdata_local_archive }}.zip
    dest: /opt
jurgenhaas's avatar
jurgenhaas committed
  register: netdata_extract
  when: netdata_local_archive is defined
jurgenhaas's avatar
jurgenhaas committed
  notify:
    - Restart NetData
- name: Install and configure NetData
jurgenhaas's avatar
jurgenhaas committed
  shell: ./netdata-installer.sh --dont-wait
  args:
    chdir: /opt/{{ netdata_local_archive|default('netdata') }}
jurgenhaas's avatar
jurgenhaas committed
  when: netdata_clone.changed or netdata_extract.changed
- name: Install Custom Charts
  template:
    src: '{{ item }}.chart.sh'
    dest: /usr/libexec/netdata/charts.d/{{ item }}.chart.sh
    - fluentd_buffer
    - Restart NetData
- name: Install Custom Alerts
    src: health/{{ item }}.conf
    dest: /etc/netdata/health.d/{{ item }}.conf
    - fluentd_buffer
    - httpcheck
    - Restart NetData
jurgenhaas's avatar
jurgenhaas committed

- name: Register Host in Cloud
  shell: netdata-claim.sh -token={{ netdata_cloud.token }} -rooms={{ netdata_cloud.room }} -url=https://app.netdata.cloud