diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..f343f36 --- /dev/null +++ b/NOTICE @@ -0,0 +1,66 @@ +# Notices for Netdata + +This project is produced and maintained by the Netdata authors. This software incorporates material from third parties. + +## Copyright + +All content is the property of the respective authors or their employers. Every attempt will be made in good faith to track third party code and licences in the Attributions section of this document. + +The software directly provided by this project is released under the Apache License 2.0, which has a Redistribution clause that protects third party code. + +Copies of the licenses that cover all of the included source code are at the bottom of this document for reference. + +If you find code in this repository that you feel violates copyright, be it your copyright or anybody elses, please notify the authors in the first instance, preferably in a non-confrontational way. Like you would communicate with a friend or colleague. We respect the copyrights of others and their license choices, and if we're in error in any way, we want to rectify that immediately. + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. + +## Attributions + +### ansible-role-netdata (Daniel Gibbs) + +Portions of this role are derived from +[dgibbs64/ansible-role-netdata](https://github.com/dgibbs64/ansible-role-netdata), +used under the MIT License. + +- Source: https://github.com/dgibbs64/ansible-role-netdata +- License: MIT (full text under "Third-party licenses" below) +- Copyright (c) 2026 Daniel Gibbs + +Derived material: + +- `tasks/install-redhat.yml` — RedHat-family repository and package setup + +Other files may contain patterns adapted from the same source. This list is +maintained in good faith; if you identify further derived material, please +raise it so it can be credited. + +## Third-party licenses + +### The MIT License (MIT) — dgibbs64/ansible-role-netdata + +Copyright (c) 2026 Daniel Gibbs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml index 0f66404..d8c4ed1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -34,9 +34,16 @@ netdata_claim_token: "" netdata_claim_rooms: "" # Define the Netdata repository URLs and associated key files -netdata_repository_url: "http://repo.netdata.cloud/repos/" -netdata_repoconfig_url: "http://repo.netdata.cloud/repoconfig/" +netdata_repository_url: "https://repo.netdata.cloud/repos/" +netdata_repoconfig_url: "https://repo.netdata.cloud/repoconfig/" netdata_repository_key_url: "https://repo.netdata.cloud/netdatabot.gpg.key" +netdata_repository_old_key_url: "https://repo.netdata.cloud/netdatabot.old.gpg.key" + +# OS families this role installs on +netdata_linux_os_families: + - Debian + - RedHat + - Suse # Define config for enabled Go integrations netdata_go_collector_plugins: [] diff --git a/handlers/main.yml b/handlers/main.yml index 52fdf94..85f1307 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -11,3 +11,9 @@ ansible.builtin.command: netdatacli reload-claiming-state changed_when: true failed_when: false + +- name: "Update dnf cache" + become: true + ansible.builtin.dnf: + update_cache: true +... diff --git a/meta/main.yml b/meta/main.yml index 581d311..c8d24ab 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -23,15 +23,16 @@ galaxy_info: - name: opensuse versions: - all + - name: EL + versions: + - all - 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. + galaxy_tags: + - monitoring + - netdata + - metrics + - observability + - system +# No role dependencies. dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. diff --git a/tasks/install-redhat.yml b/tasks/install-redhat.yml new file mode 100644 index 0000000..1e8d79b --- /dev/null +++ b/tasks/install-redhat.yml @@ -0,0 +1,70 @@ +--- +# Set the EL prefix, used for repo baseurls e.g. +# https://repository.netdata.cloud/repos/stable/el/9/$basearch +# ^^----- This bit right here +- name: "Set netdata_el_repo_distro (Enterprise Linux)" + ansible.builtin.set_fact: + netdata_el_repo_distro: el + +- name: "Set netdata_el_repo_distro (Oracle Linux)" + ansible.builtin.set_fact: + netdata_el_repo_distro: ol + when: ansible_facts['distribution'] == "OracleLinux" + +- name: "Set netdata_el_repo_distro (Fedora)" + ansible.builtin.set_fact: + netdata_el_repo_distro: fedora + when: ansible_facts['distribution'] == "Fedora" + +- name: "Set netdata_el_repo_distro (Amazon Linux)" + ansible.builtin.set_fact: + netdata_el_repo_distro: amazonlinux + when: ansible_facts['distribution'] == "Amazon" + +- name: "Ensure netdata repo keys are present" + ansible.builtin.rpm_key: + state: present + key: "{{ item }}" + loop: + - "{{ netdata_repository_key_url }}" + - "{{ netdata_repository_old_key_url }}" + notify: + - "Update dnf cache" + +- name: "Ensure netdata repository is configured: {{ netdata_release_channel_normalized }}" + ansible.builtin.yum_repository: + baseurl: "{{ netdata_repository_url }}{{ netdata_release_channel_normalized }}/\ + {{ netdata_el_repo_distro }}/\ + {{ ansible_distribution_major_version }}/{{ ansible_architecture }}/" + description: Netdata {{ netdata_release_channel_normalized }} + state: present + enabled: true + file: netdata-{{ netdata_release_channel_normalized }} + gpgcheck: true + gpgkey: + - "{{ netdata_repository_key_url }}" + - "{{ netdata_repository_old_key_url }}" + name: netdata-{{ netdata_release_channel_normalized }} + priority: 50 + repo_gpgcheck: true + sslcacert: /etc/pki/tls/certs/ca-bundle.crt + sslverify: true + notify: + - "Update dnf cache" + +- name: "Ensure netdata is installed" + ansible.builtin.dnf: + name: + - util-linux + - openssl + - netdata + state: present + update_cache: true + +- name: "Install chart support if enabled" + ansible.builtin.dnf: + name: "netdata-plugin-chartsd" + state: present + notify: "Restart Netdata" + when: netdata_manage_charts +... diff --git a/tasks/main.yml b/tasks/main.yml index 6ab1e07..688a29f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,8 +1,13 @@ --- - - name: Gather facts ansible.builtin.setup: +- name: "Assert the platform is supported" + ansible.builtin.assert: + that: ansible_os_family in netdata_linux_os_families + fail_msg: "netdata: unsupported os_family '{{ ansible_os_family }}'" + quiet: true + - name: Normalize release channel (nightly -> edge) ansible.builtin.set_fact: netdata_release_channel_normalized: >- @@ -11,13 +16,18 @@ - name: Install the Netdata Linux agent on Debian/Ubuntu ansible.builtin.include_tasks: install-debian.yml - when: >- - ('debian' in ansible_facts.distribution | lower) or - ('ubuntu' in ansible_facts.distribution | lower) + when: + - ansible_os_family == 'Debian' - name: Install the Netdata Linux agent on OpenSUSE ansible.builtin.include_tasks: install-opensuse.yml - when: "'opensuse' in ansible_facts.distribution | lower" + when: + - "'opensuse' in ansible_facts.distribution | lower" + +- name: Install the Netdata Linux agent on RedHat family distros + ansible.builtin.include_tasks: install-redhat.yml + when: + - ansible_os_family == 'RedHat' - name: Configure the Netdata Linux agent ansible.builtin.include_tasks: configure-linux.yml @@ -29,3 +39,4 @@ - name: Claim node if claim_token ansible.builtin.include_tasks: node_claim.yml when: netdata_claim +...