Skip to content

Commit

Permalink
Configure Elasticsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
m-pilarczyk committed Jan 25, 2023
1 parent c628c5a commit 3ebf974
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tasks/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
file: "../vars/main.yaml"

- name: "{{ service_name }} | config | Load config"
ansible.builtin.include_vars: "{{ item }}"
ansible.builtin.include_vars: "{{ config_file }}"
loop_control:
loop_var: 'config_file'
with_first_found:
- files: ["{{ service_name }}.yaml"]
skip: true
Expand Down
12 changes: 12 additions & 0 deletions tasks/setup/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
update_cache: true
when: "'elasticsearch' not in ansible_facts.packages"

- name: "{{ service_name }} | setup | elastic | Set elastic config"
ansible.builtin.lineinfile:
path: "etc/elasticsearch/elasticsearch.yml"
regexp: "^{{ it.key }}\\s*:"
line: "{{ it.key }}: {{ it.value }}"
loop:
- { key: 'bootstrap.memory_lock', value: 'true' }
- { key: 'indices.memory.index_buffer_size', value: '1GB' }
loop_control:
label: "{{ it.key }}"
loop_var: 'it'

- name: "{{ service_name }} | setup | elastic | Start Elasticsearch"
ansible.builtin.service:
name: elasticsearch
Expand Down
4 changes: 2 additions & 2 deletions tasks/setup/mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- { key: 'innodb_log_files_in_group', value: '2' }
- { key: 'innodb_log_buffer_size', value: '64M' }
- { key: 'innodb_flush_log_at_trx_commit', value: '2' }
- { key: 'innodb_lock_wait_timeout', value: '2' }
- { key: 'innodb_lock_wait_timeout', value: '4' }
- { key: 'innodb_thread_concurrency', value: '0' }
- { key: 'innodb_flush_method', value: 'O_DIRECT_NO_FSYNC' }
- { key: 'innodb_buffer_pool_load_at_startup', value: 'ON' }
Expand All @@ -74,7 +74,7 @@
- name: "{{ service_name }} | setup | mysql | Start Percona"
ansible.builtin.service:
name: mysql
state: started
state: restarted

- name: "{{ service_name }} | setup | mysql | Create DB user '{{ service_user }}'" # noqa no-changed-when risky-shell-pipe
ansible.builtin.shell: echo "CREATE USER IF NOT EXISTS '{{ service_user }}'@'localhost' IDENTIFIED BY '{{ service_user }}';" | mysql
Expand Down
4 changes: 2 additions & 2 deletions tasks/setup/php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- name: "{{ service_name }} | setup | php | Config PHP CLI"
ansible.builtin.lineinfile:
path: "/etc/php/{{ php_version }}/cli/php.ini"
regexp: "^{{ it.key }} ="
regexp: "^{{ it.key }}\\s*="
line: "{{ it.key }} = {{ it.value }}"
loop:
- { key: 'max_execution_time', value: '300' }
Expand All @@ -50,7 +50,7 @@
loop:
- { key: 'post_max_size', value: '32M' }
- { key: 'upload_max_filesize', value: '32M' }
- { key: 'memory_limit', value: '512M' }
- { key: 'memory_limit', value: '1G' }
loop_control:
label: "{{ it.key }}"
loop_var: 'it'
Expand Down

0 comments on commit 3ebf974

Please sign in to comment.