diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2e5dc7..c69ae87 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,26 @@ Grafana.Grafana Release Notes .. contents:: Topics +v2.0.0 +====== + +Release Summary +--------------- + +Updated Grafana Agent Role + +Major Changes +------------- + +- Added Lint support +- Configs for server, metrics, logs, traces, and integrations +- Installation of the latest version +- Local installations when internet connection is not allowed +- Only download binary to controller once instead of hosts +- Skip install if the agent is already installed and the version is the same as the requested version +- Support for Grafana Agent Flow +- Validation of variables + v1.1.1 ====== @@ -74,8 +94,8 @@ Minor Changes ------------- - Add a fail method to modules source code if `requests` library is not present -- Fixed markup for arg option in Documenation -- Updated Documenation with `notes` to specify if the check_mode feature is supported by modules +- Fixed markup for arg option in Documentation +- Updated Documentation with `notes` to specify if the check_mode feature is supported by modules - removed `supports_check_mode=True` from source code of modules v1.0.2 diff --git a/README.md b/README.md index 2c36fa3..4cc3cd2 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,11 @@ Before the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible- 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.1.2`. +module's documentation in `2.0.1`. + +To generate changelogs for a new release, Refer [Generating Changelogs](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_changelogs.html#generating-changelogs) + +To generate the tarball to be uploaded on Ansible Galaxy, Refer [Building collection tarball](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_distributing.html#building-your-collection-tarball) ## Code of Conduct diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index 97078b3..cd43706 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -1,4 +1,3 @@ ---- objects: role: {} plugins: @@ -57,4 +56,4 @@ plugins: strategy: {} test: {} vars: {} -version: 1.1.1 +version: 2.0.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index b377c84..e9b9212 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1,4 +1,3 @@ ---- ancestor: null releases: 0.0.1: @@ -16,7 +15,7 @@ releases: 0.0.4: changes: bugfixes: - - Fix an issue with `cloud_stack` idempotency + - Fix an issue with `cloud_stack` idempotency release_date: '2022-08-10' 0.0.5: changes: @@ -25,7 +24,7 @@ releases: 0.0.6: changes: minor_changes: - - Idempotency updates to cloud_api_key and datasource modules + - Idempotency updates to cloud_api_key and datasource modules release_date: '2022-08-10' 0.0.7: changes: @@ -46,37 +45,54 @@ releases: 1.0.3: changes: minor_changes: - - Add a fail method to modules source code if `requests` library is not present - - Fixed markup for arg option in Documentation - - Updated Documentation with `notes` to specify if the check_mode feature is - supported by modules - - removed `supports_check_mode=True` from source code of modules + - Add a fail method to modules source code if `requests` library is not present + - Fixed markup for arg option in Documentation + - Updated Documentation with `notes` to specify if the check_mode feature is + supported by modules + - removed `supports_check_mode=True` from source code of modules release_date: '2022-10-20' 1.0.4: changes: bugfixes: - - Fixed cases where cloud_stack and alert_contact_point modules do not return a tuple when nothing in loop matches + - Fixed cases where cloud_stack and alert_contact_point modules do not return + a tuple when nothing in loop matches major_changes: - - All modules except dashboard and datasource modules now support idempotency + - All modules except dashboard and datasource modules now support idempotency minor_changes: - - All modules use `missing_required_lib`` to compose the message for module.fail_json() when required library is missing from host + - All modules use `missing_required_lib`` to compose the message for module.fail_json() + when required library is missing from host release_summary: Bug fixes and idempotency fixes for modules release_date: '2022-11-01' 1.0.5: changes: minor_changes: - - 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_date: '2022-11-10' 1.1.0: changes: major_changes: - - Added Role for Grafana Agent + - Added Role for Grafana Agent release_summary: Added Role to deploy Grafana Agent on linux hosts release_date: '2022-11-22' 1.1.1: changes: minor_changes: - - Updated the return message in grafana.grafana.folder module - release_summary: Updated return description and value for grafana.grafana.folder module + - Updated the return message in grafana.grafana.folder module + release_summary: Updated return description and value for grafana.grafana.folder + module release_date: '2023-02-08' + 2.0.0: + changes: + major_changes: + - Added Lint support + - Configs for server, metrics, logs, traces, and integrations + - Installation of the latest version + - Local installations when internet connection is not allowed + - Only download binary to controller once instead of hosts + - Skip install if the agent is already installed and the version is the same + as the requested version + - Support for Grafana Agent Flow + - Validation of variables + release_summary: Updated Grafana Agent Role + release_date: '2023-03-27' diff --git a/galaxy.yml b/galaxy.yml index 6902d8c..8991d85 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: grafana name: grafana -version: 1.1.1 +version: 2.0.0 readme: README.md authors: - Grafana Labs diff --git a/roles/grafana_agent/README.md b/roles/grafana_agent/README.md index ae4b4d0..1af8c75 100644 --- a/roles/grafana_agent/README.md +++ b/roles/grafana_agent/README.md @@ -30,7 +30,8 @@ All variables which can be overridden are stored in [./defaults/main.yaml](./def | `grafana_agent_user_createhome` | `false` | whether or not to create a home directory for the user | | `grafana_agent_local_binary_file` | `""` | full path to the local binary if already downloaded or built on the controller, this should only be set, if ansible is not downloading the binary and you have manually downloaded the binary | | `grafana_agent_flags_extra` | see [./defaults/main.yaml](./defaults/main.yaml) | dictionary of additional command-line flags, run grafana-agent --help for a complete list. [Docs](https://grafana.com/docs/agent/latest/configuration/flags/) | -| `grafana_agent_env_vars` | `{}` | dictionary of key/pair values to write to the environment file that is loaded by the service, with the flag `--config.expand-env=true` any generated config files will support the expansion of environment variables at runtime by referencing ${ENVVAR}. be aware of boolean values, when output they will result in the proper-cased string "True" and "False" | +| `grafana_agent_env_vars` | `{}` | sets Environment variables in the systemd service configuration. | +| `grafana_agent_env_file_vars` | `{}` | dictionary of key/pair values to write to the environment file that is loaded by the service, with the flag `--config.expand-env=true` any generated config files will support the expansion of environment variables at runtime by referencing ${ENVVAR}. be aware of boolean values, when output they will result in the proper-cased string "True" and "False" | | `grafana_agent_provisioned_config_file` | `""` | path to a config file on the controller that will be used instead of the provided configs below if specified. | | `grafana_agent_server_config` | see [./defaults/main.yaml](./defaults/main.yaml) | Configures the server of the Agent used to enable self-scraping, [Docs](https://grafana.com/docs/agent/latest/configuration/server-config/) | | `grafana_agent_metrics_config` | see [./defaults/main.yaml](./defaults/main.yaml) | Configures metric collection, [Docs](https://grafana.com/docs/agent/latest/configuration/metrics-config/) | @@ -50,4 +51,5 @@ See [LICENSE](https://github.com/grafana/grafana-ansible-collection/blob/main/LI - [Grafana Labs](https://github.com/grafana) - [Ishan Jain](https://github.com/ishanjainn) -- [Ishan Jain](https://github.com/bentonam) +- [Aaron Benton](https://github.com/bentonam) +- [Vitaly Zhuravlev](https://github.com/v-zhuravlev) diff --git a/roles/grafana_agent/defaults/main.yaml b/roles/grafana_agent/defaults/main.yaml index 43b84a6..6e41eb0 100644 --- a/roles/grafana_agent/defaults/main.yaml +++ b/roles/grafana_agent/defaults/main.yaml @@ -59,10 +59,13 @@ grafana_agent_flags_extra: server.http.address: 127.0.0.1:12345 server.grpc.address: 127.0.0.1:12346 +# sets Environment variables in the systemd service configuration. +grafana_agent_env_vars: {} + # dictionary of key/pair values to write to the environment file that is loaded by the service, with the flag --config.expand-env=true # any generated config files will support the expansion of environment variables at runtime by referencing ${ENVVAR}. # be aware of boolean values, when output they will result in the proper-cased string "True" and "False" -grafana_agent_env_vars: {} +grafana_agent_env_file_vars: {} # path to a config file on the controller that will be used instead of the provided configs below if specified. grafana_agent_provisioned_config_file: "" diff --git a/roles/grafana_agent/tasks/preflight/vars.yaml b/roles/grafana_agent/tasks/preflight/vars.yaml index 7141e38..dc133a4 100644 --- a/roles/grafana_agent/tasks/preflight/vars.yaml +++ b/roles/grafana_agent/tasks/preflight/vars.yaml @@ -24,6 +24,7 @@ - grafana_agent_local_binary_file - grafana_agent_flags_extra - grafana_agent_env_vars + - grafana_agent_env_file_vars - grafana_agent_provisioned_config_file - grafana_agent_metrics_config - grafana_agent_logs_config diff --git a/roles/grafana_agent/templates/EnvironmentFile.j2 b/roles/grafana_agent/templates/EnvironmentFile.j2 index 33b1ac6..875d941 100644 --- a/roles/grafana_agent/templates/EnvironmentFile.j2 +++ b/roles/grafana_agent/templates/EnvironmentFile.j2 @@ -4,6 +4,6 @@ AGENT_MODE={{ grafana_agent_mode }} GOMAXPROCS={{ ansible_processor_vcpus|default(ansible_processor_count) }} -{% for key, value in grafana_agent_env_vars.items() %} +{% for key, value in grafana_agent_env_file_vars.items() %} {{key}}={{value}} {% endfor %} diff --git a/roles/grafana_agent/templates/grafana-agent.service.j2 b/roles/grafana_agent/templates/grafana-agent.service.j2 index 247c77e..08a7b67 100644 --- a/roles/grafana_agent/templates/grafana-agent.service.j2 +++ b/roles/grafana_agent/templates/grafana-agent.service.j2 @@ -12,6 +12,9 @@ Type=simple User={{ grafana_agent_user }} Group={{ grafana_agent_user_group }} WorkingDirectory={{ grafana_agent_data_dir }} +{% for key, value in grafana_agent_env_vars.items() %} +Environment={{key}}={{value}} +{% endfor %} EnvironmentFile={{ grafana_agent_config_dir }}/{{ grafana_agent_env_file}} ExecStart={{ grafana_agent_install_dir }}/{{ grafana_agent_binary }} \