--- /dev/null
+---
+# Based on ansible-lint config
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ colons:
+ max-spaces-after: -1
+ level: error
+ commas:
+ max-spaces-after: -1
+ level: error
+ comments: disable
+ comments-indentation: disable
+ document-start: disable
+ empty-lines:
+ max: 3
+ level: error
+ hyphens:
+ level: error
+ indentation: disable
+ key-duplicates: enable
+ line-length: disable
+ new-line-at-end-of-file: disable
+ new-lines:
+ type: unix
+ trailing-spaces: disable
+ truthy: disable
--- /dev/null
+Netdata\_straight
+=========
+
+A pretty straightforward role to install netdata using curl | bash install
+
+Requirements
+------------
+
+None
+
+Role Variables
+--------------
+
+See [defaults/main.yml]
+
+Dependencies
+------------
+
+None
+
+Example Playbook
+----------------
+
+```
+ - hosts: servers
+ roles:
+ - { role: ansible_straight, netdata_installer: kickstart-static64 }
+```
+
+License
+-------
+
+BSD
+
+Author Information
+------------------
+
+Fretlink
--- /dev/null
+---
+# Force installation even if netdata is already installed
+netdata_force_install: false
+netdata_installer: kickstart
+netdata_install_options: "--disable-telemetry"
+netdata_uninstall_before: no
+netdata_prefix: "{{ (netdata_installer == 'kickstart') | ternary('','/opt/netdata') }}"
+# A dict whcih reflect the wanted netdata.conf file
+netdata_config:
+ global:
+ history: 3996
+
+ web:
+ "listen to": 127.0.0.1
+
+# Define streaming configuration
+#netdata_streaming_configuration: {}
+netdata_streaming_configuration:
+ upstream:
+ destination: collector.example.com
+ "api key": XXXXXXX
+ downstreams:
+ - name: main
+ api_key: XXXXXXY
+
+# Define alarm notify configuration
+netdata_alarm_notify_configs: {}
+# Define a custom_sender function to be used in alarm configuration
+netdata_custom_sender_function: ""
--- /dev/null
+---
+# handlers file for netdata-straight
+- name: restart netdata
+ service:
+ name: netdata
+ state: restarted
--- /dev/null
+galaxy_info:
+ role_name: netdata_straight
+ author: fretlink
+ description: A role to install netdata using kickstart installer
+ company: Fretlink
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Choose a valid license ID from https://spdx.org - some suggested licenses:
+ # - BSD-3-Clause (default)
+ # - MIT
+ # - GPL-2.0-or-later
+ # - GPL-3.0-only
+ # - Apache-2.0
+ # - CC-BY-4.0
+ license: BSD-3-Clause
+
+ min_ansible_version: 2.8
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ #
+ # Provide a list of supported platforms, and for each platform a list of versions.
+ # If you don't wish to enumerate all versions for a particular platform, use 'all'.
+ # To view available platforms and versions (or releases), visit:
+ # https://galaxy.ansible.com/api/v1/platforms/
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+ platforms:
+ - name: Ubuntu
+ versions:
+ - 18.04
+ - 20.04
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+ # List your role dependencies here, one per line. Be sure to remove the '[]' above,
+ # if you add dependencies to this list.
--- /dev/null
+*******
+Delegated driver installation guide
+*******
+
+Requirements
+============
+
+This driver is delegated to the developer. Up to the developer to implement
+requirements.
+
+Install
+=======
+
+This driver is delegated to the developer. Up to the developer to implement
+requirements.
--- /dev/null
+---
+- name: Converge
+ hosts: all
+ tasks:
+ - name: "Include netdata-straight"
+ include_role:
+ name: "netdata_straight"
--- /dev/null
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint: |
+ set -e
+ yamllint .
+ ansible-lint
+ flake8
+platforms:
+ - name: instance
+ image: jrei/systemd-${MOLECULE_OS:-ubuntu:20.04}
+ privileged: true
+ command: /lib/systemd/systemd
+ tmpfs:
+ - /run
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:ro
+provisioner:
+ name: ansible
+ inventory:
+ host_vars:
+ instance:
+ netdata_installer: ${MOLECULE_NETDATA_INSTALLER:-kickstart}
+verifier:
+ name: ansible
--- /dev/null
+- name: Prepare
+ hosts: all
+ tasks:
+ - name: Update apt cache
+ apt:
+ update_cache: yes
+ become: true
+ when: ansible_os_family == 'Debian'
--- /dev/null
+---
+# This is an example playbook to execute Ansible tests.
+
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Example assertion
+ assert:
+ that: true
--- /dev/null
+---
+- name: Install requirements (Debian family)
+ apt:
+ name: curl
+ state: present
+ when: ansible_os_family == 'Debian'
+
+- name: Install requirements (Redhat family)
+ yum:
+ name: curl
+ state: present
+ when: ansible_os_family == 'RedHat'
+
+- name: Check if netdata is installed
+ command: "{{ prefix }}netdata -V"
+ ignore_errors: true
+ register: netdata_installed_st
+ changed_when: false
+ vars:
+ prefix: "{{ netdata_prefix | ternary(netdata_prefix~'/bin/', '') }}"
+
+- name: Uninstall netdata
+ include: uninstall.yml
+ when:
+ - netdata_uninstall_before is defined
+ - netdata_uninstall_before | bool
+
+- name: Install netdata
+ shell:
+ cmd: bash <(curl -Ss https://my-netdata.io/{{ netdata_installer }}.sh) --dont-wait {{ netdata_install_options }}
+ args:
+ executable: /bin/bash
+ when:
+ - netdata_installed_st is failed or netdata_force_install or netdata_uninstall_before
+
+- name: Configure netdata
+ template:
+ src: netdata.conf.j2
+ dest: "{{ netdata_prefix }}/etc/netdata/netdata.conf"
+ owner: root
+ group: root
+ mode: 0644
+ notify: restart netdata
+
+- name: Configure streaming
+ template:
+ src: stream.conf.j2
+ dest: "{{ netdata_prefix }}/etc/netdata/stream.conf"
+ owner: root
+ group: netdata
+ mode: 0640
+ when:
+ - netdata_streaming_configuration is defined
+ - netdata_streaming_configuration | count > 0
+ notify: restart netdata
+
+- name: Configure netdata alarm notifications
+ template:
+ dest: "{{ netdata_prefix }}/etc/netdata/health_alarm_notify.conf"
+ src: "health_alarm_notify.conf.j2"
+ owner: netdata
+ group: root
+ mode: 0640
+ when:
+ - netdata_alarm_notify_configs is defined
+ - netdata_alarm_notify_configs | count > 0
+ notify: restart netdata
--- /dev/null
+- name: Check uninstaller presence
+ stat:
+ path: "{{ item }}/netdata-uninstaller.sh"
+ loop:
+ - /usr/libexec/netdata
+ - /opt/netdata/usr/libexec/netdata
+ register: uninstaller_presence
+
+- name: Uninstall
+ command: "{{ item }} --yes --force" # noqa 301
+ loop: "{{ uninstallers }}"
+ vars:
+ uninstallers: "{{ uninstaller_presence.results | selectattr('stat.exists') | map(attribute='invocation.module_args.path') | list }}"
--- /dev/null
+{% for key in netdata_alarm_notify_configs %}
+{{ key }}="{{ netdata_alarm_notify_configs[key] }}"
+{% endfor %}
+
+{% if netdata_custom_sender_function is defined %}
+custom_sender() {
+{{ netdata_custom_sender_function }}
+}
+{% endif %}
--- /dev/null
+{% for (section,configuration) in netdata_config | dictsort %}
+[{{ section }}]
+{% for (key,value) in configuration | dictsort %}
+ {{ key }} = {{ value }}
+{% endfor %}
+{% endfor %}
--- /dev/null
+{% if netdata_streaming_configuration.upstream is defined %}
+[stream]
+ enabled = yes
+ destination = {{ netdata_streaming_configuration.upstream["destination"] }}
+ api key = {{ netdata_streaming_configuration.upstream["api key"] }}
+{% endif %}
+{% if netdata_streaming_configuration.downstreams is defined %}
+{% for downstream in netdata_streaming_configuration.downstreams %}
+[{{ downstream.api_key }}]
+ enabled = yes
+{% for (key,value) in downstream | dictsort if not key in ['name','api_key'] %}
+ {{ key }} = {{ value }}
+{% endfor %}
+{% endfor %}
+{% endif %}
--- /dev/null
+localhost
+
--- /dev/null
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - netdata-straight
\ No newline at end of file
--- /dev/null
+---
+# vars file for netdata-straight
\ No newline at end of file