-
Notifications
You must be signed in to change notification settings - Fork 9
Modernization rewrite #16
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
Changes from all commits
a6aca50
0638e38
8a9fdd7
4c70a0e
61b1af4
2a6d58f
48799f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: Linting | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
| name: Ansible Lint # Naming the build is important to use it as a status check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Run ansible-lint | ||
| uses: ansible/ansible-lint@main | ||
| with: | ||
| args: "--exclude tests/test.yml --skip-list=role-name" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Integration Test | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
|
|
||
| # Test installation against Debian Bookworm | ||
| debian-test-job: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: debian:bookworm | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| apt-get -y update; apt-get -y upgrade; apt-get -y install ansible | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Test installation | ||
| run: | | ||
| ansible-playbook tests/test.yml | ||
|
|
||
| # Test installation against OpenSUSE Leap 15 | ||
| opensuse-test-job: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: opensuse/leap:15 | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| zypper -n refresh; zypper -n update; zypper -n install ansible tar gzip | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Test installation | ||
| run: | | ||
| ansible-playbook tests/test.yml | ||
|
|
||
| # Test installation against Ubuntu 24.04 | ||
| ubuntu-test-job: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:24.04 | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| apt-get -y update; apt-get -y upgrade; apt-get -y install ansible | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Test installation | ||
| run: | | ||
| ansible-playbook tests/test.yml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,42 @@ | ||
| # 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: true | ||
| 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: true | ||
| 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/" | ||
| ``` | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| # Define the Netdata release channel | ||
| # Supported values: stable, nightly (alias for edge), edge | ||
| netdata_release_channel: "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: false | ||
| 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 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| - name: Restart Netdata | ||
| ansible.builtin.systemd: | ||
| name: netdata | ||
| state: restarted | ||
| daemon_reload: true | ||
| enabled: true | ||
| when: ansible_service_mgr == "systemd" | ||
|
|
||
| - name: Reload Netdata claiming state | ||
| ansible.builtin.command: netdatacli reload-claiming-state | ||
| changed_when: true | ||
| failed_when: false |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, possibly not as part of this PR, but definitely before publishing this to Galaxy, we need to expand this (and also https://learn.netdata.cloud/) with all the current tweakables and expand example usage.