test: fix syntax for ansible-lint
This commit is contained in:
parent
e0ba01f338
commit
2aba9435c7
3 changed files with 25 additions and 34 deletions
|
@ -5,7 +5,7 @@ logstash_config: {}
|
||||||
logstash_default_config:
|
logstash_default_config:
|
||||||
path.data: /var/lib/logstash
|
path.data: /var/lib/logstash
|
||||||
path.logs: /var/log/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_inputs: []
|
||||||
logstash_outputs: []
|
logstash_outputs: []
|
||||||
logstash_filters: []
|
logstash_filters: []
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: restart logstash
|
- name: Restart logstash
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: logstash
|
name: logstash
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
|
@ -1,48 +1,39 @@
|
||||||
---
|
---
|
||||||
- name: install dependencies packages
|
- name: Install dependencies packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
- default-jre
|
- default-jre
|
||||||
- gpg
|
- gpg
|
||||||
retries: 2
|
|
||||||
register: result
|
|
||||||
until: result is succeeded
|
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: add repository key
|
- name: Add repository key
|
||||||
ansible.builtin.apt_key:
|
ansible.builtin.apt_key:
|
||||||
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
||||||
retries: 2
|
|
||||||
register: result
|
|
||||||
until: result is succeeded
|
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: add repository
|
- name: Add repository
|
||||||
ansible.builtin.apt_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
|
tags: logstash
|
||||||
|
|
||||||
- name: install package
|
- name: Install package
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- logstash
|
- logstash
|
||||||
retries: 2
|
|
||||||
register: result
|
|
||||||
until: result is succeeded
|
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: copy general config file
|
- name: Copy general config file
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: '{{ logstash_full_config|to_yaml }}'
|
content: "{{ logstash_full_config | to_yaml }}"
|
||||||
dest: /etc/logstash/logstash.yml
|
dest: /etc/logstash/logstash.yml
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart logstash
|
notify: Restart logstash
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: create patterns directory
|
- name: Create patterns directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /etc/logstash/patterns
|
path: /etc/logstash/patterns
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -51,22 +42,22 @@
|
||||||
state: directory
|
state: directory
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: copy patterns files
|
- name: Copy patterns files
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: '{{ item.value }}'
|
content: "{{ item.value }}"
|
||||||
dest: '/etc/logstash/patterns/{{ item.key }}.conf'
|
dest: "/etc/logstash/patterns/{{ item.key }}.conf"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: '{{ logstash_patterns|dict2items }}'
|
loop: "{{ logstash_patterns | dict2items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.key }}'
|
label: "{{ item.key }}"
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: copy input, output and filter files
|
- name: Copy input, output and filter files
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: '{{ item }}.conf.j2'
|
src: "{{ item }}.conf.j2"
|
||||||
dest: '/etc/logstash/conf.d/{{ item }}.conf'
|
dest: "/etc/logstash/conf.d/{{ item }}.conf"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -75,17 +66,17 @@
|
||||||
- input
|
- input
|
||||||
- output
|
- output
|
||||||
- filter
|
- filter
|
||||||
notify: restart logstash
|
notify: Restart logstash
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: install plugins
|
- name: Install plugins
|
||||||
community.general.logstash_plugin:
|
community.general.logstash_plugin:
|
||||||
name: '{{ item.name }}'
|
name: "{{ item.name }}"
|
||||||
state: '{{ item.state|default("present") }}'
|
state: "{{ item.state | default('present') }}"
|
||||||
loop: '{{ logstash_plugins }}'
|
loop: "{{ logstash_plugins }}"
|
||||||
tags: logstash
|
tags: logstash
|
||||||
|
|
||||||
- name: enable and start service
|
- name: Enable and start service
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: logstash
|
name: logstash
|
||||||
state: started
|
state: started
|
||||||
|
|
Loading…
Reference in a new issue