You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/elastic/tasks/update_settings.yml

49 lines
1.3 KiB
YAML

---
### tags:
### update_settings
- name: "Wait for <https://{{ inventory_hostname }}:9200>"
ansible.builtin.uri:
url: "https://{{ inventory_hostname }}:9200"
user: "{{ elastic_admin_username }}"
password: "{{ elastic_admin_password }}"
ca_path: "{{ service_base_path }}/{{ elastic_id }}/certs/ca/ca.crt"
method: GET
status_code: 200
return_content: yes
register: elastic_stats
until: elastic_stats.status == 200
retries: 15
delay: 6
tags:
- update_config
- update_settings
- name: "Set VAR"
ansible.builtin.set_fact:
es_cluster_settings:
persistent:
cluster.max_shards_per_node: "{{ elastic_cluster_settings_max_shards }}"
tags:
- update_config
- update_settings
- name: "Set cluster config"
ansible.builtin.uri:
url: "https://localhost:9200/_cluster/settings"
method: PUT
ca_path: "{{ service_base_path }}/{{ elastic_id }}/certs/ca/ca.crt"
user: "{{ elastic_admin_username }}"
password: "{{ elastic_admin_password }}"
headers:
Content-Type: "application/json"
Accept: "application/json"
body: "{{ es_cluster_settings | to_json }}"
force_basic_auth: true
status_code: 200
when:
- inventory_hostname == groups['elastic'][0]
tags:
- update_config
- update_settings