bodsch / ansible-mariadb

Installs and configure a mariadb (with TLS and/or Replication or Galera Cluster) on varoius linux systems.
Apache License 2.0
3 stars 1 forks source link

PyMySQL needs Python 3, but 2 is being selected #6

Closed DavidMorp closed 3 years ago

DavidMorp commented 3 years ago

The mariadb secure-installation fails at the "remove mariadb test database" task.

TASK [remove mariadb test database] ***************************************************************************
Wednesday 14 April 2021  17:20:58 +0200 (0:00:00.018)       0:01:44.065 ******* 
fatal: [database.icinga.local]: FAILED! => changed=false 
  msg: The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.

This was resolved by changing the beginning of ansible-mariadb/tasks/preparations.yml to set the interpreter to python3

- block:
    - name: ensure the ansible_python_interpreter is set to python3 #changed to python 3
      set_fact:
        ansible_python_interpreter: python3 #changed to python 3
    - name: do facts module to get latest information
      setup:
  # Always...
  # when: (
  #   ansible_os_family | lower == 'redhat' and
  #   ansible_distribution_version | int < 8)

I am using Debian 10. I would make a pull request but I'm not sure if this is the best place to set the interpreter, so i preferred to open an issue.

bodsch commented 3 years ago

Thank you! I will take a closer look. The role is currently also rather unusable. :)

bodsch commented 3 years ago

I'm currently taking a closer look at the role (also because I want to integrate support for Arch Linux). In my test environment debain 10 ran without changes. In my opinion, debian 10 also uses python 3 by default.