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

Ansible Role for deploying grafana-agent #734

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akraitman
Copy link
Contributor

No description provided.

@akraitman akraitman requested a review from ktdreyer April 24, 2023 19:08
Copy link
Member

@ktdreyer ktdreyer left a comment

Choose a reason for hiding this comment

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

This is a good start and there are some things we could improve.

I recommend merging #733 first, then rebasing this PR onto main, so that the linter will run on this PR.

@@ -0,0 +1,6 @@
---
- name: "Restart grafana agent instance - linux"
Copy link
Member

Choose a reason for hiding this comment

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

Simpler is better

Suggested change
- name: "Restart grafana agent instance - linux"
- name: "Restart grafana agent"

dest: "/etc/grafana-agent.yaml"
mode: "0550"
group: "grafana-agent"
notify: "Restart grafana agent instance - linux"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
notify: "Restart grafana agent instance - linux"
notify: "Restart grafana agent"

roles/grafana_agent/tasks/main.yml Outdated Show resolved Hide resolved
roles/grafana_agent/templates/grafana_repo.yml.j2 Outdated Show resolved Hide resolved
roles/grafana_agent/tasks/main.yml Outdated Show resolved Hide resolved
@akraitman akraitman force-pushed the wip-grafana-agent branch 3 times, most recently from 1b56324 to 69c68f5 Compare April 27, 2023 17:43
ansible.builtin.yum_repository:
baseurl: "https://rpm.grafana.com"
name: "grafana"
description: "Grafana's repository"
Copy link
Member

Choose a reason for hiding this comment

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

Please enable GPG checking:

Suggested change
description: "Grafana's repository"
description: "grafana"
gpgcheck: true
gpgkey: https://rpm.grafana.com/gpg.key


- name: "Import Grafana GPG key"
become: true
ansible.builtin.apt_key:
Copy link
Member

Choose a reason for hiding this comment

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

I understand we've used apt_key for a while, but as the apt_key docs explain, the latest Debian/Ubuntu will no longer support this.

It's ok for today, but in the future, prepare to use the alternative example in the apt_repository docs (the get_url module plus the signed-by setting).

Copy link
Member

Choose a reason for hiding this comment

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

We should do this the new way, and we should also work on fixing all the rest of the apt-key invocations. One of the Debs already requires it and I'm not sure but I think newer Ubuntu may as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should do this the new way, and we should also work on fixing all the rest of the apt-key invocations. One of the Debs already requires it and I'm not sure but I think newer Ubuntu may as well.

I updated the key import task to ansible.builtin.get_url and tested it on apt/rpm machines.

roles/grafana_agent/defaults/main.yml Outdated Show resolved Hide resolved
roles/grafana_agent/defaults/main.yml Outdated Show resolved Hide resolved
roles/grafana_agent/defaults/main.yml Outdated Show resolved Hide resolved
roles/grafana_agent/defaults/main.yml Show resolved Hide resolved
@ktdreyer
Copy link
Member

ktdreyer commented May 8, 2023

Could you merge #733 first, then rebase this PR onto main? Then the linter will run on this PR.

@ktdreyer
Copy link
Member

ktdreyer commented May 8, 2023

I don't think we should put variables into main.yml unless we'll set different values for different hosts. You can always template those settings out later and move them to main.yml later in future pull requests.

@ktdreyer
Copy link
Member

Adam and I chatted about this PR.

  • These variables exist because Adam sets them with extra_vars when running the playbook interactively on his computer.
  • We discussed the possibility of tracking those particular non-default choices in host_vars or group_vars instead so that we can understand how and why Adam made those choices to alter the values from the defaults.

@dmick
Copy link
Member

dmick commented Mar 22, 2024

@akraitman have you resolved all of Ken's earlier issues?

@akraitman
Copy link
Contributor Author

akraitman commented Mar 26, 2024

@akraitman have you resolved all of Ken's earlier issues?

Yes, I removed the if statement from grafana-agent.yaml.j2 and removed the "agent_metrics" variable from defaults/main.yml

Signed-off-by: Adam Kraitman <akraitma@redhat.com>
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.

3 participants