Browse Source

Added workaround for broken MySQL socket auth with PyMysql

merge-requests/1/merge
Christoph Haas 6 years ago
parent
commit
80a009dbd5
3 changed files with 21 additions and 8 deletions
  1. +2
    -2
      Vagrantfile
  2. +18
    -6
      ansible/roles/ispmail-database/tasks/main.yml
  3. +1
    -0
      ansible/roles/ispmail-database/templates/root-my-cnf.j2

+ 2
- 2
Vagrantfile View File

@@ -39,7 +39,7 @@ Vagrant.configure(2) do |config|
# the path on the guest to mount the folder. And the optional third # the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options. # argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data" # config.vm.synced_folder "../data", "/vagrant_data"
#config.vm.synced_folder "ansible", "/root"
#config.vm.synced_folder "ansible", "/vagrant"


# Provider-specific configuration so you can fine-tune various # Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options. # backing providers for Vagrant. These expose provider-specific options.
@@ -73,6 +73,7 @@ Vagrant.configure(2) do |config|


config.vm.provision "ansible" do |ansible| config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/ispmail.yml" ansible.playbook = "ansible/ispmail.yml"
#ansible.playbook = "ispmail.yml"
ansible.become = true ansible.become = true
#ansible.become_user = 'root' #ansible.become_user = 'root'
ansible.compatibility_mode = '2.0' ansible.compatibility_mode = '2.0'
@@ -97,4 +98,3 @@ Vagrant.configure(2) do |config|
# Submission # Submission
config.vm.network "forwarded_port", guest: 587, host: 10587 config.vm.network "forwarded_port", guest: 587, host: 10587
end end


+ 18
- 6
ansible/roles/ispmail-database/tasks/main.yml View File

@@ -1,15 +1,27 @@
--- ---
- name: Installing required Python mysqldb module for Ansible to manage databases - name: Installing required Python mysqldb module for Ansible to manage databases
# apt: name=python-mysqldb
apt: name=python-pymysql apt: name=python-pymysql


- name: Set root user password
become: true
# If .my.cnf already exists, this will cause an mysql-root-password update.
# - name: Set root user password
# become: true
# # If .my.cnf already exists, this will cause an mysql-root-password update.
# mysql_user:
# name: root
# password: "{{ ispmail_mysql_root_password}}"
# login_unix_socket: /var/run/mysqld/mysqld.sock
# check_implicit_admin: true

- name: Set a new root password
mysql_user: mysql_user:
name: root
password: "{{ ispmail_mysql_root_password}}"
check_implicit_admin: yes
user: root
password: "{{ ispmail_mysql_root_password }}"
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
check_implicit_admin: true
host: "{{ item }}"
with_items:
- localhost
- 127.0.0.1


- name: Create .my.cnf - name: Create .my.cnf
template: template:


+ 1
- 0
ansible/roles/ispmail-database/templates/root-my-cnf.j2 View File

@@ -1,3 +1,4 @@
[client] [client]
user=root user=root
password={{ispmail_mysql_root_password}} password={{ispmail_mysql_root_password}}
socket=/var/run/mysqld/mysqld.sock

Loading…
Cancel
Save