Adding Grafana Agent ansible role
This commit is contained in:
parent
fb36b39ceb
commit
98516c1f71
2
.github/workflows/ci-test.yml
vendored
2
.github/workflows/ci-test.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.11
|
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- stable-2.13
|
||||||
|
- stable-2.14
|
||||||
- devel
|
- devel
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -5,6 +5,19 @@ Grafana.Grafana Release Notes
|
|||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
|
||||||
|
v1.1.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Added Role to deploy Grafana Agent on linux hosts
|
||||||
|
|
||||||
|
Major Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Added Role for Grafana Agent
|
||||||
|
|
||||||
v1.0.5
|
v1.0.5
|
||||||
======
|
======
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ We plan to regularly release new minor or bugfix versions once new features or b
|
|||||||
Releasing the current major version on GitHub happens from the `main` branch by the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible-collection/blob/main/.github/workflows/release.yml)
|
Releasing the current major version on GitHub happens from the `main` branch by the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible-collection/blob/main/.github/workflows/release.yml)
|
||||||
Before the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible-collection/blob/main/.github/workflows/release.yml) is run, Contributors should push the new version on Ansible Galaxy Manually.
|
Before the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible-collection/blob/main/.github/workflows/release.yml) is run, Contributors should push the new version on Ansible Galaxy Manually.
|
||||||
|
|
||||||
We currently are not planning any deprecations or new major releases. The current landscape includes minor version updates for Module's documentation in 1.0.6.
|
We currently are not planning any deprecations or new major releases. The current landscape includes minor version updates for Module's documentation in 1.1.1.
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
This collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). Please read and familiarize yourself with this doc
|
This collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). Please read and familiarize yourself with this doc
|
||||||
|
@ -53,4 +53,4 @@ plugins:
|
|||||||
shell: {}
|
shell: {}
|
||||||
strategy: {}
|
strategy: {}
|
||||||
vars: {}
|
vars: {}
|
||||||
version: 1.0.5
|
version: 1.1.0
|
||||||
|
@ -69,3 +69,9 @@ releases:
|
|||||||
- Added Note to datasource and dashboard module about not supporting Idempotency
|
- Added Note to datasource and dashboard module about not supporting Idempotency
|
||||||
release_summary: Add Note to modules which don't support Idempotency
|
release_summary: Add Note to modules which don't support Idempotency
|
||||||
release_date: '2022-11-10'
|
release_date: '2022-11-10'
|
||||||
|
1.1.0:
|
||||||
|
changes:
|
||||||
|
major_changes:
|
||||||
|
- Added Role for Grafana Agent
|
||||||
|
release_summary: Added Role to deploy Grafana Agent on linux hosts
|
||||||
|
release_date: '2022-11-17'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace: grafana
|
namespace: grafana
|
||||||
name: grafana
|
name: grafana
|
||||||
version: 1.0.5
|
version: 1.1.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Grafana Labs <grafana.com>
|
- Grafana Labs <grafana.com>
|
||||||
|
20
roles/grafana_agent/defaults/main.yml
Normal file
20
roles/grafana_agent/defaults/main.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
install_unzip: true
|
||||||
|
update_package_cache: yes
|
||||||
|
agent_version: 0.29.0
|
||||||
|
linux_architecture: linux-amd64
|
||||||
|
agent_binary_location: /usr/local/bin
|
||||||
|
agent_config_location: /etc/grafana
|
||||||
|
agent_config_local_path: agent-config.yml
|
||||||
|
|
||||||
|
systemd_service_state: restarted
|
||||||
|
systemd_config: |
|
||||||
|
[Unit]
|
||||||
|
Description=Grafana Agent
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=grafana-agent
|
||||||
|
ExecStart={{ agent_binary_location }}/agent-{{ linux_architecture }} --config.file={{ agent_config_location }}/agent-config.yaml
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
25
roles/grafana_agent/meta/main.yml
Normal file
25
roles/grafana_agent/meta/main.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
role_name: grafana_agent
|
||||||
|
author: Ishan Jain
|
||||||
|
description: Ansible Role to deploy Grafana Agent on Linux hosts.
|
||||||
|
license: "GPL-3.0-or-later"
|
||||||
|
min_ansible_version: "2.11"
|
||||||
|
platforms:
|
||||||
|
- name: Fedora
|
||||||
|
versions:
|
||||||
|
- "all"
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- "all"
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- "all"
|
||||||
|
- name: EL
|
||||||
|
versions:
|
||||||
|
- "all"
|
||||||
|
galaxy_tags:
|
||||||
|
- grafana
|
||||||
|
- observability
|
59
roles/grafana_agent/tasks/main.yml
Normal file
59
roles/grafana_agent/tasks/main.yml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
- name: Install unzip on Ubuntu/Debian
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: unzip
|
||||||
|
state: present
|
||||||
|
update_cache: "{{ update_package_cache }}"
|
||||||
|
when: install_unzip | bool and (ansible_distribution == "Ubuntu" or ansible_distribution == "Debian")
|
||||||
|
|
||||||
|
- name: Install unzip on Fedora/CentOS
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: unzip
|
||||||
|
state: latest
|
||||||
|
update_cache: "{{ update_package_cache }}"
|
||||||
|
when: install_unzip | bool and (ansible_distribution == "Fedora" or ansible_distribution == "CentOS")
|
||||||
|
|
||||||
|
- name: Download Grafana Agent binary from GitHub
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "https://github.com/grafana/agent/releases/download/v{{ agent_version }}/agent-{{ linux_architecture }}.zip"
|
||||||
|
dest: "/tmp/agent-linux.zip"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Unarchive the Grafana Agent binary
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: "/tmp/agent-linux.zip"
|
||||||
|
dest: "{{ agent_binary_location }}"
|
||||||
|
remote_src: yes
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Create directory for Grafana Agent Configuration file
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ agent_config_location }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Create configuration file for Grafana Agent
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ agent_config_local_path }}"
|
||||||
|
dest: "{{ agent_config_location }}/agent-config.yaml"
|
||||||
|
|
||||||
|
- name: Add user 'grafana-agent'
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: grafana-agent
|
||||||
|
create_home: no
|
||||||
|
shell: /bin/false
|
||||||
|
|
||||||
|
- name: Create service file for Grafana Agent
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "/etc/systemd/system/grafana-agent.service"
|
||||||
|
content: "{{ systemd_config }}"
|
||||||
|
|
||||||
|
- name: Start Grafana Agent service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
name: grafana-agent
|
||||||
|
enabled: yes
|
||||||
|
state: "{{ systemd_service_state }}"
|
||||||
|
|
||||||
|
- name: Checking grafana-agent service status
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: systemctl is-active grafana-agent
|
Loading…
Reference in New Issue
Block a user