Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configure.yml #527

Closed
wants to merge 4 commits into from
Closed

Update configure.yml #527

wants to merge 4 commits into from

Conversation

mkondratev
Copy link

@mkondratev mkondratev commented Jul 11, 2023

When:

  1. mysql_datadir is not /var/lib/mysql.
  2. mysql_slow_query_log_file and mysql_log_error use mysql_datadir

... then the deployment fails:

mysql_datadir: "/data/mysql"
mysql_slow_query_log_file: "{{ mysql_datadir }}/.mysql-slow.log"
mysql_log_error: "{{ mysql_datadir }}/.mysql-error.log"
TASK [geerlingguy.mysql : Create slow query log file (if configured).] *******************************************************************************************************
Tuesday 11 July 2023  19:58:53 +0300 (0:00:00.049)       0:02:00.408 ********** 
fatal: [vm01.vagrant.loc]: FAILED! => {"changed": true, "cmd": ["touch", "/data/mysql/.mysql-slow.log"], "delta": "0:00:00.008097", "end": "2023-07-11 16:58:53.402634", "msg": "non-zero return code", "rc": 1, "start": "2023-07-11 16:58:53.394537", "stderr": "touch: cannot touch '/data/mysql/.mysql-slow.log': No such file or directory", "stderr_lines": ["touch: cannot touch '/data/mysql/.mysql-slow.log': No such file or directory"], "stdout": "", "stdout_lines": []}
fatal: [vm02.vagrant.loc]: FAILED! => {"changed": true, "cmd": ["touch", "/data/mysql/.mysql-slow.log"], "delta": "0:00:00.005696", "end": "2023-07-11 16:58:53.405119", "msg": "non-zero return code", "rc": 1, "start": "2023-07-11 16:58:53.399423", "stderr": "touch: cannot touch '/data/mysql/.mysql-slow.log': No such file or directory", "stderr_lines": ["touch: cannot touch '/data/mysql/.mysql-slow.log': No such file or directory"], "stdout": "", "stdout_lines": []}

The directory mysql_datadir must be created before mysql_slow_query_log_file is created in it. This step works if mysql_datadir is the default, as the package creates the directory during installation.

Additionally, I suggest removing the creation of an empty file through a command and delegating this task to ansible.builtin.file.

Also, i noticed condition for step "Create error log file" wrong:

# Logging settings.
mysql_log: ""
# The following variables have a default value depending on operating system.
# mysql_log_error: /var/log/mysql/mysql.err
# mysql_syslog_tag: mysql

mysql_log and mysql_log_error are strings, while when expects bool.

  when:
    - mysql_log | default(true)
    - mysql_log_error | default(false)

checking:

- debug:
    msg:
      - "mysql_log: {{ mysql_log }} | {{ mysql_log | type_debug }}"
      - "mysql_log_error: {{ mysql_log_error }} | {{ mysql_log_error | type_debug }}"

- ansible.builtin.assert:
    that:
      - mysql_log | default(true)
      - mysql_log_error | default(false)

result:

ok: [mysql01] => {
    "msg": [
        "mysql_log:  | AnsibleUnicode",
        "mysql_log_error: /data/mysql/.mysql-error.log | str"
    ]
}

fatal: [mysql01]: FAILED! => {
    "assertion": "mysql_log | default(true)",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"
}

Copy link

This pr 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 github-actions bot added the stale label Nov 11, 2023
Copy link

This pr 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.

@github-actions github-actions bot closed this Jan 13, 2024
@mkondratev mkondratev deleted the patch-1 branch January 17, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant