Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernization rewrite #16

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cc17d7f
Add .gitignore
pid1 Dec 9, 2024
95b65bb
Initial rewrite commit
pid1 Dec 9, 2024
0504b83
Debian functional
pid1 Dec 9, 2024
e2b3c91
Apply config, remove hosts file
pid1 Dec 9, 2024
c52085f
Re-organize, moving everything up a directory.
pid1 Dec 9, 2024
3655ec8
Update to match current rewrite
pid1 Jan 8, 2025
2708fb6
Install chart support if configured, false by default
pid1 Jan 13, 2025
08916da
Merge pull request #5 from pid1/chart-support
pid1 Jan 13, 2025
12a97eb
Repos and chart support for OpenSUSE
pid1 Jan 13, 2025
a00b949
Merge pull request #6 from pid1/chart-support
pid1 Jan 13, 2025
b0cbeda
Lay down and enable chart files
pid1 Jan 14, 2025
5bb6839
Allow setting custom directory of chart templates
pid1 Jan 14, 2025
d38d319
Update node claim to Netdata 2.0
pid1 Jan 14, 2025
88504b2
Merge pull request #8 from pid1/chart-support
pid1 Jan 14, 2025
952392f
Add missing newlines, bump version
pid1 Jan 15, 2025
f4877bf
Linting fixes
pid1 Jan 15, 2025
4592532
Merge pull request #9 from pid1/linting
pid1 Jan 15, 2025
39ae227
Fix line length
pid1 Jan 15, 2025
55b9cc2
Merge pull request #10 from pid1/linting
pid1 Jan 15, 2025
d773a16
Fix chart directory path
pid1 Jan 15, 2025
ceb87cd
Various small bugfixes
pid1 Jan 15, 2025
1e7ab47
Update installation handling on Debian
pid1 Jan 15, 2025
a906ce2
Set role name and fix Suse install
pid1 Jan 15, 2025
517dd8b
Fix node claim and chart management
pid1 Jan 15, 2025
0e23623
Fixed wrong permissions
pid1 Jan 15, 2025
9087198
Match upstream
pid1 Jan 15, 2025
0348820
Clarity
pid1 Jan 15, 2025
74b3958
Further permissions adjustments
pid1 Jan 15, 2025
999e16d
Ignore swapfiles
pid1 Jan 15, 2025
75b22dd
Remove erroneously committed swap file
pid1 Jan 15, 2025
628ef48
Missing newline
pid1 Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .ansible-lint

This file was deleted.

3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -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 }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode
hosts
ansible.cfg
test.yml
.swp
81 changes: 37 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,40 @@
# 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`

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

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.
- Debian 12
- SUSE Linux Enterprise Server 15

## 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/"
```
10 changes: 0 additions & 10 deletions ansible.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions claim.yml

This file was deleted.

42 changes: 42 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
role_version: 1.0.0

# Define the Netdata release version we install
netdata_release_version: "stable"

# Define if we manage the Netdata configuration
netdata_manage_config: false

# Define if we install chart support
netdata_manage_charts: 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_proxy: ""
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: "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
netdata_go_collector_plugins: []
# - name: prometheus
# config:
# job:
# - name: local
# url: http://127.0.0.1:9090/metrics
5 changes: 0 additions & 5 deletions group_vars/all

This file was deleted.

6 changes: 6 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Restart Netdata
ansible.builtin.systemd:
name: netdata
state: restarted
enabled: true
2 changes: 0 additions & 2 deletions host_vars/centos7

This file was deleted.

26 changes: 0 additions & 26 deletions hosts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
galaxy_info:
author: Netdata packaging team
description: real-time charts for system monitoring (https://netdata.cloud/)
author: Ralph Meijer
description: Deploys the NetData agent
company: Netdata Inc.
role_name: netdata

license: GPL-3.0-or-later
license: Apache-2.0

min_ansible_version: "2.1"

Expand Down
92 changes: 0 additions & 92 deletions molecule/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions molecule/common/Dockerfile_debian10.j2

This file was deleted.

4 changes: 0 additions & 4 deletions molecule/common/Dockerfile_debian11.j2

This file was deleted.

17 changes: 0 additions & 17 deletions molecule/common/Dockerfile_ubuntu1804.j2

This file was deleted.

17 changes: 0 additions & 17 deletions molecule/common/Dockerfile_ubuntu2004.j2

This file was deleted.

Loading