test: fix syntax for ansible-lint

This commit is contained in:
Adrien Waksberg 2023-07-10 10:14:32 +02:00
parent b240f61f50
commit 37ed35956c
2 changed files with 27 additions and 36 deletions

View file

@ -1,5 +1,5 @@
---
- name: restart grafana
- name: Restart grafana
ansible.builtin.service:
name: grafana-server
state: restarted

View file

@ -1,96 +1,87 @@
---
- name: install dependencies packages
- name: Install dependencies packages
ansible.builtin.package:
name:
- apt-transport-https
- gpg
- unzip
retries: 2
register: result
until: result is succeeded
tags: grafana
- name: add repository key
- name: Add repository key
ansible.builtin.get_url:
url: https://apt.grafana.com/gpg.key
dest: /usr/share/keyrings/grafana.key
owner: root
group: root
mode: 0644
retries: 2
register: result
until: result is succeeded
tags: grafana
- name: add repository
- name: Add repository
ansible.builtin.apt_repository:
repo: deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main
filename: grafana
tags: grafana
- name: install grafana package
- name: Install grafana package
ansible.builtin.package:
name:
- grafana
retries: 2
register: result
until: result is succeeded
tags: grafana
- name: copy default environment variables file
- name: Copy default environment variables file
ansible.builtin.template:
src: default.j2
dest: /etc/default/grafana-server
owner: root
group: root
mode: 0644
notify: restart grafana
notify: Restart grafana
tags: grafana
- name: copy configuration file
- name: Copy configuration file
ansible.builtin.template:
src: grafana.ini.j2
dest: /etc/grafana/grafana.ini
owner: root
group: grafana
mode: 0640
notify: restart grafana
notify: Restart grafana
tags: grafana
- name: copy ldap configuration file
- name: Copy ldap configuration file
ansible.builtin.template:
src: ldap.toml.j2
dest: /etc/grafana/ldap.toml
owner: root
group: grafana
mode: 0640
notify: restart grafana
notify: Restart grafana
tags: grafana
- name: install official plugins
- name: Install official plugins
community.grafana.grafana_plugin:
name: '{{ item.name }}'
version: '{{ item.version | default("latest") }}'
state: '{{ item.state | default("present") }}'
loop: '{{ grafana_plugins | selectattr("url", "undefined") }}'
name: "{{ item.name }}"
version: "{{ item.version | default('latest') }}"
state: "{{ item.state | default('present') }}"
loop: "{{ grafana_plugins | selectattr('url', 'undefined') }}"
loop_control:
label: '{{ item.name }}'
notify: restart grafana
label: "{{ item.name }}"
notify: Restart grafana
tags: grafana
- name: install unofficial plugins
- name: Install unofficial plugins
community.grafana.grafana_plugin:
name: '{{ item.name }}'
grafana_plugin_url: '{{ item.url }}'
version: '{{ item.version | default("latest") }}'
state: '{{ item.state | default("present") }}'
loop: '{{ grafana_plugins | selectattr("url", "defined") }}'
name: "{{ item.name }}"
grafana_plugin_url: "{{ item.url }}"
version: "{{ item.version | default('latest') }}"
state: "{{ item.state | default('present') }}"
loop: "{{ grafana_plugins | selectattr('url', 'defined') }}"
loop_control:
label: '{{ item.name }}'
notify: restart grafana
label: "{{ item.name }}"
notify: Restart grafana
tags: grafana
- name: enable and start service
- name: Enable and start service
ansible.builtin.service:
name: grafana-server
state: started