Skip to content

Conversation

@pid1
Copy link
Contributor

@pid1 pid1 commented Jan 8, 2025

This is an attempt to modernize the Netdata Ansible.

This currently supports Debian, Ubuntu, and OpenSUSE, but additional distributions can be supported easily and in a consistent pattern.

Patches welcome.

Fixes #10
Fixes #7
Fixes #12 via deprecation, though we should handle binary installs gracefully.

Deprecates #8 - I would like to see Molecule tests re-added in the future.

@pid1 pid1 requested a review from a team as a code owner January 8, 2025 19:28
Copy link
Member

@ralphm ralphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pid1 Here is my preliminary feedback, as discussed.

@@ -1,2 +1,3 @@
# For the time being, @Ferroin is responsible for everything here.
# For the time being, @Ferroin is responsible for everything here
Copy link
Member

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.

.vscode
hosts
ansible.cfg
.swp
Copy link
Member

Choose a reason for hiding this comment

The 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 ~/.config/git/ignore and project specifc .git/info/exclude in the working tree. On the other hand, our Agent repo has a very extensive one.

That said, if you want to exclude ViM (swap) files, have a look at https://github.com/github/gitignore/blob/main/Global/Vim.gitignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

# 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
Copy link
Member

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.

@@ -0,0 +1,43 @@
---
role_version: 1.0.0
Copy link
Member

Choose a reason for hiding this comment

The 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 meta/main.yml in a galaxy_info object, or in galaxy.yml?

role_version: 1.0.0

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We call this release channel.

Also, the names we typically use are stable and nightly, but the the native build repos use edge instead of nightly. I think it would be good so be able to put nightly as a value here and it doing the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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.

owner: root
group: root
mode: '0644'
notify: Restart Netdata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need to restart the Agent in order for it to process claim.conf. The Netdata CLI has a reload-claiming-state command that calls a corresponding API in the Agent to just reload its config and (re-)connect to Cloud.

It might be nice to prevent restarting Netdata if we don't need to because of other notify calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice, I didn't realize that occurred. I'll remove the restart.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But add the reload as a handler.

{% if netdata_proxy %}
proxy = {{ netdata_proxy }}
{% endif %}
insecure = 'no'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that no is the default and we are not making this into a variable, we can do two things:

  1. Just remove it from the template.
  2. Have some kind of dict for other options, like insecure, providing a way to control it.

I'm favoring option 1 right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove that.


- name: Lay down charts.d.conf
ansible.builtin.copy:
content: 'enable_all_charts="yes"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default. Why make this explicit, while not offering any other configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, is this enabled by default without charts.d.conf existing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -0,0 +1,37 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is identical to install-debian.yml. Can we consolidate, e.g. by using ansible_pkg_mgr?

@@ -0,0 +1,2 @@
---
# vars file for role
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this, if empty.

@CLAassistant
Copy link

CLAassistant commented Apr 1, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ pid1
❌ agomerz
You have signed the CLA already but the status is still pending? Let us recheck it.

@sashwathn
Copy link

@agomerz : Can you please sign the CLA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

netdatacli and netdata-claim.sh not installed Properly maintain this repo Publish roles separately ? on ansible galaxy ?

5 participants