-
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
base: master
Are you sure you want to change the base?
Changes from all commits
cc17d7f
95b65bb
0504b83
e2b3c91
c52085f
3655ec8
2708fb6
08916da
12a97eb
a00b949
b0cbeda
5bb6839
d38d319
88504b2
952392f
f4877bf
4592532
39ae227
55b9cc2
d773a16
ceb87cd
1e7ab47
a906ce2
517dd8b
0e23623
9087198
0348820
74b3958
999e16d
75b22dd
628ef48
9343c49
ef78456
fa09a37
55de4fd
4bff69c
4c43291
4c2614e
74ec6ed
bf7be5d
fd38a49
9830e41
6552cb0
acc0bfb
ea2afc1
4ea2115
c2549fa
247ca6b
68019db
1483015
21dc987
ca997bf
567edd9
9a1a78e
989fced
08650dd
8d6c4d7
7e522a0
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 |
|---|---|---|
| @@ -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 | ||
| 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .vscode | ||
| hosts | ||
| ansible.cfg | ||
| .swp | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have an ambivalent approach towards .gitignore files in repos, generally opting for a combination of a well maintained That said, if you want to exclude ViM (swap) files, have a look at https://github.com/github/gitignore/blob/main/Global/Vim.gitignore.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm equivalently ambivalent about it. This was mainly for my convenience. I'll remove it. |
||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| 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,43 @@ | ||
| --- | ||
| role_version: 1.0.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly we should have 0.x.x here. Let's have 1.0.0 when we do an actual release. I also don't think that information goes here, but in |
||
|
|
||
| # Define the Netdata release version we install | ||
| netdata_release_version: "stable" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We call this release channel. Also, the names we typically use are
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ralphm I'll update this to reflect the release channel terminology. As for nightly versus stable, I'd suggest considering the target audience for the Ansible versus the command-line installer. The script defaulting to nightly is unexpected and surprising as a user, and I'd certainly be displeased as a sysadmin if Ansible auto-installed a nightly/non-stable version by default. Happy to be convinced otherwise here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I did not mean having nightly as the default. Just that it can take that as a value, instead of, or next to edge. |
||
|
|
||
| # 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,8 @@ | ||
| --- | ||
| - name: Restart Netdata | ||
| ansible.builtin.systemd: | ||
| name: netdata | ||
| state: restarted | ||
| daemon_reload: true | ||
| enabled: true | ||
| when: ansible_service_mgr == "systemd" |
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.
This is probably an accidental change.