test: fix syntax for ansible-lint

This commit is contained in:
Adrien Waksberg 2023-07-05 11:03:54 +02:00
parent e0ba01f338
commit 2aba9435c7
3 changed files with 25 additions and 34 deletions

View file

@ -5,7 +5,7 @@ logstash_config: {}
logstash_default_config:
path.data: /var/lib/logstash
path.logs: /var/log/logstash
logstash_full_config: '{{ logstash_default_config|combine(logstash_config, recursive=True) }}'
logstash_full_config: "{{ logstash_default_config | combine(logstash_config, recursive=True) }}"
logstash_inputs: []
logstash_outputs: []
logstash_filters: []

View file

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

View file

@ -1,48 +1,39 @@
---
- name: install dependencies packages
- name: Install dependencies packages
ansible.builtin.package:
name:
- apt-transport-https
- default-jre
- gpg
retries: 2
register: result
until: result is succeeded
tags: logstash
- name: add repository key
- name: Add repository key
ansible.builtin.apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
retries: 2
register: result
until: result is succeeded
tags: logstash
- name: add repository
- name: Add repository
ansible.builtin.apt_repository:
repo: 'deb https://artifacts.elastic.co/packages/{{ logstash_major_version }}.x/apt stable main'
repo: "deb https://artifacts.elastic.co/packages/{{ logstash_major_version }}.x/apt stable main"
tags: logstash
- name: install package
- name: Install package
ansible.builtin.package:
name:
- logstash
retries: 2
register: result
until: result is succeeded
tags: logstash
- name: copy general config file
- name: Copy general config file
ansible.builtin.copy:
content: '{{ logstash_full_config|to_yaml }}'
content: "{{ logstash_full_config | to_yaml }}"
dest: /etc/logstash/logstash.yml
owner: root
group: root
mode: 0644
notify: restart logstash
notify: Restart logstash
tags: logstash
- name: create patterns directory
- name: Create patterns directory
ansible.builtin.file:
path: /etc/logstash/patterns
owner: root
@ -51,22 +42,22 @@
state: directory
tags: logstash
- name: copy patterns files
- name: Copy patterns files
ansible.builtin.copy:
content: '{{ item.value }}'
dest: '/etc/logstash/patterns/{{ item.key }}.conf'
content: "{{ item.value }}"
dest: "/etc/logstash/patterns/{{ item.key }}.conf"
owner: root
group: root
mode: 0644
loop: '{{ logstash_patterns|dict2items }}'
loop: "{{ logstash_patterns | dict2items }}"
loop_control:
label: '{{ item.key }}'
label: "{{ item.key }}"
tags: logstash
- name: copy input, output and filter files
- name: Copy input, output and filter files
ansible.builtin.template:
src: '{{ item }}.conf.j2'
dest: '/etc/logstash/conf.d/{{ item }}.conf'
src: "{{ item }}.conf.j2"
dest: "/etc/logstash/conf.d/{{ item }}.conf"
owner: root
group: root
mode: 0644
@ -75,17 +66,17 @@
- input
- output
- filter
notify: restart logstash
notify: Restart logstash
tags: logstash
- name: install plugins
- name: Install plugins
community.general.logstash_plugin:
name: '{{ item.name }}'
state: '{{ item.state|default("present") }}'
loop: '{{ logstash_plugins }}'
name: "{{ item.name }}"
state: "{{ item.state | default('present') }}"
loop: "{{ logstash_plugins }}"
tags: logstash
- name: enable and start service
- name: Enable and start service
ansible.builtin.service:
name: logstash
state: started