geerlingguy / ansible-role-mysql

Ansible Role - MySQL
https://galaxy.ansible.com/geerlingguy/mysql/
MIT License
1.05k stars 861 forks source link

includedir is set only if mysql_config_include_files is set #526

Closed johansenha closed 8 months ago

johansenha commented 1 year ago

Hello,

it seems that includedir is set only when my_config_include_files is specified which doesn't make sense in my eyes.

templates/my.cnf.j2

{% 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 %}

In my playbook I specify the directory instead of single files but still want the includedir parameter to be set. Should be possible, shouldn't it?

example playbook

- hosts: myhosts
  vars:
    mysql_packages:
      - mariadb-client
      - mariadb-server
    mysql_innodb_file_per_table: "ON"
    mysql_event_scheduler_state: "ON"
    mysql_config_include_dir: "/etc/mysql/mariadb.conf.d"
  roles:
    - role: geerlingguy.mysql

In the end there is no includedir statement in any of the *.cnf files.

I tried to workaround with just setting one of the include files I want to be included

  vars:
    mysql_packages:
      - mariadb-client
      - mariadb-server
    mysql_innodb_file_per_table: "ON"
    mysql_event_scheduler_state: "ON"
    mysql_config_include_dir: "/etc/mysql/mariadb.conf.d"
    mysql_config_include_files: "/etc/mysql/mariadb.conf.d/98-local-custom-config.cnf"
  roles:
    - role: geerlingguy.mysql

which leads to following error:

TASK [geerlingguy.mysql : Copy my.cnf override files into include directory.] ***
fatal: [hostname.domain]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'src'

    The error appears to be in '/root/.ansible/roles/geerlingguy.mysql/tasks/configure.yml': line 27, column 3, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

    - name: Copy my.cnf override files into include directory.
      ^ here

Anyone with the same problem?

github-actions[bot] commented 10 months ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 8 months ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.