test: fix syntax for ansible-lint

This commit is contained in:
Adrien Waksberg 2023-07-05 11:36:13 +02:00
parent 607b729a99
commit 1fbea9082c
7 changed files with 34 additions and 39 deletions

View file

@ -4,6 +4,6 @@ elasticsearch_config: {}
elasticsearch_default_config:
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
elasticsearch_full_config: '{{ elasticsearch_default_config|combine(elasticsearch_config) }}'
elasticsearch_full_config: "{{ elasticsearch_default_config | combine(elasticsearch_config) }}"
elasticsearch_index_templates: {}
elasticsearch_ilm_policies: {}

View file

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

View file

@ -1,21 +1,21 @@
---
- name: set heap size
- name: Set heap size
ansible.builtin.lineinfile:
path: /etc/elasticsearch/jvm.options
regexp: '^-{{ item }}'
line: '-{{ item }}{{ elasticsearch_heap_size }}'
regexp: "^-{{ item }}"
line: "-{{ item }}{{ elasticsearch_heap_size }}"
loop:
- Xms
- Xmx
notify: restart elasticsearch
notify: Restart elasticsearch
tags: elasticsearch
- name: copy config file
- name: Copy config file
ansible.builtin.copy:
content: '{{ elasticsearch_full_config|to_yaml }}'
content: "{{ elasticsearch_full_config | to_yaml }}"
dest: /etc/elasticsearch/elasticsearch.yml
owner: root
group: elasticsearch
mode: 0640
notify: restart elasticsearch
notify: Restart elasticsearch
tags: elasticsearch

View file

@ -1,20 +1,20 @@
---
- name: copy ilm policies
- name: Copy ilm policies
elasticsearch_ilm_policy:
name: '{{ item.key }}'
phases: '{{ item.value|default({}) }}'
loop: '{{ elasticsearch_ilm_policies|dict2items }}'
name: "{{ item.key }}"
phases: "{{ item.value | default({}) }}"
loop: "{{ elasticsearch_ilm_policies | dict2items }}"
loop_control:
label: '{{ item.key }}'
label: "{{ item.key }}"
run_once: true
tags: elasticsearch
- name: copy index templates
- name: Copy index templates
elasticsearch_template:
name: '{{ item.key }}'
index_patterns: '{{ item.value.index_patterns }}'
settings: '{{ item.value.settings|default({}) }}'
mappings: '{{ item.value.mappings|default({}) }}'
loop: '{{ elasticsearch_index_templates|dict2items }}'
name: "{{ item.key }}"
index_patterns: "{{ item.value.index_patterns }}"
settings: "{{ item.value.settings | default({}) }}"
mappings: "{{ item.value.mappings | default({}) }}"
loop: "{{ elasticsearch_index_templates | dict2items }}"
run_once: true
tags: elasticsearch

View file

@ -1,5 +1,9 @@
---
- import_tasks: packages.yml
- import_tasks: config.yml
- import_tasks: service.yml
- import_tasks: data.yml
- name: Import pacakge tasks
ansible.builtin.import_tasks: packages.yml
- name: Import config tasks
ansible.builtin.import_tasks: config.yml
- name: Import service tasks
ansible.builtin.import_tasks: service.yml
- name: Import data tasks
ansible.builtin.import_tasks: data.yml

View file

@ -1,32 +1,23 @@
---
- name: install dependencies packages
- name: Install dependencies packages
ansible.builtin.package:
name:
- apt-transport-https
- python3-requests
retries: 2
register: result
until: result is succeeded
tags: elasticsearch
- 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: elasticsearch
- name: add repository
- name: Add repository
ansible.builtin.apt_repository:
repo: deb https://artifacts.elastic.co/packages/7.x/apt stable main
tags: elasticsearch
- name: install package
- name: Install package
ansible.builtin.package:
name:
- elasticsearch
retries: 2
register: result
until: result is succeeded
tags: elasticsearch

View file

@ -1,12 +1,12 @@
---
- name: enable and start service
- name: Enable and start service
ansible.builtin.service:
name: elasticsearch
state: started
enabled: true
tags: elasticsearch
- name: wait for api is available
- name: Wait for api is available
ansible.builtin.wait_for:
port: 9200
timeout: 10