You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.5 KiB

#
# Task: configure mysql
#
#
- script:
cmd: files/memory.py {{ current_memory.stdout }}
executable: /usr/bin/python3
register: mariadb_memory
delegate_to: localhost
vars:
ansible_become: false
- name: if memory not matching for available templates, end host
meta: end_host
when:
mariadb_memory_available | select('match', mariadb_memory.stdout_lines[0]) | list | length == 0
#
#
#
- name: adding to file if not set
lineinfile:
state: present
path: /etc/mysql/mariadb.cnf
line: "!include /etc/mysql/config.cnf"
regex: '^!include /etc/mysql/config.cnf'
changed_when: false
#
#
#
- name: create config, from default
template:
src: default.conf
dest: /etc/mysql/config.cnf
owner: root
group: root
mode: '0644'
#
# adding config from template
#
- name: append template from template based on memory
blockinfile:
dest: /etc/mysql/config.cnf
block: "{{ lookup('template', 'mariadb_' ~ mariadb_memory.stdout_lines[0] ~ 'gb.conf') }}"
insertbefore: "^\\[client\\]"
#
# change limits
#
- name:
blockinfile:
dest: /etc/security/limits.conf
block: |
mysql soft nofile 65535
mysql hard nofile 65535
#
#
#
- name: adding default for enviroments variables
template:
src: extension.conf
dest: /etc/systemd/system/mariadb.service.d/extension.conf
owner: root
group: root
mode: '0644'
#
#
#
- name: System Daemon Reload
shell: systemctl daemon-reload
#
#
#
- name: Restart service httpd, in all cases
service:
name: mysql
state: restarted