From cc17d7f254b15f1a8c9e89ffadc8ea5b24f9344b Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 9 Dec 2024 12:45:47 -0600 Subject: [PATCH 01/26] Add .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549d29c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode +hosts +ansible.cfg +test.yml From 95b65bb2e91953bb950b4886a735a43dcb03f8f7 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 9 Dec 2024 13:03:42 -0600 Subject: [PATCH 02/26] Initial rewrite commit --- .github/CODEOWNERS | 3 +- README.md | 18 +--- ansible.cfg | 10 -- claim.yml | 8 -- defaults/main.yml | 19 ++++ group_vars/all | 5 - host_vars/centos7 | 2 - hosts | 27 +----- meta/main.yml | 6 ++ molecule/README.md | 92 ------------------- molecule/common/Dockerfile_debian10.j2 | 4 - molecule/common/Dockerfile_debian11.j2 | 4 - molecule/common/Dockerfile_ubuntu1804.j2 | 17 ---- molecule/common/Dockerfile_ubuntu2004.j2 | 17 ---- molecule/common/Dockerfile_ubuntu2204.j2 | 18 ---- molecule/default/converge.yml | 7 -- molecule/default/molecule.yml | 61 ------------ molecule/default/verify.yml | 10 -- netdata-agent.yml | 23 ----- netdata.yml | 12 +++ purge.yml | 8 -- roles/claim/README.md | 38 -------- roles/claim/defaults/main.yml | 2 - roles/claim/handlers/main.yml | 7 -- roles/claim/meta/main.yml | 41 --------- roles/claim/tasks/main.yml | 29 ------ roles/claim/tests/inventory | 2 - roles/claim/tests/test.yml | 6 -- roles/claim/vars/Centos7.yml | 3 - roles/claim/vars/Debian11.yml | 3 - roles/claim/vars/Fedora35.yml | 3 - roles/claim/vars/OracleLinux8.yml | 3 - roles/claim/vars/Rocky8.yml | 3 - roles/claim/vars/main.yml | 6 -- roles/install_netdata_agent/README.md | 38 -------- roles/install_netdata_agent/defaults/main.yml | 14 --- roles/install_netdata_agent/handlers/main.yml | 7 -- roles/install_netdata_agent/meta/main.yml | 41 --------- roles/install_netdata_agent/tasks/Alpine3.yml | 1 - roles/install_netdata_agent/tasks/Centos7.yml | 42 --------- .../install_netdata_agent/tasks/Debian10.yml | 20 ---- .../install_netdata_agent/tasks/Debian11.yml | 19 ---- .../install_netdata_agent/tasks/Fedora35.yml | 25 ----- .../tasks/OracleLinux8.yml | 38 -------- roles/install_netdata_agent/tasks/Rocky8.yml | 37 -------- .../install_netdata_agent/tasks/Ubuntu18.yml | 13 --- .../install_netdata_agent/tasks/Ubuntu20.yml | 13 --- .../install_netdata_agent/tasks/Ubuntu22.yml | 13 --- roles/install_netdata_agent/tasks/main.yml | 11 --- .../templates/netdata.conf.j2 | 16 ---- roles/install_netdata_agent/tests/inventory | 1 - roles/install_netdata_agent/tests/test.yml | 6 -- roles/install_netdata_agent/vars/Alpine3.yml | 1 - roles/install_netdata_agent/vars/Centos7.yml | 4 - roles/install_netdata_agent/vars/Debian10.yml | 7 -- roles/install_netdata_agent/vars/Debian11.yml | 7 -- roles/install_netdata_agent/vars/Fedora35.yml | 4 - .../vars/OracleLinux8.yml | 4 - roles/install_netdata_agent/vars/Rocky8.yml | 4 - roles/install_netdata_agent/vars/Ubuntu18.yml | 4 - roles/install_netdata_agent/vars/Ubuntu20.yml | 4 - roles/install_netdata_agent/vars/Ubuntu22.yml | 4 - roles/install_netdata_agent/vars/main.yml | 2 - roles/install_netdata_agent/vars/x86_64.yml | 3 - roles/install_netdata_repository/README.md | 38 -------- .../defaults/main.yml | 16 ---- .../handlers/main.yml | 2 - .../install_netdata_repository/meta/main.yml | 43 --------- .../tasks/CentOS7.yml | 23 ----- .../tasks/Debian10.yml | 19 ---- .../tasks/Debian11.yml | 10 -- .../tasks/Fedora35.yml | 25 ----- .../tasks/OracleLinux8.yml | 25 ----- .../tasks/Rocky8.yml | 25 ----- .../tasks/Ubuntu18.yml | 19 ---- .../tasks/Ubuntu20.yml | 10 -- .../tasks/Ubuntu22.yml | 10 -- .../install_netdata_repository/tasks/main.yml | 7 -- .../tests/inventory | 2 - .../install_netdata_repository/tests/test.yml | 6 -- .../vars/Debian10.yml | 3 - .../vars/Debian11.yml | 3 - .../vars/Fedora35.yml | 1 - .../vars/OracleLinux8.yml | 1 - .../vars/Rocky8.yml | 1 - .../vars/Ubuntu18.yml | 3 - .../vars/Ubuntu20.yml | 3 - .../vars/Ubuntu22.yml | 3 - .../install_netdata_repository/vars/main.yml | 2 - roles/purge_netdata_agent/.travis.yml | 29 ------ roles/purge_netdata_agent/README.md | 38 -------- roles/purge_netdata_agent/defaults/main.yml | 2 - roles/purge_netdata_agent/handlers/main.yml | 2 - roles/purge_netdata_agent/meta/main.yml | 41 --------- roles/purge_netdata_agent/tasks/Centos7.yml | 17 ---- roles/purge_netdata_agent/tasks/Debian10.yml | 7 -- roles/purge_netdata_agent/tasks/Debian11.yml | 7 -- roles/purge_netdata_agent/tasks/Fedora35.yml | 19 ---- .../tasks/OracleLinux8.yml | 19 ---- roles/purge_netdata_agent/tasks/Rocky8.yml | 19 ---- roles/purge_netdata_agent/tasks/Ubuntu18.yml | 8 -- roles/purge_netdata_agent/tasks/Ubuntu20.yml | 8 -- roles/purge_netdata_agent/tasks/Ubuntu22.yml | 8 -- roles/purge_netdata_agent/tasks/main.yml | 8 -- roles/purge_netdata_agent/tests/inventory | 2 - roles/purge_netdata_agent/tests/test.yml | 7 -- roles/purge_netdata_agent/vars/Centos7.yml | 6 -- roles/purge_netdata_agent/vars/Debian10.yml | 1 - roles/purge_netdata_agent/vars/Debian11.yml | 1 - roles/purge_netdata_agent/vars/Fedora35.yml | 6 -- .../purge_netdata_agent/vars/OracleLinux8.yml | 6 -- roles/purge_netdata_agent/vars/Rocky8.yml | 6 -- roles/purge_netdata_agent/vars/Ubuntu18.yml | 1 - roles/purge_netdata_agent/vars/Ubuntu20.yml | 1 - roles/purge_netdata_agent/vars/Ubuntu22.yml | 1 - roles/purge_netdata_agent/vars/main.yml | 2 - roles/purge_netdata_repository/.travis.yml | 29 ------ roles/purge_netdata_repository/README.md | 38 -------- .../defaults/main.yml | 2 - .../handlers/main.yml | 12 --- roles/purge_netdata_repository/meta/main.yml | 41 --------- .../tasks/Centos7.yml | 10 -- .../tasks/Debian10.yml | 25 ----- .../tasks/Debian11.yml | 25 ----- .../tasks/Fedora35.yml | 20 ---- .../tasks/OracleLinux8.yml | 19 ---- .../purge_netdata_repository/tasks/Rocky8.yml | 20 ---- .../tasks/Ubuntu18.yml | 24 ----- .../tasks/Ubuntu20.yml | 24 ----- .../tasks/Ubuntu22.yml | 24 ----- roles/purge_netdata_repository/tasks/main.yml | 9 -- .../purge_netdata_repository/tests/inventory | 2 - roles/purge_netdata_repository/tests/test.yml | 7 -- .../purge_netdata_repository/vars/Centos7.yml | 3 - .../vars/Debian10.yml | 7 -- .../vars/Debian11.yml | 7 -- .../vars/Fedora35.yml | 5 - .../vars/OracleLinux8.yml | 5 - .../purge_netdata_repository/vars/Rocky8.yml | 5 - .../vars/Ubuntu18.yml | 7 -- .../vars/Ubuntu20.yml | 7 -- .../vars/Ubuntu22.yml | 7 -- roles/purge_netdata_repository/vars/main.yml | 2 - .../linux/linux-config.yml | 0 tasks/linux/pkg-debian.yml | 23 +++++ tasks/linux/pkg-suse.yml | 17 ++++ 146 files changed, 86 insertions(+), 1832 deletions(-) delete mode 100644 ansible.cfg delete mode 100644 claim.yml create mode 100644 defaults/main.yml delete mode 100644 group_vars/all delete mode 100644 host_vars/centos7 create mode 100644 meta/main.yml delete mode 100644 molecule/README.md delete mode 100644 molecule/common/Dockerfile_debian10.j2 delete mode 100644 molecule/common/Dockerfile_debian11.j2 delete mode 100644 molecule/common/Dockerfile_ubuntu1804.j2 delete mode 100644 molecule/common/Dockerfile_ubuntu2004.j2 delete mode 100644 molecule/common/Dockerfile_ubuntu2204.j2 delete mode 100644 molecule/default/converge.yml delete mode 100644 molecule/default/molecule.yml delete mode 100644 molecule/default/verify.yml delete mode 100644 netdata-agent.yml create mode 100644 netdata.yml delete mode 100644 purge.yml delete mode 100644 roles/claim/README.md delete mode 100644 roles/claim/defaults/main.yml delete mode 100644 roles/claim/handlers/main.yml delete mode 100644 roles/claim/meta/main.yml delete mode 100644 roles/claim/tasks/main.yml delete mode 100644 roles/claim/tests/inventory delete mode 100644 roles/claim/tests/test.yml delete mode 100644 roles/claim/vars/Centos7.yml delete mode 100644 roles/claim/vars/Debian11.yml delete mode 100644 roles/claim/vars/Fedora35.yml delete mode 100644 roles/claim/vars/OracleLinux8.yml delete mode 100644 roles/claim/vars/Rocky8.yml delete mode 100644 roles/claim/vars/main.yml delete mode 100644 roles/install_netdata_agent/README.md delete mode 100644 roles/install_netdata_agent/defaults/main.yml delete mode 100644 roles/install_netdata_agent/handlers/main.yml delete mode 100644 roles/install_netdata_agent/meta/main.yml delete mode 100644 roles/install_netdata_agent/tasks/Alpine3.yml delete mode 100644 roles/install_netdata_agent/tasks/Centos7.yml delete mode 100644 roles/install_netdata_agent/tasks/Debian10.yml delete mode 100644 roles/install_netdata_agent/tasks/Debian11.yml delete mode 100644 roles/install_netdata_agent/tasks/Fedora35.yml delete mode 100644 roles/install_netdata_agent/tasks/OracleLinux8.yml delete mode 100644 roles/install_netdata_agent/tasks/Rocky8.yml delete mode 100644 roles/install_netdata_agent/tasks/Ubuntu18.yml delete mode 100644 roles/install_netdata_agent/tasks/Ubuntu20.yml delete mode 100644 roles/install_netdata_agent/tasks/Ubuntu22.yml delete mode 100644 roles/install_netdata_agent/tasks/main.yml delete mode 100644 roles/install_netdata_agent/templates/netdata.conf.j2 delete mode 100644 roles/install_netdata_agent/tests/inventory delete mode 100644 roles/install_netdata_agent/tests/test.yml delete mode 100644 roles/install_netdata_agent/vars/Alpine3.yml delete mode 100644 roles/install_netdata_agent/vars/Centos7.yml delete mode 100644 roles/install_netdata_agent/vars/Debian10.yml delete mode 100644 roles/install_netdata_agent/vars/Debian11.yml delete mode 100644 roles/install_netdata_agent/vars/Fedora35.yml delete mode 100644 roles/install_netdata_agent/vars/OracleLinux8.yml delete mode 100644 roles/install_netdata_agent/vars/Rocky8.yml delete mode 100644 roles/install_netdata_agent/vars/Ubuntu18.yml delete mode 100644 roles/install_netdata_agent/vars/Ubuntu20.yml delete mode 100644 roles/install_netdata_agent/vars/Ubuntu22.yml delete mode 100644 roles/install_netdata_agent/vars/main.yml delete mode 100644 roles/install_netdata_agent/vars/x86_64.yml delete mode 100644 roles/install_netdata_repository/README.md delete mode 100644 roles/install_netdata_repository/defaults/main.yml delete mode 100644 roles/install_netdata_repository/handlers/main.yml delete mode 100644 roles/install_netdata_repository/meta/main.yml delete mode 100644 roles/install_netdata_repository/tasks/CentOS7.yml delete mode 100644 roles/install_netdata_repository/tasks/Debian10.yml delete mode 100644 roles/install_netdata_repository/tasks/Debian11.yml delete mode 100644 roles/install_netdata_repository/tasks/Fedora35.yml delete mode 100644 roles/install_netdata_repository/tasks/OracleLinux8.yml delete mode 100644 roles/install_netdata_repository/tasks/Rocky8.yml delete mode 100644 roles/install_netdata_repository/tasks/Ubuntu18.yml delete mode 100644 roles/install_netdata_repository/tasks/Ubuntu20.yml delete mode 100644 roles/install_netdata_repository/tasks/Ubuntu22.yml delete mode 100644 roles/install_netdata_repository/tasks/main.yml delete mode 100644 roles/install_netdata_repository/tests/inventory delete mode 100644 roles/install_netdata_repository/tests/test.yml delete mode 100644 roles/install_netdata_repository/vars/Debian10.yml delete mode 100644 roles/install_netdata_repository/vars/Debian11.yml delete mode 100644 roles/install_netdata_repository/vars/Fedora35.yml delete mode 100644 roles/install_netdata_repository/vars/OracleLinux8.yml delete mode 100644 roles/install_netdata_repository/vars/Rocky8.yml delete mode 100644 roles/install_netdata_repository/vars/Ubuntu18.yml delete mode 100644 roles/install_netdata_repository/vars/Ubuntu20.yml delete mode 100644 roles/install_netdata_repository/vars/Ubuntu22.yml delete mode 100644 roles/install_netdata_repository/vars/main.yml delete mode 100644 roles/purge_netdata_agent/.travis.yml delete mode 100644 roles/purge_netdata_agent/README.md delete mode 100644 roles/purge_netdata_agent/defaults/main.yml delete mode 100644 roles/purge_netdata_agent/handlers/main.yml delete mode 100644 roles/purge_netdata_agent/meta/main.yml delete mode 100644 roles/purge_netdata_agent/tasks/Centos7.yml delete mode 100644 roles/purge_netdata_agent/tasks/Debian10.yml delete mode 100644 roles/purge_netdata_agent/tasks/Debian11.yml delete mode 100644 roles/purge_netdata_agent/tasks/Fedora35.yml delete mode 100644 roles/purge_netdata_agent/tasks/OracleLinux8.yml delete mode 100644 roles/purge_netdata_agent/tasks/Rocky8.yml delete mode 100644 roles/purge_netdata_agent/tasks/Ubuntu18.yml delete mode 100644 roles/purge_netdata_agent/tasks/Ubuntu20.yml delete mode 100644 roles/purge_netdata_agent/tasks/Ubuntu22.yml delete mode 100644 roles/purge_netdata_agent/tasks/main.yml delete mode 100644 roles/purge_netdata_agent/tests/inventory delete mode 100644 roles/purge_netdata_agent/tests/test.yml delete mode 100644 roles/purge_netdata_agent/vars/Centos7.yml delete mode 100644 roles/purge_netdata_agent/vars/Debian10.yml delete mode 100644 roles/purge_netdata_agent/vars/Debian11.yml delete mode 100644 roles/purge_netdata_agent/vars/Fedora35.yml delete mode 100644 roles/purge_netdata_agent/vars/OracleLinux8.yml delete mode 100644 roles/purge_netdata_agent/vars/Rocky8.yml delete mode 100644 roles/purge_netdata_agent/vars/Ubuntu18.yml delete mode 100644 roles/purge_netdata_agent/vars/Ubuntu20.yml delete mode 100644 roles/purge_netdata_agent/vars/Ubuntu22.yml delete mode 100644 roles/purge_netdata_agent/vars/main.yml delete mode 100644 roles/purge_netdata_repository/.travis.yml delete mode 100644 roles/purge_netdata_repository/README.md delete mode 100644 roles/purge_netdata_repository/defaults/main.yml delete mode 100644 roles/purge_netdata_repository/handlers/main.yml delete mode 100644 roles/purge_netdata_repository/meta/main.yml delete mode 100644 roles/purge_netdata_repository/tasks/Centos7.yml delete mode 100644 roles/purge_netdata_repository/tasks/Debian10.yml delete mode 100644 roles/purge_netdata_repository/tasks/Debian11.yml delete mode 100644 roles/purge_netdata_repository/tasks/Fedora35.yml delete mode 100644 roles/purge_netdata_repository/tasks/OracleLinux8.yml delete mode 100644 roles/purge_netdata_repository/tasks/Rocky8.yml delete mode 100644 roles/purge_netdata_repository/tasks/Ubuntu18.yml delete mode 100644 roles/purge_netdata_repository/tasks/Ubuntu20.yml delete mode 100644 roles/purge_netdata_repository/tasks/Ubuntu22.yml delete mode 100644 roles/purge_netdata_repository/tasks/main.yml delete mode 100644 roles/purge_netdata_repository/tests/inventory delete mode 100644 roles/purge_netdata_repository/tests/test.yml delete mode 100644 roles/purge_netdata_repository/vars/Centos7.yml delete mode 100644 roles/purge_netdata_repository/vars/Debian10.yml delete mode 100644 roles/purge_netdata_repository/vars/Debian11.yml delete mode 100644 roles/purge_netdata_repository/vars/Fedora35.yml delete mode 100644 roles/purge_netdata_repository/vars/OracleLinux8.yml delete mode 100644 roles/purge_netdata_repository/vars/Rocky8.yml delete mode 100644 roles/purge_netdata_repository/vars/Ubuntu18.yml delete mode 100644 roles/purge_netdata_repository/vars/Ubuntu20.yml delete mode 100644 roles/purge_netdata_repository/vars/Ubuntu22.yml delete mode 100644 roles/purge_netdata_repository/vars/main.yml rename roles/install_netdata_repository/vars/CentOS7.yml => tasks/linux/linux-config.yml (100%) create mode 100644 tasks/linux/pkg-debian.yml create mode 100644 tasks/linux/pkg-suse.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 48b00e2..4f00793 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,3 @@ -# For the time being, @Ferroin is responsible for everything here. +# For the time being, @Ferroin is responsible for everything here + * @netdata/agent-sre diff --git a/README.md b/README.md index 0e75fbb..254dcdc 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,13 @@ -# Example of basic Netdata agent management using Ansible -## Prerequisites -Tested with Ansible v. 2.12.1; should work with any Ansible version since 2.9 +# Netdata Ansible -You have to edit the inventory file `hosts` and, perhaps, `ansible.cfg`. -It is likely that you will also want to edit netdata agent configuration file(s). - -Requires jmespath installed on the host system ## Tested on -`Centos 7, Rocky 8, Oracle Linux 8, Fedora 35` -`Debian 10, Debian 11, Ubuntu 18, Ubuntu 20, Ubuntu22` +- Debian 12 +- OpenSUSE 15.6 + +## Roles -## Playbook components, a short description -> netdata-agent.yml: -Installs Netdata Packagecloud repository whenever possible. -Installs Netdata agent latest available version, trying to avoid installation from other repositories. By default, the 'edge' is used. You can change the default in group_vars/all or set it in the command line using external variable: `ansible-playbook -e "distro=stable" netdata-agent.yml` diff --git a/ansible.cfg b/ansible.cfg deleted file mode 100644 index e31dbc4..0000000 --- a/ansible.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[defaults] -inventory = ./hosts -gathering = smart -ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} -display_skipped_hosts = False -fact_caching = yaml -fact_caching_timeout = 86400 -fact_caching_connection = /tmp/facts_cache -[ssh_connection] -ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s diff --git a/claim.yml b/claim.yml deleted file mode 100644 index 2432356..0000000 --- a/claim.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Claim netdata node - hosts: all - remote_user: "{{ansible_user}}" - gather_facts: true - become: true - - roles: - - role: claim diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..994e97e --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,19 @@ +--- +role_version: 0.0.1 + +# Define the Netdata release version we install +netdata_release_version: "stable" + +# Define if we manage the Netdata configuration +netdata_manage_config: true + +# By default, don't claim the node on Netdata Cloud +netdata_claim_node: false + +# Allow for injecting a claim token if using Netdata Cloud +netdata_claim_url: "https://app.netdata.cloud" +netdata_claim_token: "" + +# Define the Netdata repository URLs + +netdata_repository_url: "https://repo.netdata.cloud/repos/" diff --git a/group_vars/all b/group_vars/all deleted file mode 100644 index 7a21451..0000000 --- a/group_vars/all +++ /dev/null @@ -1,5 +0,0 @@ -distro: edge -become: yes -claim_token: -claim_rooms: -claim_url: https://app.netdata.cloud diff --git a/host_vars/centos7 b/host_vars/centos7 deleted file mode 100644 index fc383c5..0000000 --- a/host_vars/centos7 +++ /dev/null @@ -1,2 +0,0 @@ ---- -oom_score: 1100 diff --git a/hosts b/hosts index cdcf45e..5834b0c 100644 --- a/hosts +++ b/hosts @@ -1,26 +1,3 @@ ---- +[all] -all: - hosts: - ubuntu18: - ansible_host: 192.168.10.120 - ubuntu20: - ansible_host: 192.168.10.7 - ubuntu22: - ansible_host: 192.168.10.118 - debian10: - ansible_host: 192.168.10.4 - debian11: - ansible_host: 192.168.10.5 - centos7: - ansible_host: 192.168.10.103 - rocky8: - ansible_host: 192.168.10.6 - alpine: - ansible_host: 192.168.10.8 - ol8: - ansible_host: 192.168.10.116 - fedora35: - ansible_host: 192.168.10.122 - vars: - ansible_user: ikarpov +debtest ansible_host=137.184.144.190 ansible_user=root \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..2a53e12 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,6 @@ +--- +galaxy_info: + role_name: netdata + namespace: netdta + author: Jonathan Roemer + description: Install Netdata agent and configure checks diff --git a/molecule/README.md b/molecule/README.md deleted file mode 100644 index 373b279..0000000 --- a/molecule/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# RedHat Ansible Molecule test framework - -## Summary - -This is a framework for the automated testing of Ansible roles against multiple platforms. - -If you just want to use Ansible to deploy netdata then you do not need to use this. Instead, use the Ansible roles in the parent directory of the repository. - - -## Prerequisites - -Requires: -- Ansible -- Docker -- Molecule (see [Molecule documentation](https://ansible.readthedocs.io/projects/molecule/installation/) for full requirements) - -Tested with Ansible v2.15.1 and Docker v24.0.4. - -# Ansible roles tested - -- `install_netdata_repository` - -# Tested on -`Centos 7, Rocky 8, Oracle Linux 8, Fedora 35` - -`Debian 10, Debian 11, Ubuntu 18, Ubuntu 20, Ubuntu22` - -## Usage -> molecule test - -Will do the following: - -- Creates virtual environments. (equivalent to running just: `molecule create`) -- Runs Ansible Playbooks against environments. (equivalent to running just: `molecule converge`) -- Destroys virtual environments. (equivalent to running just: `molecule destroy`) - -Run all Molecule commands from the root directory of the repository and not from the `molecule` folder or within the `Roles` folder.* - -If you are new to Molecule, or even if you have some new untested changes to test, it's strongly recommended to run only part of the test cycle by first invoking: -> molecule create - -and then - -> molecule converge - -That way, if anything fails you can adjust your Ansible code and then simply re-run molecule converge. - -## Molecule implementation structure - -The Molecule directory has the structure as follows: - -```bash -. -├── common -│ ├── Dockerfile_debian10.j2 -│ ├── Dockerfile_debian11.j2 -│ ├── Dockerfile_ubuntu1804.j2 -│ ├── Dockerfile_ubuntu2004.j2 -│ └── Dockerfile_ubuntu2204.j2 -├── default -│ ├── converge.yml -│ ├── molecule.yml -│ └── verify.yml -└── README.md - -``` - -# Dockerfiles -These are custom Dockerfiles which contain the required tools for deploying the Ansible roles you want to test. - -# Default > converge -This file imports the Ansible roles that you wish to test. - -# Default > molecule -This file contains a list of platforms/images to be tested against along with other settings such as which driver to use. - - -# Notes - -1. If you run Molecule from the wrong directory you will get an error such as: -> CRITICAL 'molecule/default/molecule.yml' glob failed. Exiting. -2. Linting Molecule can be a little tricky and so it's recommended to exclude the `molecule` folder from your main Ansible linting. - * You can add your Molecule specific lint-settings via the `molecule.yml` file's `verifier` section, etc. -3. It is expected that the custom Dockerfiles will be deprecated in the very near future in favour of images built to the same recipe but generated by the Netdata build-system and made available in Github, etc. - - - -## To do - -Currently, this Molecule framework has only been fully tested against the role `install_netdata_repository`. - -Additonal roles will be tested in short-order. diff --git a/molecule/common/Dockerfile_debian10.j2 b/molecule/common/Dockerfile_debian10.j2 deleted file mode 100644 index 69923bf..0000000 --- a/molecule/common/Dockerfile_debian10.j2 +++ /dev/null @@ -1,4 +0,0 @@ -FROM {{ item.image | lower }} - -RUN apt update && \ - apt install -y nano curl gpg-agent python3 ca-certificates \ No newline at end of file diff --git a/molecule/common/Dockerfile_debian11.j2 b/molecule/common/Dockerfile_debian11.j2 deleted file mode 100644 index d95f599..0000000 --- a/molecule/common/Dockerfile_debian11.j2 +++ /dev/null @@ -1,4 +0,0 @@ -FROM {{ item.image | lower }} - -RUN apt update && \ - apt install -y nano curl gpg-agent python3 ca-certificates diff --git a/molecule/common/Dockerfile_ubuntu1804.j2 b/molecule/common/Dockerfile_ubuntu1804.j2 deleted file mode 100644 index 9a201b2..0000000 --- a/molecule/common/Dockerfile_ubuntu1804.j2 +++ /dev/null @@ -1,17 +0,0 @@ -FROM {{ item.image | lower }} - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - apt-utils \ - curl \ - debian-archive-keyring \ - gpg-agent \ - gnupg \ - nano \ - python3 \ - software-properties-common \ - && apt-get clean \ - && rm -Rf /var/lib/apt/lists/* \ - && rm -Rf /usr/share/doc \ - && rm -Rf /usr/share/man diff --git a/molecule/common/Dockerfile_ubuntu2004.j2 b/molecule/common/Dockerfile_ubuntu2004.j2 deleted file mode 100644 index 9a201b2..0000000 --- a/molecule/common/Dockerfile_ubuntu2004.j2 +++ /dev/null @@ -1,17 +0,0 @@ -FROM {{ item.image | lower }} - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - apt-utils \ - curl \ - debian-archive-keyring \ - gpg-agent \ - gnupg \ - nano \ - python3 \ - software-properties-common \ - && apt-get clean \ - && rm -Rf /var/lib/apt/lists/* \ - && rm -Rf /usr/share/doc \ - && rm -Rf /usr/share/man diff --git a/molecule/common/Dockerfile_ubuntu2204.j2 b/molecule/common/Dockerfile_ubuntu2204.j2 deleted file mode 100644 index 9ebcb17..0000000 --- a/molecule/common/Dockerfile_ubuntu2204.j2 +++ /dev/null @@ -1,18 +0,0 @@ -FROM {{ item.image | lower }} - -ARG DEBIAN_FRONTEND=noninteractive - - -RUN apt-get update && apt-get install -y --no-install-recommends \ - apt-utils \ - curl \ - debian-archive-keyring \ - gpg-agent \ - gnupg \ - nano \ - python3 \ - software-properties-common \ - && apt-get clean \ - && rm -Rf /var/lib/apt/lists/* \ - && rm -Rf /usr/share/doc \ - && rm -Rf /usr/share/man diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index e4b4c15..0000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Converge - hosts: all - tasks: - - name: "Include install-netdata-repository" - ansible.builtin.include_role: - name: roles/install_netdata_repository diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index 1aaaca2..0000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -dependency: - name: galaxy - -driver: - name: docker - -platforms: - - - name: centos7 - image: quay.io/centos/centos:7 - pre_build_image: true - - - name: Debian10 - image: debian:10 - pre_build_image: false - dockerfile: ../common/Dockerfile_debian10.j2 - - - name: debian11 - image: debian:11 - pre_build_image: false - dockerfile: ../common/Dockerfile_debian11.j2 - - - name: fedora35 - image: fedora:35 - pre_build_image: true - - - name: oraclelinux8 - image: oraclelinux:8 - pre_build_image: true - - - name: rockylinux8 - image: rockylinux:8 - pre_build_image: true - - - name: ubuntu1804 - image: ubuntu:18.04 - dockerfile: ../common/Dockerfile_ubuntu1804.j2 - entrypoint: "/usr/bin/bash" - pre_build_image: false - - - name: ubuntu2004 - image: ubuntu:20.04 - dockerfile: ../common/Dockerfile_ubuntu2004.j2 - entrypoint: "/usr/bin/bash" - pre_build_image: false - - - name: ubuntu2204 - image: ubuntu:22.04 - dockerfile: ../common/Dockerfile_ubuntu2204.j2 - entrypoint: "/usr/bin/bash" - pre_build_image: false - - -provisioner: - name: ansible - env: - MOLECULE_NO_LOG: false - -verifier: - name: ansible diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml deleted file mode 100644 index a5cfa75..0000000 --- a/molecule/default/verify.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -# This is an example playbook to execute Ansible tests. - -- name: Verify - hosts: all - gather_facts: false - tasks: - - name: Example assertion - ansible.builtin.assert: - that: true diff --git a/netdata-agent.yml b/netdata-agent.yml deleted file mode 100644 index a22c78e..0000000 --- a/netdata-agent.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: Install Netdata agent - hosts: all - remote_user: "{{ansible_user}}" - gather_facts: true - become: true - - pre_tasks: - - - name: Add EPEL repository for Centos/Rocky - ansible.builtin.package: - name: epel-release - state: latest - # when: ansible_facts['os_family'] == 'RedHat' - when: - ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and - (ansible_distribution_version is version_compare('7', '<') or - ansible_distribution_version is version_compare('8', '>=')) - - roles: - - { role: install_netdata_repository, become: true } - - { role: install_netdata_agent, become: true } diff --git a/netdata.yml b/netdata.yml new file mode 100644 index 0000000..8e7d048 --- /dev/null +++ b/netdata.yml @@ -0,0 +1,12 @@ +--- +- name: Install the Netdata Linux agent on Debian + include_tasks: pkg-debian.yml + when: ansible_facts.os_family == "Debian" + +- name: Install the Netdata Linux agent on OpenSUSE + include_tasks: pkg-opensuse.yml + when: ansible_facts.os_family == "Suse" + +- name: Configure the Netdata Linux agent + include_tasks: config.yml + when: netdata_manage_config and ansible_facts.os_family != "Windows" and ansible_facts.os_family != "Darwin" diff --git a/purge.yml b/purge.yml deleted file mode 100644 index 1dd303a..0000000 --- a/purge.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Purge netdata agent and netdata agent repository - hosts: all - gather_facts: true - become: true - - roles: - - { role: purge_netdata_agent, become: true } - - { role: purge_netdata_repository, become: true } diff --git a/roles/claim/README.md b/roles/claim/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/claim/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/claim/defaults/main.yml b/roles/claim/defaults/main.yml deleted file mode 100644 index 072f500..0000000 --- a/roles/claim/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for roles/claim diff --git a/roles/claim/handlers/main.yml b/roles/claim/handlers/main.yml deleted file mode 100644 index 341efcd..0000000 --- a/roles/claim/handlers/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# handlers file for roles/claim - -- name: Restart netdata agent - ansible.builtin.systemd: - name: netdata.service - state: restarted diff --git a/roles/claim/meta/main.yml b/roles/claim/meta/main.yml deleted file mode 100644 index 2110721..0000000 --- a/roles/claim/meta/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -galaxy_info: - author: Netdata packaging team - description: real-time charts for system monitoring (https://netdata.cloud/) - company: Netdata Inc. - - license: GPL-3.0-or-later - - min_ansible_version: "2.1" - - # 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 - - 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. diff --git a/roles/claim/tasks/main.yml b/roles/claim/tasks/main.yml deleted file mode 100644 index d040ae9..0000000 --- a/roles/claim/tasks/main.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# tasks file for roles/claim - -- name: Get information about running agent - ansible.builtin.command: netdatacli aclk-state json - register: agent_info - - # - set_fact: - # is_online: "{{ agent_info.stdout | from_json | json_query('online') }}" - -- name: Set fact for is_claimed - ansible.builtin.set_fact: - is_claimed: "{{ agent_info.stdout | from_json | json_query('\"agent-claimed\"') }}" - -- name: Claim the new node if is not claimed yet - block: - - name: Generate UUID - ansible.builtin.command: uuidgen - register: uuid - - - name: Set fact new_uuid - ansible.builtin.set_fact: - new_uuid: "{{ uuid.stdout }}" - - - name: Claim the node - ansible.builtin.command: netdata-claim.sh -token="{{ claim_token }}" -rooms="{{ claim_rooms }}" -url="{{ claim_url }}" -id="{{ new_uuid }}" - notify: restart netdata agent - - when: not is_claimed diff --git a/roles/claim/tests/inventory b/roles/claim/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/roles/claim/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/claim/tests/test.yml b/roles/claim/tests/test.yml deleted file mode 100644 index a97704c..0000000 --- a/roles/claim/tests/test.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Test for claim role - hosts: localhost - remote_user: root - roles: - - roles/claim diff --git a/roles/claim/vars/Centos7.yml b/roles/claim/vars/Centos7.yml deleted file mode 100644 index 096099b..0000000 --- a/roles/claim/vars/Centos7.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -claiming_script: "/usr/sbin/netdata-claim.sh" diff --git a/roles/claim/vars/Debian11.yml b/roles/claim/vars/Debian11.yml deleted file mode 100644 index 096099b..0000000 --- a/roles/claim/vars/Debian11.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -claiming_script: "/usr/sbin/netdata-claim.sh" diff --git a/roles/claim/vars/Fedora35.yml b/roles/claim/vars/Fedora35.yml deleted file mode 100644 index 096099b..0000000 --- a/roles/claim/vars/Fedora35.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -claiming_script: "/usr/sbin/netdata-claim.sh" diff --git a/roles/claim/vars/OracleLinux8.yml b/roles/claim/vars/OracleLinux8.yml deleted file mode 100644 index 096099b..0000000 --- a/roles/claim/vars/OracleLinux8.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -claiming_script: "/usr/sbin/netdata-claim.sh" diff --git a/roles/claim/vars/Rocky8.yml b/roles/claim/vars/Rocky8.yml deleted file mode 100644 index 096099b..0000000 --- a/roles/claim/vars/Rocky8.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -claiming_script: "/usr/sbin/netdata-claim.sh" diff --git a/roles/claim/vars/main.yml b/roles/claim/vars/main.yml deleted file mode 100644 index ad5b5bd..0000000 --- a/roles/claim/vars/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# vars file for roles/claim - -claim_token: 4p_pe4EUMJ7hyO_DkTicKBRj_jfQXMbRQNaH39dz0YbXOHHrK_5jF9-Sjc5l4DbZMuXVtxE2kVMkP6YXmrYaBRcyg59qVGa0SMx6QhxIGVMMcpzuvom2IFSSaTpBEfBAw-nbcgQ -claim_rooms: 4d9094b6-810e-458c-a9a0-acf3372e08e5 -claim_url: https://app.netdata.cloud diff --git a/roles/install_netdata_agent/README.md b/roles/install_netdata_agent/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/install_netdata_agent/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/install_netdata_agent/defaults/main.yml b/roles/install_netdata_agent/defaults/main.yml deleted file mode 100644 index 9995e15..0000000 --- a/roles/install_netdata_agent/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# defaults file for roles/install_netdata_agent -# Global -agent_user: netdata -agent_history: 3600 -# Agent process scheduling policy -agent_policy: idle -# Agent OOM score -oom_score: 1000 - -# Web -owner: root -group: netdata -bind_to: localhost diff --git a/roles/install_netdata_agent/handlers/main.yml b/roles/install_netdata_agent/handlers/main.yml deleted file mode 100644 index fd236a4..0000000 --- a/roles/install_netdata_agent/handlers/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# handlers file for roles/install_netdata_agent - -- name: Restart netdata agent - ansible.builtin.systemd: - name: netdata.service - state: restarted diff --git a/roles/install_netdata_agent/meta/main.yml b/roles/install_netdata_agent/meta/main.yml deleted file mode 100644 index 2110721..0000000 --- a/roles/install_netdata_agent/meta/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -galaxy_info: - author: Netdata packaging team - description: real-time charts for system monitoring (https://netdata.cloud/) - company: Netdata Inc. - - license: GPL-3.0-or-later - - min_ansible_version: "2.1" - - # 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 - - 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. diff --git a/roles/install_netdata_agent/tasks/Alpine3.yml b/roles/install_netdata_agent/tasks/Alpine3.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/install_netdata_agent/tasks/Alpine3.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/install_netdata_agent/tasks/Centos7.yml b/roles/install_netdata_agent/tasks/Centos7.yml deleted file mode 100644 index ed01295..0000000 --- a/roles/install_netdata_agent/tasks/Centos7.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- - -# We have to install the dependencies from EPEL because we have to disable it when installing netdata agent. - -- name: Dependencies first - ansible.builtin.yum: - name: "{{ item }}" - state: present - update_cache: true - loop: - - Judy - - brotli - - libuv - - netcat - - nodejs - - nodejs-libs - - openssl11 - - yum-plugin-priorities - -# We disabled EPEL for netdata agent installation to exclude the possibility of installing EPEL package -- name: Install netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - state: latest - update_cache: true - disable_gpg_check: true - disablerepo: "epel" - -- name: Writing configuration to /etc/netdata/netdata.conf - ansible.builtin.template: - src: netdata.conf.j2 - dest: /etc/netdata/netdata.conf - owner: root - group: root - mode: '0644' - notify: restart netdata agent - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/Debian10.yml b/roles/install_netdata_agent/tasks/Debian10.yml deleted file mode 100644 index 9db2059..0000000 --- a/roles/install_netdata_agent/tasks/Debian10.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -- name: Install uuid-runtime - ansible.builtin.package: - name: uuid-runtime - state: present - -- name: Install the netdata agent package - ansible.builtin.apt: - name: netdata - update_cache: true - state: latest - # default_release: - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true - masked: false diff --git a/roles/install_netdata_agent/tasks/Debian11.yml b/roles/install_netdata_agent/tasks/Debian11.yml deleted file mode 100644 index 9c9fc29..0000000 --- a/roles/install_netdata_agent/tasks/Debian11.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Install uuid-runtime - ansible.builtin.package: - name: uuid-runtime - state: present - -- name: Install the netdata agent package - ansible.builtin.apt: - name: netdata - update_cache: true - state: latest - # default_release: - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true - masked: false diff --git a/roles/install_netdata_agent/tasks/Fedora35.yml b/roles/install_netdata_agent/tasks/Fedora35.yml deleted file mode 100644 index 9e02469..0000000 --- a/roles/install_netdata_agent/tasks/Fedora35.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Install Netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - state: latest - update_cache: true - disable_gpg_check: true - # disablerepo: "epel" # Not needed for Fedora - - -- name: Writing configuration to /etc/netdata/netdata.conf - ansible.builtin.template: - src: netdata.conf.j2 - dest: /etc/netdata/netdata.conf - owner: root - group: root - mode: '0644' - notify: restart netdata agent - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/OracleLinux8.yml b/roles/install_netdata_agent/tasks/OracleLinux8.yml deleted file mode 100644 index 1e7366a..0000000 --- a/roles/install_netdata_agent/tasks/OracleLinux8.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- - -- name: Dependencies first - ansible.builtin.dnf: - name: "{{ item }}" - state: present - update_cache: true - loop: - - Judy - - brotli - - libuv - - netcat - - nodejs - - openssl - -- name: Install the netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - state: latest - update_cache: true - disable_gpg_check: true - disablerepo: "epel" - - -- name: Writing configuration to /etc/netdata/netdata.conf - ansible.builtin.template: - src: netdata.conf.j2 - dest: /etc/netdata/netdata.conf - owner: root - group: root - mode: '0644' - notify: restart netdata agent - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/Rocky8.yml b/roles/install_netdata_agent/tasks/Rocky8.yml deleted file mode 100644 index b8bb25b..0000000 --- a/roles/install_netdata_agent/tasks/Rocky8.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- - -- name: Dependencies first - ansible.builtin.dnf: - name: "{{ item }}" - state: present - update_cache: true - loop: - - Judy - - brotli - - libuv - - netcat - - nodejs - - openssl - -- name: Install the netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - state: latest - update_cache: true - disable_gpg_check: true - disablerepo: "epel" - -- name: Writing configuration to /etc/netdata/netdata.conf - ansible.builtin.template: - src: netdata.conf.j2 - dest: /etc/netdata/netdata.conf - owner: root - group: root - mode: '0644' - notify: restart netdata agent - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/Ubuntu18.yml b/roles/install_netdata_agent/tasks/Ubuntu18.yml deleted file mode 100644 index b3c4cfb..0000000 --- a/roles/install_netdata_agent/tasks/Ubuntu18.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - -- name: Install the netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - update_cache: true - state: latest - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/Ubuntu20.yml b/roles/install_netdata_agent/tasks/Ubuntu20.yml deleted file mode 100644 index b3c4cfb..0000000 --- a/roles/install_netdata_agent/tasks/Ubuntu20.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - -- name: Install the netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - update_cache: true - state: latest - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/Ubuntu22.yml b/roles/install_netdata_agent/tasks/Ubuntu22.yml deleted file mode 100644 index b3c4cfb..0000000 --- a/roles/install_netdata_agent/tasks/Ubuntu22.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - -- name: Install the netdata agent package - ansible.builtin.package: - name: "{{ netdata_agent_package }}" - update_cache: true - state: latest - -- name: Start service "{{ netdata_agent_service }}" - ansible.builtin.systemd: - name: "{{ netdata_agent_service }}" - state: started - enabled: true diff --git a/roles/install_netdata_agent/tasks/main.yml b/roles/install_netdata_agent/tasks/main.yml deleted file mode 100644 index e216819..0000000 --- a/roles/install_netdata_agent/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# tasks file for roles/install_netdata_agent - -- name: Include architecture specific vars - ansible.builtin.include_vars: "{{ ansible_architecture }}.yml" - -- name: Include OS specific vars - ansible.builtin.include_vars: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" - -- name: Include OS specific tasks - ansible.builtin.include_tasks: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" diff --git a/roles/install_netdata_agent/templates/netdata.conf.j2 b/roles/install_netdata_agent/templates/netdata.conf.j2 deleted file mode 100644 index da91972..0000000 --- a/roles/install_netdata_agent/templates/netdata.conf.j2 +++ /dev/null @@ -1,16 +0,0 @@ -[global] - run as user = {{agent_user}} - - # the default database size - 1 hour - history = {{agent_history}} - - # some defaults to run netdata with least priority - process scheduling policy = {{agent_policy}} - OOM score = {{oom_score}} - -[web] - web files owner = {{owner}} - web files group = {{group}} - - # by default do not expose the netdata port - bind to = {{bind_to}} diff --git a/roles/install_netdata_agent/tests/inventory b/roles/install_netdata_agent/tests/inventory deleted file mode 100644 index d18580b..0000000 --- a/roles/install_netdata_agent/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost \ No newline at end of file diff --git a/roles/install_netdata_agent/tests/test.yml b/roles/install_netdata_agent/tests/test.yml deleted file mode 100644 index caf1422..0000000 --- a/roles/install_netdata_agent/tests/test.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Test role install_netdata_agent - hosts: localhost - remote_user: root - roles: - - roles/install_netdata_agent diff --git a/roles/install_netdata_agent/vars/Alpine3.yml b/roles/install_netdata_agent/vars/Alpine3.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/install_netdata_agent/vars/Alpine3.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/install_netdata_agent/vars/Centos7.yml b/roles/install_netdata_agent/vars/Centos7.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Centos7.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/Debian10.yml b/roles/install_netdata_agent/vars/Debian10.yml deleted file mode 100644 index 16a9e32..0000000 --- a/roles/install_netdata_agent/vars/Debian10.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata - -package_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/debian/buster/' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata-edge/packages/debian/buster/' }}" -# package_name: "{{ 'netdata_1.33.1_' if distro == 'stable' else 'netdata_1.33.1-195-nightly_' }}" diff --git a/roles/install_netdata_agent/vars/Debian11.yml b/roles/install_netdata_agent/vars/Debian11.yml deleted file mode 100644 index 3fd0884..0000000 --- a/roles/install_netdata_agent/vars/Debian11.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata - -package_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/debian/bullseye/' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata-edge/packages/debian/bullseye/' }}" -# package_name: "{{ 'netdata_1.33.1_' if distro == 'stable' else 'netdata_1.33.1-195-nightly_' }}" diff --git a/roles/install_netdata_agent/vars/Fedora35.yml b/roles/install_netdata_agent/vars/Fedora35.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Fedora35.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/OracleLinux8.yml b/roles/install_netdata_agent/vars/OracleLinux8.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/OracleLinux8.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/Rocky8.yml b/roles/install_netdata_agent/vars/Rocky8.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Rocky8.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/Ubuntu18.yml b/roles/install_netdata_agent/vars/Ubuntu18.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Ubuntu18.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/Ubuntu20.yml b/roles/install_netdata_agent/vars/Ubuntu20.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Ubuntu20.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/Ubuntu22.yml b/roles/install_netdata_agent/vars/Ubuntu22.yml deleted file mode 100644 index f9a221c..0000000 --- a/roles/install_netdata_agent/vars/Ubuntu22.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/install_netdata_agent/vars/main.yml b/roles/install_netdata_agent/vars/main.yml deleted file mode 100644 index 8b0dff5..0000000 --- a/roles/install_netdata_agent/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for roles/install_netdata_agent diff --git a/roles/install_netdata_agent/vars/x86_64.yml b/roles/install_netdata_agent/vars/x86_64.yml deleted file mode 100644 index c2943ef..0000000 --- a/roles/install_netdata_agent/vars/x86_64.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -suffix: amd64 diff --git a/roles/install_netdata_repository/README.md b/roles/install_netdata_repository/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/install_netdata_repository/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/install_netdata_repository/defaults/main.yml b/roles/install_netdata_repository/defaults/main.yml deleted file mode 100644 index d8c040c..0000000 --- a/roles/install_netdata_repository/defaults/main.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# defaults file for roles/netdata-repository -repository_version: 1.1 - -# Packagecloud repository PGP key -pc_repo_key: https://packagecloud.io/netdata/netdata/gpgkey - -# distribution, stable or edge -distro: stable - -# Debian 11 repo: -debian11_repo: https://packagecloud.io/netdata/netdata/packages/debian/bullseye/netdata-repo_1-1_all.deb/download.deb -# Centos 7 stable repo: -centos7_stable_repo: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/7/netdata-repo-1-1.noarch.rpm/download.rpm -# Rocky Linux 8 stable repo: -rocky8_stable_repo: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/8/netdata-repo-1-1.noarch.rpm/download.rpm diff --git a/roles/install_netdata_repository/handlers/main.yml b/roles/install_netdata_repository/handlers/main.yml deleted file mode 100644 index d626a76..0000000 --- a/roles/install_netdata_repository/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for roles/netdata-repository diff --git a/roles/install_netdata_repository/meta/main.yml b/roles/install_netdata_repository/meta/main.yml deleted file mode 100644 index d76c35e..0000000 --- a/roles/install_netdata_repository/meta/main.yml +++ /dev/null @@ -1,43 +0,0 @@ -galaxy_info: - author: Netdata packaging team - description: real-time charts for system monitoring (https://netdata.cloud/) - company: Netdata Inc. - role_name: install_netdata_repository - namespace: netdata - - license: GPL-3.0-or-later - - min_ansible_version: "2.1" - - # 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 - - 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. diff --git a/roles/install_netdata_repository/tasks/CentOS7.yml b/roles/install_netdata_repository/tasks/CentOS7.yml deleted file mode 100644 index ad24b05..0000000 --- a/roles/install_netdata_repository/tasks/CentOS7.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: Install Netdata stable repository configuration - ansible.builtin.yum: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/7/netdata-repo-1-1.noarch.rpm/download.rpm - state: present - when: distro == 'stable' - -- name: Import a stable repository PGP key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata/gpgkey - -- name: Install Netdata nightly repository configuration - ansible.builtin.yum: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/7/netdata-repo-edge-1-1.noarch.rpm/download.rpm - state: present - when: distro == 'edge' - -- name: Import an edge repository PGP key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata-edge/gpgkey diff --git a/roles/install_netdata_repository/tasks/Debian10.yml b/roles/install_netdata_repository/tasks/Debian10.yml deleted file mode 100644 index 9a20033..0000000 --- a/roles/install_netdata_repository/tasks/Debian10.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Install some essential packages - ansible.builtin.apt: - name: "{{ item }}" - update_cache: true - loop: - - gpg - - debian-archive-keyring - - apt-transport-https - -- name: Install Netdata repo key - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: present - -- name: Install netdata repo - ansible.builtin.apt: - deb: "{{ repo_uri }}" diff --git a/roles/install_netdata_repository/tasks/Debian11.yml b/roles/install_netdata_repository/tasks/Debian11.yml deleted file mode 100644 index 1bb526e..0000000 --- a/roles/install_netdata_repository/tasks/Debian11.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- name: Install Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata/gpgkey - state: present - -- name: Install netdata repo - ansible.builtin.apt: - deb: "{{ repo_uri }}" diff --git a/roles/install_netdata_repository/tasks/Fedora35.yml b/roles/install_netdata_repository/tasks/Fedora35.yml deleted file mode 100644 index 8d369e0..0000000 --- a/roles/install_netdata_repository/tasks/Fedora35.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata/gpgkey - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata-edge/gpgkey - -- name: Install Netdata stable repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/fedora/35/netdata-repo-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'stable' - -- name: Install Netdata nightly repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/fedora/35/netdata-repo-edge-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'edge' diff --git a/roles/install_netdata_repository/tasks/OracleLinux8.yml b/roles/install_netdata_repository/tasks/OracleLinux8.yml deleted file mode 100644 index 53f94ef..0000000 --- a/roles/install_netdata_repository/tasks/OracleLinux8.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata/gpgkey - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata-edge/gpgkey - -- name: Install Netdata stable repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/ol/8/netdata-repo-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'stable' - -- name: Install Netdata nightly repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/ol/8/netdata-repo-edge-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'edge' diff --git a/roles/install_netdata_repository/tasks/Rocky8.yml b/roles/install_netdata_repository/tasks/Rocky8.yml deleted file mode 100644 index d4d7617..0000000 --- a/roles/install_netdata_repository/tasks/Rocky8.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata/gpgkey - -- name: Import a key from a url - ansible.builtin.rpm_key: - state: present - key: https://packagecloud.io/netdata/netdata-edge/gpgkey - -- name: Install Netdata stable repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/8/netdata-repo-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'stable' - -- name: Install Netdata nightly repository configuration - ansible.builtin.dnf: - name: https://packagecloud.io/netdata/netdata-repoconfig/packages/el/8/netdata-repo-edge-1-1.noarch.rpm/download.rpm - state: present - disable_gpg_check: true - when: distro == 'edge' diff --git a/roles/install_netdata_repository/tasks/Ubuntu18.yml b/roles/install_netdata_repository/tasks/Ubuntu18.yml deleted file mode 100644 index c21a144..0000000 --- a/roles/install_netdata_repository/tasks/Ubuntu18.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Install some essential packages - ansible.builtin.apt: - name: "{{ item }}" - update_cache: true - loop: - - gpg - - debian-archive-keyring - - apt-transport-https - -- name: Install Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata/gpgkey - state: present - -- name: Install Netdata repository package - ansible.builtin.apt: - deb: "{{ repo_uri }}" diff --git a/roles/install_netdata_repository/tasks/Ubuntu20.yml b/roles/install_netdata_repository/tasks/Ubuntu20.yml deleted file mode 100644 index 13f918a..0000000 --- a/roles/install_netdata_repository/tasks/Ubuntu20.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- name: Install Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata/gpgkey - state: present - -- name: Install Netdata repository package - ansible.builtin.apt: - deb: "{{ repo_uri }}" diff --git a/roles/install_netdata_repository/tasks/Ubuntu22.yml b/roles/install_netdata_repository/tasks/Ubuntu22.yml deleted file mode 100644 index 13f918a..0000000 --- a/roles/install_netdata_repository/tasks/Ubuntu22.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- name: Install Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata/gpgkey - state: present - -- name: Install Netdata repository package - ansible.builtin.apt: - deb: "{{ repo_uri }}" diff --git a/roles/install_netdata_repository/tasks/main.yml b/roles/install_netdata_repository/tasks/main.yml deleted file mode 100644 index c2c6096..0000000 --- a/roles/install_netdata_repository/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# tasks file for roles/netdata-repository -- name: Include OS specific vars - ansible.builtin.include_vars: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" - -- name: Include OS specific tasks - ansible.builtin.include_tasks: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" diff --git a/roles/install_netdata_repository/tests/inventory b/roles/install_netdata_repository/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/roles/install_netdata_repository/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/install_netdata_repository/tests/test.yml b/roles/install_netdata_repository/tests/test.yml deleted file mode 100644 index 67e22dc..0000000 --- a/roles/install_netdata_repository/tests/test.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Test for role install_netdata_repository - hosts: localhost - remote_user: root - roles: - - roles/install_netdata_repository diff --git a/roles/install_netdata_repository/vars/Debian10.yml b/roles/install_netdata_repository/vars/Debian10.yml deleted file mode 100644 index 8185001..0000000 --- a/roles/install_netdata_repository/vars/Debian10.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -repo_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/debian/buster/netdata-repo_1-1_all.deb/download.deb' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata/packages/debian/buster/netdata-repo-edge_1-1_all.deb/download.deb' }}" diff --git a/roles/install_netdata_repository/vars/Debian11.yml b/roles/install_netdata_repository/vars/Debian11.yml deleted file mode 100644 index 632030c..0000000 --- a/roles/install_netdata_repository/vars/Debian11.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -repo_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/debian/bullseye/netdata-repo_1-1_all.deb/download.deb' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata/packages/debian/bullseye/netdata-repo-edge_1-1_all.deb/download.deb' }}" diff --git a/roles/install_netdata_repository/vars/Fedora35.yml b/roles/install_netdata_repository/vars/Fedora35.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/install_netdata_repository/vars/Fedora35.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/install_netdata_repository/vars/OracleLinux8.yml b/roles/install_netdata_repository/vars/OracleLinux8.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/install_netdata_repository/vars/OracleLinux8.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/install_netdata_repository/vars/Rocky8.yml b/roles/install_netdata_repository/vars/Rocky8.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/install_netdata_repository/vars/Rocky8.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/install_netdata_repository/vars/Ubuntu18.yml b/roles/install_netdata_repository/vars/Ubuntu18.yml deleted file mode 100644 index e7a2e27..0000000 --- a/roles/install_netdata_repository/vars/Ubuntu18.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -repo_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/ubuntu/bionic/netdata-repo_1-1_all.deb/download.deb' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata/packages/ubuntu/bionic/netdata-repo-edge_1-1_all.deb/download.deb' }}" diff --git a/roles/install_netdata_repository/vars/Ubuntu20.yml b/roles/install_netdata_repository/vars/Ubuntu20.yml deleted file mode 100644 index 87e84fc..0000000 --- a/roles/install_netdata_repository/vars/Ubuntu20.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -repo_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/ubuntu/focal/netdata-repo_1-1_all.deb/download.deb' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata/packages/ubuntu/focal/netdata-repo-edge_1-1_all.deb/download.deb' }}" diff --git a/roles/install_netdata_repository/vars/Ubuntu22.yml b/roles/install_netdata_repository/vars/Ubuntu22.yml deleted file mode 100644 index 1b25b3d..0000000 --- a/roles/install_netdata_repository/vars/Ubuntu22.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -repo_uri: "{{ 'https://packagecloud.io/netdata/netdata/packages/ubuntu/jammy/netdata-repo_1-1_all.deb/download.deb' if distro == 'stable' else 'https://packagecloud.io/netdata/netdata/packages/ubuntu/jammy/netdata-repo-edge_1-1_all.deb/download.deb' }}" diff --git a/roles/install_netdata_repository/vars/main.yml b/roles/install_netdata_repository/vars/main.yml deleted file mode 100644 index a521a7b..0000000 --- a/roles/install_netdata_repository/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for roles/netdata-repository diff --git a/roles/purge_netdata_agent/.travis.yml b/roles/purge_netdata_agent/.travis.yml deleted file mode 100644 index 121cc49..0000000 --- a/roles/purge_netdata_agent/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/roles/purge_netdata_agent/README.md b/roles/purge_netdata_agent/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/purge_netdata_agent/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/purge_netdata_agent/defaults/main.yml b/roles/purge_netdata_agent/defaults/main.yml deleted file mode 100644 index 5f45bc4..0000000 --- a/roles/purge_netdata_agent/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for roles/purge_netdata_agent diff --git a/roles/purge_netdata_agent/handlers/main.yml b/roles/purge_netdata_agent/handlers/main.yml deleted file mode 100644 index 61d9de3..0000000 --- a/roles/purge_netdata_agent/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for roles/purge_netdata_agent diff --git a/roles/purge_netdata_agent/meta/main.yml b/roles/purge_netdata_agent/meta/main.yml deleted file mode 100644 index 2110721..0000000 --- a/roles/purge_netdata_agent/meta/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -galaxy_info: - author: Netdata packaging team - description: real-time charts for system monitoring (https://netdata.cloud/) - company: Netdata Inc. - - license: GPL-3.0-or-later - - min_ansible_version: "2.1" - - # 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 - - 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. diff --git a/roles/purge_netdata_agent/tasks/Centos7.yml b/roles/purge_netdata_agent/tasks/Centos7.yml deleted file mode 100644 index c0c0455..0000000 --- a/roles/purge_netdata_agent/tasks/Centos7.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.yum: - state: absent - name: netdata - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /etc/netdata - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_agent/tasks/Debian10.yml b/roles/purge_netdata_agent/tasks/Debian10.yml deleted file mode 100644 index 916c9fb..0000000 --- a/roles/purge_netdata_agent/tasks/Debian10.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - name: netdata - purge: true diff --git a/roles/purge_netdata_agent/tasks/Debian11.yml b/roles/purge_netdata_agent/tasks/Debian11.yml deleted file mode 100644 index 916c9fb..0000000 --- a/roles/purge_netdata_agent/tasks/Debian11.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - name: netdata - purge: true diff --git a/roles/purge_netdata_agent/tasks/Fedora35.yml b/roles/purge_netdata_agent/tasks/Fedora35.yml deleted file mode 100644 index 0257de3..0000000 --- a/roles/purge_netdata_agent/tasks/Fedora35.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - "{{ netdata_repo_package }}" - - "{{ netdata_agent_package }}" - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /etc/netdata - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_agent/tasks/OracleLinux8.yml b/roles/purge_netdata_agent/tasks/OracleLinux8.yml deleted file mode 100644 index 0257de3..0000000 --- a/roles/purge_netdata_agent/tasks/OracleLinux8.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - "{{ netdata_repo_package }}" - - "{{ netdata_agent_package }}" - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /etc/netdata - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_agent/tasks/Rocky8.yml b/roles/purge_netdata_agent/tasks/Rocky8.yml deleted file mode 100644 index 0257de3..0000000 --- a/roles/purge_netdata_agent/tasks/Rocky8.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - "{{ netdata_repo_package }}" - - "{{ netdata_agent_package }}" - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /etc/netdata - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_agent/tasks/Ubuntu18.yml b/roles/purge_netdata_agent/tasks/Ubuntu18.yml deleted file mode 100644 index bc8c547..0000000 --- a/roles/purge_netdata_agent/tasks/Ubuntu18.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - name: "netdata*" - purge: true - autoremove: true diff --git a/roles/purge_netdata_agent/tasks/Ubuntu20.yml b/roles/purge_netdata_agent/tasks/Ubuntu20.yml deleted file mode 100644 index bc8c547..0000000 --- a/roles/purge_netdata_agent/tasks/Ubuntu20.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - name: "netdata*" - purge: true - autoremove: true diff --git a/roles/purge_netdata_agent/tasks/Ubuntu22.yml b/roles/purge_netdata_agent/tasks/Ubuntu22.yml deleted file mode 100644 index bc8c547..0000000 --- a/roles/purge_netdata_agent/tasks/Ubuntu22.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - name: "netdata*" - purge: true - autoremove: true diff --git a/roles/purge_netdata_agent/tasks/main.yml b/roles/purge_netdata_agent/tasks/main.yml deleted file mode 100644 index d2d87b4..0000000 --- a/roles/purge_netdata_agent/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# tasks file for roles/purge_netdata_agent - -- name: Include OS specific vars - ansible.builtin.include_vars: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" - -- name: Include OS specific install - ansible.builtin.include_tasks: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" diff --git a/roles/purge_netdata_agent/tests/inventory b/roles/purge_netdata_agent/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/roles/purge_netdata_agent/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/purge_netdata_agent/tests/test.yml b/roles/purge_netdata_agent/tests/test.yml deleted file mode 100644 index 6d7138b..0000000 --- a/roles/purge_netdata_agent/tests/test.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: "Test role: purge_netdata_agent" - hosts: localhost - remote_user: root - roles: - - roles/purge_netdata_agent diff --git a/roles/purge_netdata_agent/vars/Centos7.yml b/roles/purge_netdata_agent/vars/Centos7.yml deleted file mode 100644 index c5e2065..0000000 --- a/roles/purge_netdata_agent/vars/Centos7.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_agent/vars/Debian10.yml b/roles/purge_netdata_agent/vars/Debian10.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/purge_netdata_agent/vars/Debian10.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/purge_netdata_agent/vars/Debian11.yml b/roles/purge_netdata_agent/vars/Debian11.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/purge_netdata_agent/vars/Debian11.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/purge_netdata_agent/vars/Fedora35.yml b/roles/purge_netdata_agent/vars/Fedora35.yml deleted file mode 100644 index c5e2065..0000000 --- a/roles/purge_netdata_agent/vars/Fedora35.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_agent/vars/OracleLinux8.yml b/roles/purge_netdata_agent/vars/OracleLinux8.yml deleted file mode 100644 index c8f71c8..0000000 --- a/roles/purge_netdata_agent/vars/OracleLinux8.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -netdata_agent_package: netdata -netdata_agent_service: netdata - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" diff --git a/roles/purge_netdata_agent/vars/Rocky8.yml b/roles/purge_netdata_agent/vars/Rocky8.yml deleted file mode 100644 index c5e2065..0000000 --- a/roles/purge_netdata_agent/vars/Rocky8.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" - -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_agent/vars/Ubuntu18.yml b/roles/purge_netdata_agent/vars/Ubuntu18.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/purge_netdata_agent/vars/Ubuntu18.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/purge_netdata_agent/vars/Ubuntu20.yml b/roles/purge_netdata_agent/vars/Ubuntu20.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/purge_netdata_agent/vars/Ubuntu20.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/purge_netdata_agent/vars/Ubuntu22.yml b/roles/purge_netdata_agent/vars/Ubuntu22.yml deleted file mode 100644 index ed97d53..0000000 --- a/roles/purge_netdata_agent/vars/Ubuntu22.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/purge_netdata_agent/vars/main.yml b/roles/purge_netdata_agent/vars/main.yml deleted file mode 100644 index e62efb7..0000000 --- a/roles/purge_netdata_agent/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for roles/purge_netdata_agent diff --git a/roles/purge_netdata_repository/.travis.yml b/roles/purge_netdata_repository/.travis.yml deleted file mode 100644 index 121cc49..0000000 --- a/roles/purge_netdata_repository/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/roles/purge_netdata_repository/README.md b/roles/purge_netdata_repository/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/purge_netdata_repository/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/purge_netdata_repository/defaults/main.yml b/roles/purge_netdata_repository/defaults/main.yml deleted file mode 100644 index 3100664..0000000 --- a/roles/purge_netdata_repository/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for roles/purge_netdata_repository diff --git a/roles/purge_netdata_repository/handlers/main.yml b/roles/purge_netdata_repository/handlers/main.yml deleted file mode 100644 index 069fb85..0000000 --- a/roles/purge_netdata_repository/handlers/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# handlers file for roles/purge_netdata_repository - -- name: Yum clean metadata - ansible.builtin.command: yum clean metadata - args: - warn: no - -- name: Dnf clean metadata - ansible.builtin.command: dnf clean metadata - args: - warn: no diff --git a/roles/purge_netdata_repository/meta/main.yml b/roles/purge_netdata_repository/meta/main.yml deleted file mode 100644 index 2110721..0000000 --- a/roles/purge_netdata_repository/meta/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -galaxy_info: - author: Netdata packaging team - description: real-time charts for system monitoring (https://netdata.cloud/) - company: Netdata Inc. - - license: GPL-3.0-or-later - - min_ansible_version: "2.1" - - # 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 - - 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. diff --git a/roles/purge_netdata_repository/tasks/Centos7.yml b/roles/purge_netdata_repository/tasks/Centos7.yml deleted file mode 100644 index 1978115..0000000 --- a/roles/purge_netdata_repository/tasks/Centos7.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- name: Remove Netdata configuration package - ansible.builtin.yum: - name: - - netdata - - netdata-repo - - netdata-repo-edge - state: absent - notify: yum-clean-metadata diff --git a/roles/purge_netdata_repository/tasks/Debian10.yml b/roles/purge_netdata_repository/tasks/Debian10.yml deleted file mode 100644 index c98af0e..0000000 --- a/roles/purge_netdata_repository/tasks/Debian10.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Remove Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: absent - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - purge: true - name: - - netdata - - netdata-repo - - netdata-repo-edge - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Debian11.yml b/roles/purge_netdata_repository/tasks/Debian11.yml deleted file mode 100644 index c98af0e..0000000 --- a/roles/purge_netdata_repository/tasks/Debian11.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: Remove Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: absent - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - purge: true - name: - - netdata - - netdata-repo - - netdata-repo-edge - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Fedora35.yml b/roles/purge_netdata_repository/tasks/Fedora35.yml deleted file mode 100644 index 0103c5b..0000000 --- a/roles/purge_netdata_repository/tasks/Fedora35.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - netdata - - netdata-repo - - netdata-repo-edge - notify: dnf-clean-metadata - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/OracleLinux8.yml b/roles/purge_netdata_repository/tasks/OracleLinux8.yml deleted file mode 100644 index 5730e08..0000000 --- a/roles/purge_netdata_repository/tasks/OracleLinux8.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - "{{ netdata_repo_package }}" - - "{{ netdata_agent_package }}" - notify: dnf-clean-metadata - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Rocky8.yml b/roles/purge_netdata_repository/tasks/Rocky8.yml deleted file mode 100644 index 0103c5b..0000000 --- a/roles/purge_netdata_repository/tasks/Rocky8.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -- name: Remove Netdata packages - ansible.builtin.dnf: - state: absent - name: - - netdata - - netdata-repo - - netdata-repo-edge - notify: dnf-clean-metadata - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Ubuntu18.yml b/roles/purge_netdata_repository/tasks/Ubuntu18.yml deleted file mode 100644 index 5df4ead..0000000 --- a/roles/purge_netdata_repository/tasks/Ubuntu18.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- - -- name: Remove Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: absent - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - purge: true - name: - - netdata - - netdata-repo-edge - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Ubuntu20.yml b/roles/purge_netdata_repository/tasks/Ubuntu20.yml deleted file mode 100644 index 5df4ead..0000000 --- a/roles/purge_netdata_repository/tasks/Ubuntu20.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- - -- name: Remove Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: absent - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - purge: true - name: - - netdata - - netdata-repo-edge - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/Ubuntu22.yml b/roles/purge_netdata_repository/tasks/Ubuntu22.yml deleted file mode 100644 index 5df4ead..0000000 --- a/roles/purge_netdata_repository/tasks/Ubuntu22.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- - -- name: Remove Netdata repo key. - ansible.builtin.apt_key: - url: https://packagecloud.io/netdata/netdata-repoconfig/gpgkey - state: absent - -- name: Remove Netdata packages - ansible.builtin.apt: - state: absent - purge: true - name: - - netdata - - netdata-repo-edge - -- name: Remove the remains - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/tasks/main.yml b/roles/purge_netdata_repository/tasks/main.yml deleted file mode 100644 index c97f993..0000000 --- a/roles/purge_netdata_repository/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -# tasks file for roles/purge_netdata_repository - -- name: Include OS specific vars - ansible.builtin.include_vars: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" - -- name: Include OS specific tasks - ansible.builtin.include_tasks: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" diff --git a/roles/purge_netdata_repository/tests/inventory b/roles/purge_netdata_repository/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/roles/purge_netdata_repository/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/purge_netdata_repository/tests/test.yml b/roles/purge_netdata_repository/tests/test.yml deleted file mode 100644 index 5cce06c..0000000 --- a/roles/purge_netdata_repository/tests/test.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: "Test for role: purge_netdata_repository" - hosts: localhost - remote_user: root - roles: - - roles/purge_netdata_repository diff --git a/roles/purge_netdata_repository/vars/Centos7.yml b/roles/purge_netdata_repository/vars/Centos7.yml deleted file mode 100644 index 5dd4934..0000000 --- a/roles/purge_netdata_repository/vars/Centos7.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" diff --git a/roles/purge_netdata_repository/vars/Debian10.yml b/roles/purge_netdata_repository/vars/Debian10.yml deleted file mode 100644 index 6e4e779..0000000 --- a/roles/purge_netdata_repository/vars/Debian10.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -dir_list: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/vars/Debian11.yml b/roles/purge_netdata_repository/vars/Debian11.yml deleted file mode 100644 index 6e4e779..0000000 --- a/roles/purge_netdata_repository/vars/Debian11.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -dir_list: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/vars/Fedora35.yml b/roles/purge_netdata_repository/vars/Fedora35.yml deleted file mode 100644 index 3e2b105..0000000 --- a/roles/purge_netdata_repository/vars/Fedora35.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_repository/vars/OracleLinux8.yml b/roles/purge_netdata_repository/vars/OracleLinux8.yml deleted file mode 100644 index 3e2b105..0000000 --- a/roles/purge_netdata_repository/vars/OracleLinux8.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_repository/vars/Rocky8.yml b/roles/purge_netdata_repository/vars/Rocky8.yml deleted file mode 100644 index 3e2b105..0000000 --- a/roles/purge_netdata_repository/vars/Rocky8.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -netdata_repo_package: "{{ 'netdata-repo' if distro == 'stable' else 'netdata-repo-edge' }}" -netdata_agent_package: netdata -netdata_agent_service: netdata diff --git a/roles/purge_netdata_repository/vars/Ubuntu18.yml b/roles/purge_netdata_repository/vars/Ubuntu18.yml deleted file mode 100644 index 6e4e779..0000000 --- a/roles/purge_netdata_repository/vars/Ubuntu18.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -dir_list: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/vars/Ubuntu20.yml b/roles/purge_netdata_repository/vars/Ubuntu20.yml deleted file mode 100644 index 6e4e779..0000000 --- a/roles/purge_netdata_repository/vars/Ubuntu20.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -dir_list: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/vars/Ubuntu22.yml b/roles/purge_netdata_repository/vars/Ubuntu22.yml deleted file mode 100644 index 6e4e779..0000000 --- a/roles/purge_netdata_repository/vars/Ubuntu22.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -dir_list: - - /var/log/netdata - - /var/lib/netdata - - /var/cache/netdata - - /usr/libexec/netdata diff --git a/roles/purge_netdata_repository/vars/main.yml b/roles/purge_netdata_repository/vars/main.yml deleted file mode 100644 index 84ad313..0000000 --- a/roles/purge_netdata_repository/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for roles/purge_netdata_repository diff --git a/roles/install_netdata_repository/vars/CentOS7.yml b/tasks/linux/linux-config.yml similarity index 100% rename from roles/install_netdata_repository/vars/CentOS7.yml rename to tasks/linux/linux-config.yml diff --git a/tasks/linux/pkg-debian.yml b/tasks/linux/pkg-debian.yml new file mode 100644 index 0000000..e9c47fe --- /dev/null +++ b/tasks/linux/pkg-debian.yml @@ -0,0 +1,23 @@ +--- +- name: Add repo and install package + hosts: all + become: true + tasks: + +# Debian + - name: Install Netdata repo key. + ansible.builtin.apt_key: + url: + state: present + + - name: Add repository for Debian + ansible.builtin.apt_repository: + name: "netdata" + repo: "{{ netdata_repository_url }}{{ netdata_release_version }}/debian" + state: present + update_cache: true + + - name: Install package on Debian + ansible.builtin.apt: + name: netdata + state: present diff --git a/tasks/linux/pkg-suse.yml b/tasks/linux/pkg-suse.yml new file mode 100644 index 0000000..a40ee7a --- /dev/null +++ b/tasks/linux/pkg-suse.yml @@ -0,0 +1,17 @@ +--- +- name: Add repo and install package + hosts: all + become: true + tasks: + + - name: Add repository for Suse + community.general.zypper_repository: + name: "netdata" + repo: 'http://example.com/opensuse/repo/oss/' + state: present + auto_import_keys: true + + - name: Install package on Suse + community.general.zypper: + name: netdata + state: present \ No newline at end of file From 0504b83f9122e45218cc150527d0047f21ff2a0e Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 9 Dec 2024 13:42:20 -0600 Subject: [PATCH 03/26] Debian functional --- .ansible-lint | 6 ---- .github/workflows/linter.yml | 30 +++++++++++++++++++ README.md | 2 -- meta/main.yml | 6 ---- {defaults => netdata/defaults}/main.yml | 4 +-- .../tasks/configure-linux.yml | 0 .../tasks/install-debian.yml | 11 ++++--- .../tasks/install-suse.yml | 2 +- netdata.yml => netdata/tasks/main.yml | 6 ++-- netdata/templates/netdata.conf.j2 | 1 + 10 files changed, 42 insertions(+), 26 deletions(-) delete mode 100644 .ansible-lint create mode 100644 .github/workflows/linter.yml delete mode 100644 meta/main.yml rename {defaults => netdata/defaults}/main.yml (76%) rename tasks/linux/linux-config.yml => netdata/tasks/configure-linux.yml (100%) rename tasks/linux/pkg-debian.yml => netdata/tasks/install-debian.yml (66%) rename tasks/linux/pkg-suse.yml => netdata/tasks/install-suse.yml (94%) rename netdata.yml => netdata/tasks/main.yml (75%) create mode 100644 netdata/templates/netdata.conf.j2 diff --git a/.ansible-lint b/.ansible-lint deleted file mode 100644 index f9ff2ff..0000000 --- a/.ansible-lint +++ /dev/null @@ -1,6 +0,0 @@ ---- -# exclude_paths: -# - 'roles/*/tests' -parseable: true -skip_list: - - role-name[path] diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..18d5609 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,30 @@ +--- + name: Lint + + on: # yamllint disable-line rule:truthy + push: + pull_request: + + permissions: {} + + jobs: + build: + name: Lint + runs-on: ubuntu-latest + + permissions: + contents: read + packages: read + statuses: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Super-linter + uses: super-linter/super-linter@v7 + env: + # To report GitHub Actions status checks + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 254dcdc..e93562b 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ ## Roles - - `ansible-playbook -e "distro=stable" netdata-agent.yml` Or you can set in on per host basis, using inventory file or hosts_var/hostname. diff --git a/meta/main.yml b/meta/main.yml deleted file mode 100644 index 2a53e12..0000000 --- a/meta/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -galaxy_info: - role_name: netdata - namespace: netdta - author: Jonathan Roemer - description: Install Netdata agent and configure checks diff --git a/defaults/main.yml b/netdata/defaults/main.yml similarity index 76% rename from defaults/main.yml rename to netdata/defaults/main.yml index 994e97e..7b29a36 100644 --- a/defaults/main.yml +++ b/netdata/defaults/main.yml @@ -14,6 +14,6 @@ netdata_claim_node: false netdata_claim_url: "https://app.netdata.cloud" netdata_claim_token: "" -# Define the Netdata repository URLs - +# Define the Netdata repository URLs and associated key files netdata_repository_url: "https://repo.netdata.cloud/repos/" +netdata_repository_key_url: "https://repo.netdata.cloud/netdatabot.gpg.key" diff --git a/tasks/linux/linux-config.yml b/netdata/tasks/configure-linux.yml similarity index 100% rename from tasks/linux/linux-config.yml rename to netdata/tasks/configure-linux.yml diff --git a/tasks/linux/pkg-debian.yml b/netdata/tasks/install-debian.yml similarity index 66% rename from tasks/linux/pkg-debian.yml rename to netdata/tasks/install-debian.yml index e9c47fe..403d603 100644 --- a/tasks/linux/pkg-debian.yml +++ b/netdata/tasks/install-debian.yml @@ -1,19 +1,18 @@ --- + - name: Add repo and install package - hosts: all - become: true - tasks: + block: # Debian - name: Install Netdata repo key. ansible.builtin.apt_key: - url: + url: "{{ netdata_repository_key_url }}" state: present - name: Add repository for Debian ansible.builtin.apt_repository: - name: "netdata" - repo: "{{ netdata_repository_url }}{{ netdata_release_version }}/debian" + filename: "netdata" + repo: "deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/debian bookworm/" state: present update_cache: true diff --git a/tasks/linux/pkg-suse.yml b/netdata/tasks/install-suse.yml similarity index 94% rename from tasks/linux/pkg-suse.yml rename to netdata/tasks/install-suse.yml index a40ee7a..6abe203 100644 --- a/tasks/linux/pkg-suse.yml +++ b/netdata/tasks/install-suse.yml @@ -14,4 +14,4 @@ - name: Install package on Suse community.general.zypper: name: netdata - state: present \ No newline at end of file + state: present diff --git a/netdata.yml b/netdata/tasks/main.yml similarity index 75% rename from netdata.yml rename to netdata/tasks/main.yml index 8e7d048..66282eb 100644 --- a/netdata.yml +++ b/netdata/tasks/main.yml @@ -1,12 +1,12 @@ --- - name: Install the Netdata Linux agent on Debian - include_tasks: pkg-debian.yml + include_tasks: install-debian.yml when: ansible_facts.os_family == "Debian" - name: Install the Netdata Linux agent on OpenSUSE - include_tasks: pkg-opensuse.yml + include_tasks: install-opensuse.yml when: ansible_facts.os_family == "Suse" - name: Configure the Netdata Linux agent - include_tasks: config.yml + include_tasks: configure-linux.yml when: netdata_manage_config and ansible_facts.os_family != "Windows" and ansible_facts.os_family != "Darwin" diff --git a/netdata/templates/netdata.conf.j2 b/netdata/templates/netdata.conf.j2 new file mode 100644 index 0000000..ed3d22f --- /dev/null +++ b/netdata/templates/netdata.conf.j2 @@ -0,0 +1 @@ +# This file is empty by default. You can add your own configuration options here. \ No newline at end of file From e2b3c914b0f5b07182d648c3fbb32510b7a31b60 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 9 Dec 2024 13:45:08 -0600 Subject: [PATCH 04/26] Apply config, remove hosts file --- hosts | 3 --- netdata/tasks/configure-linux.yml | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 hosts diff --git a/hosts b/hosts deleted file mode 100644 index 5834b0c..0000000 --- a/hosts +++ /dev/null @@ -1,3 +0,0 @@ -[all] - -debtest ansible_host=137.184.144.190 ansible_user=root \ No newline at end of file diff --git a/netdata/tasks/configure-linux.yml b/netdata/tasks/configure-linux.yml index e69de29..85cdaf4 100644 --- a/netdata/tasks/configure-linux.yml +++ b/netdata/tasks/configure-linux.yml @@ -0,0 +1,8 @@ +- name: Apply the netdata.conf.j2 template + template: + src: netdata.conf.j2 + dest: /etc/netdata/netdata.conf + owner: root + group: root + mode: '0644' + notify: restart netdata From c52085f101d088b8cf7d46d6de7c13fedece07da Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 9 Dec 2024 15:36:08 -0600 Subject: [PATCH 05/26] Re-organize, moving everything up a directory. --- {netdata/defaults => defaults}/main.yml | 0 handlers/main.yml | 6 ++++++ {netdata/tasks => tasks}/configure-linux.yml | 2 +- {netdata/tasks => tasks}/install-debian.yml | 1 + {netdata/tasks => tasks}/install-suse.yml | 1 + {netdata/tasks => tasks}/main.yml | 0 {netdata/templates => templates}/netdata.conf.j2 | 0 7 files changed, 9 insertions(+), 1 deletion(-) rename {netdata/defaults => defaults}/main.yml (100%) create mode 100644 handlers/main.yml rename {netdata/tasks => tasks}/configure-linux.yml (86%) rename {netdata/tasks => tasks}/install-debian.yml (95%) rename {netdata/tasks => tasks}/install-suse.yml (92%) rename {netdata/tasks => tasks}/main.yml (100%) rename {netdata/templates => templates}/netdata.conf.j2 (100%) diff --git a/netdata/defaults/main.yml b/defaults/main.yml similarity index 100% rename from netdata/defaults/main.yml rename to defaults/main.yml diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..04d753a --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,6 @@ +--- + - name: Restart Netdata + systemd: + name: netdata + state: restarted + enabled: yes \ No newline at end of file diff --git a/netdata/tasks/configure-linux.yml b/tasks/configure-linux.yml similarity index 86% rename from netdata/tasks/configure-linux.yml rename to tasks/configure-linux.yml index 85cdaf4..283c537 100644 --- a/netdata/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -5,4 +5,4 @@ owner: root group: root mode: '0644' - notify: restart netdata + notify: Restart Netdata diff --git a/netdata/tasks/install-debian.yml b/tasks/install-debian.yml similarity index 95% rename from netdata/tasks/install-debian.yml rename to tasks/install-debian.yml index 403d603..7ff3b93 100644 --- a/netdata/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -20,3 +20,4 @@ ansible.builtin.apt: name: netdata state: present + notify: Restart Netdata diff --git a/netdata/tasks/install-suse.yml b/tasks/install-suse.yml similarity index 92% rename from netdata/tasks/install-suse.yml rename to tasks/install-suse.yml index 6abe203..630c37d 100644 --- a/netdata/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -15,3 +15,4 @@ community.general.zypper: name: netdata state: present + notify: Restart Netdata diff --git a/netdata/tasks/main.yml b/tasks/main.yml similarity index 100% rename from netdata/tasks/main.yml rename to tasks/main.yml diff --git a/netdata/templates/netdata.conf.j2 b/templates/netdata.conf.j2 similarity index 100% rename from netdata/templates/netdata.conf.j2 rename to templates/netdata.conf.j2 From 3655ec8875af2a241f388ecc048dd9541596893d Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 8 Jan 2025 13:17:42 -0600 Subject: [PATCH 06/26] Update to match current rewrite --- README.md | 32 --------------------------- defaults/main.yml | 16 ++++++++++++-- meta/main.yml | 41 +++++++++++++++++++++++++++++++++++ tasks/configure-linux.yml | 16 +++++++++++++- tasks/install-debian.yml | 4 ++-- tasks/install-suse.yml | 28 ++++++++++++------------ tasks/main.yml | 4 ++++ tasks/node_claim.yml | 25 +++++++++++++++++++++ templates/go.d/plugin.conf.j2 | 3 +++ vars/main.yml | 2 ++ 10 files changed, 120 insertions(+), 51 deletions(-) create mode 100644 meta/main.yml create mode 100644 tasks/node_claim.yml create mode 100644 templates/go.d/plugin.conf.j2 create mode 100644 vars/main.yml diff --git a/README.md b/README.md index e93562b..2031022 100644 --- a/README.md +++ b/README.md @@ -3,35 +3,3 @@ ## Tested on - Debian 12 -- OpenSUSE 15.6 - -## Roles - -`ansible-playbook -e "distro=stable" netdata-agent.yml` - -Or you can set in on per host basis, using inventory file or hosts_var/hostname. - -> purge.yml: - -Removes both installed repository and the package, making efforts to remove all possible remains like the log or configuration files. - -> claim.yml: - -Claims the agent against Netdata Cloud - -## Parameters - -Playbooks behavior is parameterized to some extent. You may add or change the global settings in `group_vars/all` file or on per host basis in corresponding files in `host_vars/` -You might also want to set some parameters in inventory file, of course. Or directly in the command line. Examples: - -`ansible-playbook --limit=debian10,ubuntu20 netdata-agent.yml` - -`ansible-playbook -u toor --limit=rocky8 -e "distro=edge" purge.yml` - -*Warning.* - -You cannot just switch from stable to edge repos (nor visa versa). You have to purge existing installation first. - -## To do - -- The only agent configuration file used for the time being is `netdata.conf`. Perhaps, other configuration files handling should be added. diff --git a/defaults/main.yml b/defaults/main.yml index 7b29a36..72a960d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,13 +7,25 @@ netdata_release_version: "stable" # Define if we manage the Netdata configuration netdata_manage_config: true -# By default, don't claim the node on Netdata Cloud -netdata_claim_node: false +# Define Netdata config file path +netdata_config_dir: "/etc/netdata" # Allow for injecting a claim token if using Netdata Cloud netdata_claim_url: "https://app.netdata.cloud" netdata_claim_token: "" +netdata_claim_rooms: "" # Define the Netdata repository URLs and associated key files netdata_repository_url: "https://repo.netdata.cloud/repos/" netdata_repository_key_url: "https://repo.netdata.cloud/netdatabot.gpg.key" + + + +# Define config for enbled Go integrations +netdata_go_collector_plugins: [] + # - name: prometheus + # config: + # job: + # - name: local + # url: http://127.0.0.1:9090/metrics + \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..b88fb46 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,41 @@ +galaxy_info: + author: Ralph Meijer + description: Deploys the NetData agent + company: Netdata Inc. + + license: Apache-2.0 + + min_ansible_version: "2.1" + + # 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 + + 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. \ No newline at end of file diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 283c537..7489a5c 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -1,8 +1,22 @@ - name: Apply the netdata.conf.j2 template template: src: netdata.conf.j2 - dest: /etc/netdata/netdata.conf + dest: "{{ netdata_config_dir }}/netdata.conf" owner: root group: root mode: '0644' notify: Restart Netdata + +- name: Configure GO Collector Plugins + template: + src: go.d/plugin.conf.j2 + dest: "{{ netdata_config_dir }}/go.d/{{ item.name }}.conf" + owner: root + group: root + mode: '0644' + loop: "{{ netdata_go_collector_plugins }}" + loop_control: + label: "{{ item.name | default(omit) }}" + when: + - netdata_go_collector_plugins is defined and netdata_go_collector_plugins|length > 0 + notify: Restart Netdata diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index 7ff3b93..90f133e 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -12,12 +12,12 @@ - name: Add repository for Debian ansible.builtin.apt_repository: filename: "netdata" - repo: "deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/debian bookworm/" + repo: "deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}/" state: present update_cache: true - name: Install package on Debian ansible.builtin.apt: - name: netdata + name: "netdata" state: present notify: Restart Netdata diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index 630c37d..23bde94 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -1,18 +1,18 @@ --- + - name: Add repo and install package - hosts: all - become: true - tasks: + block: - - name: Add repository for Suse - community.general.zypper_repository: - name: "netdata" - repo: 'http://example.com/opensuse/repo/oss/' - state: present - auto_import_keys: true +# Suse + - name: Add repository for Suse + community.general.zypper_repository: + name: "netdata" + repo: 'http://example.com/opensuse/repo/oss/' + state: present + auto_import_keys: true - - name: Install package on Suse - community.general.zypper: - name: netdata - state: present - notify: Restart Netdata + - name: Install package on Suse + community.general.zypper: + name: netdata + state: present + notify: Restart Netdata diff --git a/tasks/main.yml b/tasks/main.yml index 66282eb..f9d5a6e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,3 +10,7 @@ - name: Configure the Netdata Linux agent include_tasks: configure-linux.yml when: netdata_manage_config and ansible_facts.os_family != "Windows" and ansible_facts.os_family != "Darwin" + +- name: Claim node if claim_token + include_tasks: node_claim.yml + when: netdata_claim_token | length > 0 \ No newline at end of file diff --git a/tasks/node_claim.yml b/tasks/node_claim.yml new file mode 100644 index 0000000..df93fa3 --- /dev/null +++ b/tasks/node_claim.yml @@ -0,0 +1,25 @@ +--- + +- name: Get information about running agent + ansible.builtin.command: netdatacli aclk-state json + register: agent_info + +- name: Set fact for is_claimed + ansible.builtin.set_fact: + is_claimed: "{{ agent_info.stdout | from_json | json_query('\"agent-claimed\"') }}" + +- name: Claim the new node if is not claimed yet + block: + - name: Generate UUID + ansible.builtin.command: uuidgen + register: uuid + + - name: Set fact new_uuid + ansible.builtin.set_fact: + new_uuid: "{{ uuid.stdout }}" + + - name: Claim the node + ansible.builtin.command: netdata-claim.sh -token="{{ netdata_claim_token }}" -rooms="{{ netdata_claim_rooms }}" -url="{{ netdata_claim_url }}" -id="{{ new_uuid }}" + notify: restart netdata agent + + when: not is_claimed \ No newline at end of file diff --git a/templates/go.d/plugin.conf.j2 b/templates/go.d/plugin.conf.j2 new file mode 100644 index 0000000..94aae3a --- /dev/null +++ b/templates/go.d/plugin.conf.j2 @@ -0,0 +1,3 @@ +{{ ansible_managed | comment }} + +{{ item.config | to_nice_yaml(indent=2) }} \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..bb0f921 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for role \ No newline at end of file From 2708fb681a288d4046c84f7b083e1c778416bac0 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 13 Jan 2025 08:59:23 -0600 Subject: [PATCH 07/26] Install chart support if configured, false by default --- defaults/main.yml | 3 +++ tasks/install-debian.yml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 72a960d..78726ad 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,6 +7,9 @@ netdata_release_version: "stable" # Define if we manage the Netdata configuration netdata_manage_config: true +# Define if we install chart support +netdata_charts_enabled: false + # Define Netdata config file path netdata_config_dir: "/etc/netdata" diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index 90f133e..a0bff9b 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -21,3 +21,10 @@ name: "netdata" state: present notify: Restart Netdata + + - name: Install chart support on Debian if enabled + ansible.builtin.apt: + name: "netdata-plugin-chartsd" + state: present + notify: Restart Netdata + when: netdata_charts_enabled From 12a97eb97b21895ff69ce670f12cbbe8df19e0cb Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Mon, 13 Jan 2025 09:43:16 -0600 Subject: [PATCH 08/26] Repos and chart support for OpenSUSE --- tasks/install-suse.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index 23bde94..57f66b3 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -1,13 +1,21 @@ --- +# Suse + - name: Add repo and install package block: -# Suse - name: Add repository for Suse community.general.zypper_repository: name: "netdata" - repo: 'http://example.com/opensuse/repo/oss/' + repo: 'https://repository.netdata.cloud/repos/stable/opensuse/$releasever/$basearch' + state: present + auto_import_keys: true + + - name: Add repository configuration for Suse + community.general.zypper_repository: + name: "netdata-repoconfig" + repo: 'https://repository.netdata.cloud/repos/stable/opensuse/$releasever/$basearch' state: present auto_import_keys: true @@ -16,3 +24,10 @@ name: netdata state: present notify: Restart Netdata + + - name: Install chart support on Suse if enabled + community.general.zypper: + name: netdata-plugin-chartsd + state: present + notify: Restart Netdata + when: netdata_charts_enabled \ No newline at end of file From b0cbedad201fca1c07509c17363e9d697a824ee8 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Tue, 14 Jan 2025 14:59:45 -0600 Subject: [PATCH 09/26] Lay down and enable chart files --- defaults/main.yml | 11 +++++++---- tasks/configure-linux.yml | 26 +++++++++++++++++++++++++- templates/charts/chart.j2 | 3 +++ 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 templates/charts/chart.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 78726ad..20e2393 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,8 @@ netdata_charts_enabled: false # Define Netdata config file path netdata_config_dir: "/etc/netdata" +netdata_chart_dir: "/usr/libexec/netdata/charts.d/" + # Allow for injecting a claim token if using Netdata Cloud netdata_claim_url: "https://app.netdata.cloud" netdata_claim_token: "" @@ -22,13 +24,14 @@ netdata_claim_rooms: "" netdata_repository_url: "https://repo.netdata.cloud/repos/" netdata_repository_key_url: "https://repo.netdata.cloud/netdatabot.gpg.key" - - -# Define config for enbled Go integrations +# Define config for enabled Go integrations netdata_go_collector_plugins: [] # - name: prometheus # config: # job: # - name: local # url: http://127.0.0.1:9090/metrics - \ No newline at end of file + +# Define config for enabled Charts +netdata_charts: [] +# diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 7489a5c..8693c4d 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -7,7 +7,7 @@ mode: '0644' notify: Restart Netdata -- name: Configure GO Collector Plugins +- name: Configure Go Collector Plugins template: src: go.d/plugin.conf.j2 dest: "{{ netdata_config_dir }}/go.d/{{ item.name }}.conf" @@ -20,3 +20,27 @@ when: - netdata_go_collector_plugins is defined and netdata_go_collector_plugins|length > 0 notify: Restart Netdata + +- name: Enable Charts +- name: Lay down charts.d.conf + copy: + content: 'enable_all_charts="yes"' + dest: "/etc/netdata/charts.d.conf" + owner: root + group: root + mode: '0644' + when: + - netdata_charts_enabled is defined and netdata_charts | length > 0 + +- name: Configure Charts + template: + src: "templates/charts/chart.j2" + dest: "/{{ netdata_chart_dir }}/{{ item.name }}" + owner: root + group: root + mode: '0644' + loop_control: + label: "{{ item.name | default(omit) }}" + when: + - netdata_charts_enabled is defined and netdata_charts | length > 0 + notify: Restart Netdata diff --git a/templates/charts/chart.j2 b/templates/charts/chart.j2 new file mode 100644 index 0000000..94aae3a --- /dev/null +++ b/templates/charts/chart.j2 @@ -0,0 +1,3 @@ +{{ ansible_managed | comment }} + +{{ item.config | to_nice_yaml(indent=2) }} \ No newline at end of file From 5bb6839e8a46f94ba4ddb5a84dfc1f7ac0a7fd20 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Tue, 14 Jan 2025 15:35:09 -0600 Subject: [PATCH 10/26] Allow setting custom directory of chart templates --- defaults/main.yml | 13 ++++++++----- tasks/configure-linux.yml | 8 +++++--- templates/charts/chart.j2 | 3 --- templates/netdata.conf.j2 | 1 - 4 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 templates/charts/chart.j2 delete mode 100644 templates/netdata.conf.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 20e2393..580f654 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,7 +5,7 @@ role_version: 0.0.1 netdata_release_version: "stable" # Define if we manage the Netdata configuration -netdata_manage_config: true +netdata_manage_config: false # Define if we install chart support netdata_charts_enabled: false @@ -13,8 +13,15 @@ netdata_charts_enabled: false # Define Netdata config file path netdata_config_dir: "/etc/netdata" +# Define the Netdata custom config directory +netdata_custom_config_path: "" + +# Define the Netdata chart directory netdata_chart_dir: "/usr/libexec/netdata/charts.d/" +# Define the Netdata custom chart directory +netdata_custom_charts_path: "" + # Allow for injecting a claim token if using Netdata Cloud netdata_claim_url: "https://app.netdata.cloud" netdata_claim_token: "" @@ -31,7 +38,3 @@ netdata_go_collector_plugins: [] # job: # - name: local # url: http://127.0.0.1:9090/metrics - -# Define config for enabled Charts -netdata_charts: [] -# diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 8693c4d..ffa06ba 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -5,6 +5,7 @@ owner: root group: root mode: '0644' + when: netdata_manage_config notify: Restart Netdata - name: Configure Go Collector Plugins @@ -30,17 +31,18 @@ group: root mode: '0644' when: - - netdata_charts_enabled is defined and netdata_charts | length > 0 + - netdata_charts_enabled - name: Configure Charts template: - src: "templates/charts/chart.j2" + src: "{{ netdata_custom_chart_dir }}/{{ item.name }}" dest: "/{{ netdata_chart_dir }}/{{ item.name }}" owner: root group: root mode: '0644' + loop: "{{ netdata_charts }}" loop_control: label: "{{ item.name | default(omit) }}" when: - - netdata_charts_enabled is defined and netdata_charts | length > 0 + - netdata_charts_enabled and netdata_custom_charts_path != "" notify: Restart Netdata diff --git a/templates/charts/chart.j2 b/templates/charts/chart.j2 deleted file mode 100644 index 94aae3a..0000000 --- a/templates/charts/chart.j2 +++ /dev/null @@ -1,3 +0,0 @@ -{{ ansible_managed | comment }} - -{{ item.config | to_nice_yaml(indent=2) }} \ No newline at end of file diff --git a/templates/netdata.conf.j2 b/templates/netdata.conf.j2 deleted file mode 100644 index ed3d22f..0000000 --- a/templates/netdata.conf.j2 +++ /dev/null @@ -1 +0,0 @@ -# This file is empty by default. You can add your own configuration options here. \ No newline at end of file From d38d31960d3be4415a5d6302deb7758884ce4f9a Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Tue, 14 Jan 2025 15:48:53 -0600 Subject: [PATCH 11/26] Update node claim to Netdata 2.0 --- README.md | 34 ++++++++++++++++++++++++++++++++++ defaults/main.yml | 1 + tasks/main.yml | 2 +- tasks/node_claim.yml | 32 +++++++++----------------------- templates/claim.conf.j2 | 8 ++++++++ 5 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 templates/claim.conf.j2 diff --git a/README.md b/README.md index 2031022..09669b6 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,37 @@ ## Tested on - Debian 12 + +## Utilization + +To install Netdata on a host, you can use the following playbook: + +```yaml +- hosts: all + roles: + - role: netdata +``` + +To install Netdata on a host and configure it to send metrics to a Netdata Cloud account, you can use the following playbook: + +```yaml +- hosts: all + roles: + - role: netdata + vars: + netdata_claim_token: "YOUR_NETDATA_CLAIM_TOKEN" +``` + +To install Netdata on a host and enable custom configuration or charts, you can use the following playbook: + +```yaml +- hosts: all + roles: + - role: netdata + vars: + netdata_claim_token: "YOUR_NETDATA_CLAIM_TOKEN" + netdata_manage_config: true + netdata_manage_charts: true + netdata_custom_config_path: "/path/to/custom/netdata.conf.j2" + netdata_custom_charts_path: "/path/to/custom/charts/" +``` diff --git a/defaults/main.yml b/defaults/main.yml index 580f654..4a1fa3a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,7 @@ netdata_chart_dir: "/usr/libexec/netdata/charts.d/" netdata_custom_charts_path: "" # Allow for injecting a claim token if using Netdata Cloud +netdata_proxy: "" netdata_claim_url: "https://app.netdata.cloud" netdata_claim_token: "" netdata_claim_rooms: "" diff --git a/tasks/main.yml b/tasks/main.yml index f9d5a6e..cf12693 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,4 +13,4 @@ - name: Claim node if claim_token include_tasks: node_claim.yml - when: netdata_claim_token | length > 0 \ No newline at end of file + when: netdata_claim_token | length > 0 diff --git a/tasks/node_claim.yml b/tasks/node_claim.yml index df93fa3..7c4347a 100644 --- a/tasks/node_claim.yml +++ b/tasks/node_claim.yml @@ -1,25 +1,11 @@ --- -- name: Get information about running agent - ansible.builtin.command: netdatacli aclk-state json - register: agent_info - -- name: Set fact for is_claimed - ansible.builtin.set_fact: - is_claimed: "{{ agent_info.stdout | from_json | json_query('\"agent-claimed\"') }}" - -- name: Claim the new node if is not claimed yet - block: - - name: Generate UUID - ansible.builtin.command: uuidgen - register: uuid - - - name: Set fact new_uuid - ansible.builtin.set_fact: - new_uuid: "{{ uuid.stdout }}" - - - name: Claim the node - ansible.builtin.command: netdata-claim.sh -token="{{ netdata_claim_token }}" -rooms="{{ netdata_claim_rooms }}" -url="{{ netdata_claim_url }}" -id="{{ new_uuid }}" - notify: restart netdata agent - - when: not is_claimed \ No newline at end of file +- name: Create node claim file + template: + src: claim.conf.j2 + dest: "{{ netdata_config_dir }}/claim.conf" + owner: root + group: root + mode: '0644' + when: node_claim_token | length > 0 + notify: Restart Netdata diff --git a/templates/claim.conf.j2 b/templates/claim.conf.j2 new file mode 100644 index 0000000..7d266c0 --- /dev/null +++ b/templates/claim.conf.j2 @@ -0,0 +1,8 @@ +[global] + url = {{ netdata_claim_url }} + token = {{ netdata_claim_token }} + rooms = {{ netdata_claim_rooms }} + {% if netdata_proxy %} + proxy = {{ netdata_proxy }} + {% endif %} + insecure = 'no' From 952392fae6c25cc153769fbeaa0aa5fb2c56bfbb Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 04:56:20 -0600 Subject: [PATCH 12/26] Add missing newlines, bump version --- defaults/main.yml | 2 +- handlers/main.yml | 2 +- meta/main.yml | 2 +- tasks/install-suse.yml | 2 +- templates/go.d/plugin.conf.j2 | 2 +- vars/main.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 4a1fa3a..3f60e3b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -role_version: 0.0.1 +role_version: 1.0.0 # Define the Netdata release version we install netdata_release_version: "stable" diff --git a/handlers/main.yml b/handlers/main.yml index 04d753a..34ecdf9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,4 +3,4 @@ systemd: name: netdata state: restarted - enabled: yes \ No newline at end of file + enabled: yes diff --git a/meta/main.yml b/meta/main.yml index b88fb46..0ec2066 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -38,4 +38,4 @@ galaxy_info: dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. \ No newline at end of file + # if you add dependencies to this list. diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index 57f66b3..2358bbc 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -30,4 +30,4 @@ name: netdata-plugin-chartsd state: present notify: Restart Netdata - when: netdata_charts_enabled \ No newline at end of file + when: netdata_charts_enabled diff --git a/templates/go.d/plugin.conf.j2 b/templates/go.d/plugin.conf.j2 index 94aae3a..1d5c1c0 100644 --- a/templates/go.d/plugin.conf.j2 +++ b/templates/go.d/plugin.conf.j2 @@ -1,3 +1,3 @@ {{ ansible_managed | comment }} -{{ item.config | to_nice_yaml(indent=2) }} \ No newline at end of file +{{ item.config | to_nice_yaml(indent=2) }} diff --git a/vars/main.yml b/vars/main.yml index bb0f921..01ab1e4 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,2 +1,2 @@ --- -# vars file for role \ No newline at end of file +# vars file for role From f4877bf5082249d40b439665ff6f2ca85ef43fe3 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 05:20:47 -0600 Subject: [PATCH 13/26] Linting fixes --- handlers/main.yml | 10 +++++----- tasks/configure-linux.yml | 11 +++++------ tasks/main.yml | 8 ++++---- tasks/node_claim.yml | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 34ecdf9..5cc41f3 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ --- - - name: Restart Netdata - systemd: - name: netdata - state: restarted - enabled: yes +- name: Restart Netdata + ansible.buitin.systemd: + name: netdata + state: restarted + enabled: true diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index ffa06ba..4fbecb2 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -1,5 +1,5 @@ - name: Apply the netdata.conf.j2 template - template: + ansible.builtin.template: src: netdata.conf.j2 dest: "{{ netdata_config_dir }}/netdata.conf" owner: root @@ -9,7 +9,7 @@ notify: Restart Netdata - name: Configure Go Collector Plugins - template: + ansible.builtin.template: src: go.d/plugin.conf.j2 dest: "{{ netdata_config_dir }}/go.d/{{ item.name }}.conf" owner: root @@ -17,14 +17,13 @@ mode: '0644' loop: "{{ netdata_go_collector_plugins }}" loop_control: - label: "{{ item.name | default(omit) }}" + label: "{{ item.name | default(omit) }}" when: - netdata_go_collector_plugins is defined and netdata_go_collector_plugins|length > 0 notify: Restart Netdata -- name: Enable Charts - name: Lay down charts.d.conf - copy: + ansible.builtin.copy: content: 'enable_all_charts="yes"' dest: "/etc/netdata/charts.d.conf" owner: root @@ -34,7 +33,7 @@ - netdata_charts_enabled - name: Configure Charts - template: + ansible.builtin.template: src: "{{ netdata_custom_chart_dir }}/{{ item.name }}" dest: "/{{ netdata_chart_dir }}/{{ item.name }}" owner: root diff --git a/tasks/main.yml b/tasks/main.yml index cf12693..401f05f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,16 +1,16 @@ --- - name: Install the Netdata Linux agent on Debian - include_tasks: install-debian.yml + ansible.builtin.include_tasks: install-debian.yml when: ansible_facts.os_family == "Debian" - name: Install the Netdata Linux agent on OpenSUSE - include_tasks: install-opensuse.yml + ansible.builtin.include_tasks: install-opensuse.yml when: ansible_facts.os_family == "Suse" - name: Configure the Netdata Linux agent - include_tasks: configure-linux.yml + ansible.builtin.include_tasks: configure-linux.yml when: netdata_manage_config and ansible_facts.os_family != "Windows" and ansible_facts.os_family != "Darwin" - name: Claim node if claim_token - include_tasks: node_claim.yml + ansible.builtin.include_tasks: node_claim.yml when: netdata_claim_token | length > 0 diff --git a/tasks/node_claim.yml b/tasks/node_claim.yml index 7c4347a..6bda915 100644 --- a/tasks/node_claim.yml +++ b/tasks/node_claim.yml @@ -1,7 +1,7 @@ --- - name: Create node claim file - template: + ansible.builtin.template: src: claim.conf.j2 dest: "{{ netdata_config_dir }}/claim.conf" owner: root From 39ae227f0678f12804629946e5f808e9dd8f08c3 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 05:25:10 -0600 Subject: [PATCH 14/26] Fix line length --- tasks/install-debian.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index a0bff9b..d7add12 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -12,7 +12,9 @@ - name: Add repository for Debian ansible.builtin.apt_repository: filename: "netdata" - repo: "deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}/" + repo: > + deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/ \ + {{ ansible_distribution | lower }} {{ ansible_distribution_release }}/ state: present update_cache: true From d773a16a845cf70b2f8c6985fcf909e3bbdde921 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 05:37:47 -0600 Subject: [PATCH 15/26] Fix chart directory path --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 3f60e3b..8b66c30 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,7 +17,7 @@ netdata_config_dir: "/etc/netdata" netdata_custom_config_path: "" # Define the Netdata chart directory -netdata_chart_dir: "/usr/libexec/netdata/charts.d/" +netdata_chart_dir: "/usr/libexec/netdata/charts.d" # Define the Netdata custom chart directory netdata_custom_charts_path: "" From ceb87cd8fa1f5b1a44763db616e4c1fa1da95fbd Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 05:57:34 -0600 Subject: [PATCH 16/26] Various small bugfixes --- handlers/main.yml | 2 +- tasks/install-suse.yml | 9 +++++++-- tasks/main.yml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 5cc41f3..73c21e1 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ --- - name: Restart Netdata - ansible.buitin.systemd: + ansible.builtin.systemd: name: netdata state: restarted enabled: true diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index 2358bbc..a630b63 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -5,6 +5,11 @@ - name: Add repo and install package block: + - name: Import Netdata GPG key + ansible.builtin.rpm_key: + state: present + key: https://repository.netdata.cloud/netdatabot.gpg.key + - name: Add repository for Suse community.general.zypper_repository: name: "netdata" @@ -23,11 +28,11 @@ community.general.zypper: name: netdata state: present - notify: Restart Netdata + notify: Restart Netdata - name: Install chart support on Suse if enabled community.general.zypper: name: netdata-plugin-chartsd state: present - notify: Restart Netdata + notify: Restart Netdata when: netdata_charts_enabled diff --git a/tasks/main.yml b/tasks/main.yml index 401f05f..4d37932 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,7 +4,7 @@ when: ansible_facts.os_family == "Debian" - name: Install the Netdata Linux agent on OpenSUSE - ansible.builtin.include_tasks: install-opensuse.yml + ansible.builtin.include_tasks: install-suse.yml when: ansible_facts.os_family == "Suse" - name: Configure the Netdata Linux agent From 1e7ab477494094f3f394f1d6c956241ce042a343 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 12:48:20 -0600 Subject: [PATCH 17/26] Update installation handling on Debian --- defaults/main.yml | 3 ++- tasks/install-debian.yml | 14 ++++++++++---- tasks/main.yml | 4 ++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8b66c30..6049486 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,7 +29,8 @@ netdata_claim_token: "" netdata_claim_rooms: "" # Define the Netdata repository URLs and associated key files -netdata_repository_url: "https://repo.netdata.cloud/repos/" +netdata_repository_url: "http://repo.netdata.cloud/repos/" +netdata_repoconfig_url: "http://repo.netdata.cloud/repoconfig/" netdata_repository_key_url: "https://repo.netdata.cloud/netdatabot.gpg.key" # Define config for enabled Go integrations diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index d7add12..16fdd0f 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -4,6 +4,13 @@ block: # Debian + + - name: Ensure gpg is installed. + ansible.builtin.apt: + name: gnupg + state: present + update_cache: true + - name: Install Netdata repo key. ansible.builtin.apt_key: url: "{{ netdata_repository_key_url }}" @@ -12,16 +19,15 @@ - name: Add repository for Debian ansible.builtin.apt_repository: filename: "netdata" - repo: > - deb [by-hash=yes] {{ netdata_repository_url }}{{ netdata_release_version }}/ \ - {{ ansible_distribution | lower }} {{ ansible_distribution_release }}/ + repo: | + deb {{ netdata_repository_url }}{{ netdata_release_version }}/{{ ansible_facts.os_family | lower }}/ {{ ansible_distribution_release | lower }}/ state: present - update_cache: true - name: Install package on Debian ansible.builtin.apt: name: "netdata" state: present + update_cache: true notify: Restart Netdata - name: Install chart support on Debian if enabled diff --git a/tasks/main.yml b/tasks/main.yml index 4d37932..b31c18d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,8 @@ --- + +- name: Gather facts + ansible.builtin.setup: + - name: Install the Netdata Linux agent on Debian ansible.builtin.include_tasks: install-debian.yml when: ansible_facts.os_family == "Debian" From a906ce25a9c09273c8ab84a0ab800ecfc93b4376 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 13:15:34 -0600 Subject: [PATCH 18/26] Set role name and fix Suse install --- README.md | 1 + meta/main.yml | 1 + tasks/install-suse.yml | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 09669b6..8e7e935 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ## Tested on - Debian 12 +- SUSE Linux Enterprise Server 15 ## Utilization diff --git a/meta/main.yml b/meta/main.yml index 0ec2066..ce82d51 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,6 +2,7 @@ galaxy_info: author: Ralph Meijer description: Deploys the NetData agent company: Netdata Inc. + role_name: netdata license: Apache-2.0 diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index a630b63..7625e7a 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -5,6 +5,17 @@ - name: Add repo and install package block: + - name: Add netfilter repository configuration for Suse + community.general.zypper_repository: + repo: "https://download.opensuse.org/repositories/security:netfilter/openSUSE_Tumbleweed/security:netfilter.repo" + state: present + auto_import_keys: true + + - name: Install dependencies + community.general.zypper: + name: libnetfilter_acct1 + state: present + - name: Import Netdata GPG key ansible.builtin.rpm_key: state: present From 517dd8bbfb950f9b22abea5abb9a0e096dce556c Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:11:59 -0600 Subject: [PATCH 19/26] Fix node claim and chart management --- .test.yml.swp | Bin 0 -> 12288 bytes defaults/main.yml | 2 +- tasks/configure-linux.yml | 21 +++++++++------------ tasks/install-debian.yml | 2 +- tasks/install-suse.yml | 2 +- tasks/node_claim.yml | 2 +- 6 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 .test.yml.swp diff --git a/.test.yml.swp b/.test.yml.swp new file mode 100644 index 0000000000000000000000000000000000000000..4f4f0650b59a0a08900576545285a5e5caeecb54 GIT binary patch literal 12288 zcmeI&F>ljA6ae50W2FKrf&~e=VRjrlX`EzBlT>L{H?2rY$r7FIb8N@5C8!X009sH0T2KI5C8!X0D*r{0NV(? z*+%G-i1h#e`uqR;J%qlA_#)z?h{qzn-bLtxh<75Mh)CyrPUk@b0T2KI5C8!X009sH z0T2KI5cn$sQr5DI)MG1&ISt2_iy4o{GtAwlR8)pBVX<=i6>N(}jyF-RXDUUMS9z88 zN0nDI6Nb4*qu*D*OX<2LU)x+T#1Wp5>?lo%vxIDHYMrwxos(k)*bB#u(l8bly5`h0 ztES0T-L~W^shBc0)v~--aY#)iPD9t7&AnXL;B-nNQNwzE<}O~+WPgm0=7Hz*`t-nL zt@&~5WSH2k%3)`|90eoNH5wzAdNJjT)2Z6-FQYxj4l(uU;$moc_EL9rJZ-C&^|NPv zV`}+&G#Vb&qWN*7YxX*NW7PA{JN3l%!>+n?ss~lm@CVw!klmBPMR~o=1!i$`MI%d$ Z2Baz7xK=O5()S`smRuTh;edkx{Q_#d?eqWu literal 0 HcmV?d00001 diff --git a/defaults/main.yml b/defaults/main.yml index 6049486..23c0a97 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,7 +8,7 @@ netdata_release_version: "stable" netdata_manage_config: false # Define if we install chart support -netdata_charts_enabled: false +netdata_manage_charts: false # Define Netdata config file path netdata_config_dir: "/etc/netdata" diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 4fbecb2..d29eeba 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -1,11 +1,11 @@ - name: Apply the netdata.conf.j2 template ansible.builtin.template: - src: netdata.conf.j2 + src: "{{ netdata_custom_config_path }}" dest: "{{ netdata_config_dir }}/netdata.conf" owner: root group: root mode: '0644' - when: netdata_manage_config + when: netdata_manage_config notify: Restart Netdata - name: Configure Go Collector Plugins @@ -28,20 +28,17 @@ dest: "/etc/netdata/charts.d.conf" owner: root group: root - mode: '0644' - when: - - netdata_charts_enabled + mode: '0744' + when: netdata_manage_charts -- name: Configure Charts +- name: Process all Jinja2 templates in a directory ansible.builtin.template: - src: "{{ netdata_custom_chart_dir }}/{{ item.name }}" - dest: "/{{ netdata_chart_dir }}/{{ item.name }}" + src: "{{ item }}" + dest: "{{ netdata_chart_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root group: root mode: '0644' - loop: "{{ netdata_charts }}" - loop_control: - label: "{{ item.name | default(omit) }}" + loop: "{{ lookup('fileglob', netdata_custom_charts_path + '/*.j2', wantlist=True) }}" when: - - netdata_charts_enabled and netdata_custom_charts_path != "" + - netdata_manage_charts and netdata_custom_charts_path != "" notify: Restart Netdata diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index 16fdd0f..a136b83 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -35,4 +35,4 @@ name: "netdata-plugin-chartsd" state: present notify: Restart Netdata - when: netdata_charts_enabled + when: netdata_manage_charts diff --git a/tasks/install-suse.yml b/tasks/install-suse.yml index 7625e7a..7eb0077 100644 --- a/tasks/install-suse.yml +++ b/tasks/install-suse.yml @@ -46,4 +46,4 @@ name: netdata-plugin-chartsd state: present notify: Restart Netdata - when: netdata_charts_enabled + when: netdata_manage_charts diff --git a/tasks/node_claim.yml b/tasks/node_claim.yml index 6bda915..c63396f 100644 --- a/tasks/node_claim.yml +++ b/tasks/node_claim.yml @@ -7,5 +7,5 @@ owner: root group: root mode: '0644' - when: node_claim_token | length > 0 + when: netdata_claim_token | length > 0 notify: Restart Netdata From 0e236232eccd397b4a5225413e09afc364453c50 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:13:55 -0600 Subject: [PATCH 20/26] Fixed wrong permissions --- tasks/configure-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index d29eeba..cfd105c 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -28,7 +28,7 @@ dest: "/etc/netdata/charts.d.conf" owner: root group: root - mode: '0744' + mode: '0644' when: netdata_manage_charts - name: Process all Jinja2 templates in a directory @@ -37,7 +37,7 @@ dest: "{{ netdata_chart_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root group: root - mode: '0644' + mode: '0744' loop: "{{ lookup('fileglob', netdata_custom_charts_path + '/*.j2', wantlist=True) }}" when: - netdata_manage_charts and netdata_custom_charts_path != "" From 90871980703b968492a47b09b3b17e16538d6e7c Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:14:39 -0600 Subject: [PATCH 21/26] Match upstream --- tasks/configure-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index cfd105c..74bdc6b 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -37,7 +37,7 @@ dest: "{{ netdata_chart_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root group: root - mode: '0744' + mode: '0750' loop: "{{ lookup('fileglob', netdata_custom_charts_path + '/*.j2', wantlist=True) }}" when: - netdata_manage_charts and netdata_custom_charts_path != "" From 03488205bd8d6bff45e0e28676be8caac245aadc Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:14:59 -0600 Subject: [PATCH 22/26] Clarity --- tasks/configure-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 74bdc6b..89dee04 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -31,7 +31,7 @@ mode: '0644' when: netdata_manage_charts -- name: Process all Jinja2 templates in a directory +- name: Process all Jinja2 chart templates ansible.builtin.template: src: "{{ item }}" dest: "{{ netdata_chart_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" From 74b39581684bf4a32c1c404666be5067844a472e Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:16:20 -0600 Subject: [PATCH 23/26] Further permissions adjustments --- tasks/configure-linux.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/configure-linux.yml b/tasks/configure-linux.yml index 89dee04..47e58f6 100644 --- a/tasks/configure-linux.yml +++ b/tasks/configure-linux.yml @@ -3,7 +3,7 @@ src: "{{ netdata_custom_config_path }}" dest: "{{ netdata_config_dir }}/netdata.conf" owner: root - group: root + group: netdata mode: '0644' when: netdata_manage_config notify: Restart Netdata @@ -13,7 +13,7 @@ src: go.d/plugin.conf.j2 dest: "{{ netdata_config_dir }}/go.d/{{ item.name }}.conf" owner: root - group: root + group: netdata mode: '0644' loop: "{{ netdata_go_collector_plugins }}" loop_control: @@ -27,7 +27,7 @@ content: 'enable_all_charts="yes"' dest: "/etc/netdata/charts.d.conf" owner: root - group: root + group: netdata mode: '0644' when: netdata_manage_charts @@ -36,7 +36,7 @@ src: "{{ item }}" dest: "{{ netdata_chart_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root - group: root + group: netdata mode: '0750' loop: "{{ lookup('fileglob', netdata_custom_charts_path + '/*.j2', wantlist=True) }}" when: From 999e16db5c3f196b98495b5f83f801a6e2587ea3 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:20:27 -0600 Subject: [PATCH 24/26] Ignore swapfiles --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 549d29c..fd28bf0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ hosts ansible.cfg test.yml +.swp From 75b22dd505af816e7b1e586f9b2b0b0e86201f41 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:24:20 -0600 Subject: [PATCH 25/26] Remove erroneously committed swap file --- .test.yml.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .test.yml.swp diff --git a/.test.yml.swp b/.test.yml.swp deleted file mode 100644 index 4f4f0650b59a0a08900576545285a5e5caeecb54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&F>ljA6ae50W2FKrf&~e=VRjrlX`EzBlT>L{H?2rY$r7FIb8N@5C8!X009sH0T2KI5C8!X0D*r{0NV(? z*+%G-i1h#e`uqR;J%qlA_#)z?h{qzn-bLtxh<75Mh)CyrPUk@b0T2KI5C8!X009sH z0T2KI5cn$sQr5DI)MG1&ISt2_iy4o{GtAwlR8)pBVX<=i6>N(}jyF-RXDUUMS9z88 zN0nDI6Nb4*qu*D*OX<2LU)x+T#1Wp5>?lo%vxIDHYMrwxos(k)*bB#u(l8bly5`h0 ztES0T-L~W^shBc0)v~--aY#)iPD9t7&AnXL;B-nNQNwzE<}O~+WPgm0=7Hz*`t-nL zt@&~5WSH2k%3)`|90eoNH5wzAdNJjT)2Z6-FQYxj4l(uU;$moc_EL9rJZ-C&^|NPv zV`}+&G#Vb&qWN*7YxX*NW7PA{JN3l%!>+n?ss~lm@CVw!klmBPMR~o=1!i$`MI%d$ Z2Baz7xK=O5()S`smRuTh;edkx{Q_#d?eqWu From 628ef48300f56c7ea6fe9f7b44c5bd07f555d6c2 Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Wed, 15 Jan 2025 14:28:56 -0600 Subject: [PATCH 26/26] Missing newline --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 18d5609..e87ee6d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -27,4 +27,4 @@ uses: super-linter/super-linter@v7 env: # To report GitHub Actions status checks - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}