mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-09 19:30:18 +01:00
Merge pull request #76 from BlackMesh/allow_custom_variables
Allow configuration of variables not currently supported
This commit is contained in:
commit
a3d3bf21d9
6 changed files with 39 additions and 0 deletions
|
@ -32,6 +32,10 @@ Whether MySQL should be enabled on startup.
|
|||
|
||||
Whether the global my.cnf should be overwritten each time this role is run. Setting this to `no` tells Ansible to only create the `my.cnf` file if it doesn't exist. This should be left at its default value (`yes`) if you'd like to use this role's variables to configure MySQL.
|
||||
|
||||
mysql_config_include_files: []
|
||||
|
||||
A list of files that should override the default global my.cnf. Each item in the array requires a "src" parameter which is a path to a file. An optional "force" parameter can force the file to be updated each time ansible runs.
|
||||
|
||||
mysql_databases: []
|
||||
|
||||
The MySQL databases to create. A database has the values `name`, `encoding` (defaults to `utf8`), `collation` (defaults to `utf8_general_ci`) and `replicate` (defaults to `1`, only used if replication is configured). The formats of these are the same as in the `mysql_db` module.
|
||||
|
|
|
@ -70,6 +70,11 @@ mysql_log: ""
|
|||
mysql_log_error: /var/log/mysql.err
|
||||
mysql_syslog_tag: mysql
|
||||
|
||||
mysql_config_include_files: []
|
||||
# - src: path/relative/to/playbook/file.cnf
|
||||
# - { src: path/relative/to/playbook/anotherfile.cnf, force: yes }
|
||||
|
||||
|
||||
# Databases.
|
||||
mysql_databases: []
|
||||
# Full example:
|
||||
|
|
|
@ -9,6 +9,26 @@
|
|||
force: "{{ overwrite_global_mycnf }}"
|
||||
notify: restart mysql
|
||||
|
||||
- name: Verify mysql include directory exists.
|
||||
file:
|
||||
path: "{{ mysql_config_include_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: mysql_config_include_files | length
|
||||
|
||||
- name: Copy my.cnf override files into include directory.
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ mysql_config_include_dir }}/{{ item.src | basename }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: "{{ item.force | default(False) }}"
|
||||
with_items: mysql_config_include_files
|
||||
notify: restart mysql
|
||||
|
||||
- name: Create slow query log file (if configured).
|
||||
shell: "touch {{ mysql_slow_query_log_file }} creates={{ mysql_slow_query_log_file }}"
|
||||
when: mysql_slow_query_log_enabled
|
||||
|
|
|
@ -96,3 +96,11 @@ max_allowed_packet = {{ mysql_mysqldump_max_allowed_packet }}
|
|||
|
||||
[mysqld_safe]
|
||||
pid-file = {{ mysql_pid_file }}
|
||||
|
||||
{% if mysql_config_include_files | length %}
|
||||
# * IMPORTANT: Additional settings that can override those from this file!
|
||||
# The files must end with '.cnf', otherwise they'll be ignored.
|
||||
#
|
||||
!includedir {{ mysql_config_include_dir }}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@ __mysql_packages:
|
|||
- mysql-server
|
||||
__mysql_slow_query_log_file: /var/log/mysql/mysql-slow.log
|
||||
mysql_config_file: /etc/mysql/my.cnf
|
||||
mysql_config_include_dir: /etc/mysql/conf.d
|
||||
mysql_socket: /var/run/mysqld/mysqld.sock
|
||||
|
|
|
@ -5,4 +5,5 @@ __mysql_packages:
|
|||
- mysql-server
|
||||
__mysql_slow_query_log_file: /var/log/mysql-slow.log
|
||||
mysql_config_file: /etc/my.cnf
|
||||
mysql_config_include_dir: /etc/my.cnf.d
|
||||
mysql_socket: /var/lib/mysql/mysql.sock
|
||||
|
|
Loading…
Reference in a new issue