Skip to content
4 changes: 2 additions & 2 deletions Ansible/library/acs_mysql_update
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ DBUSER=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBUSER"{print $2}'| tr -d '"' |
DBPASS=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBPASS"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//' | tr -d "'"`
MYSQL_STATEMENT=`echo $ARGS | sed 's#.*MYSQL_STATEMENT=\(\)#\1#' | tr -d ')'| sed "s/'\"'\"'/'/g"| tr -d '"' | sed "s/^'//" | sed -e 's/[[:space:]]*$//' | sed s'/.$//'`
echo $MYSQL_STATEMENT > /tmp/mysql
mysql -h ${DBHOST} -u ${DBUSER} -p${DBPASS} -e \ "$MYSQL_STATEMENT"
mysql --default-auth=mysql_native_password -h ${DBHOST} -u ${DBUSER} -p${DBPASS} -e \ "$MYSQL_STATEMENT"

echo "mysql -h ${DBHOST} -u ${DBUSER} -p${DBPASS} -e \ \"$MYSQL_STATEMENT\"" > /tmp/theargs
echo "mysql --default-auth=mysql_native_password -h ${DBHOST} -u ${DBUSER} -p${DBPASS} -e \ \"$MYSQL_STATEMENT\"" > /tmp/theargs

echo '{
"ansible_facts": {
Expand Down
4 changes: 2 additions & 2 deletions Ansible/library/env_db_manage
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ if [[ "$MYSQL_VER_STR" == "8" ]];then
password=${DBPASS}
" > $TMPLOGINFILE

MYSQLCOMMAND="mysql --defaults-extra-file=$TMPLOGINFILE -h${DBHOST} -u${DBUSER} -s -N -e";
MYSQLCOMMAND="mysql --default-auth=mysql_native_password --defaults-extra-file=$TMPLOGINFILE -h${DBHOST} -u${DBUSER} -s -N -e";

else
MYSQLCOMMAND="mysql -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";
MYSQLCOMMAND="mysql --default-auth=mysql_native_password -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";
fi

ENVTBL="environments";
Expand Down
6 changes: 3 additions & 3 deletions Ansible/library/get_db_facts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ DBHOST=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBHOST"{print $2}'| tr -d '"' |
DBUSER=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBUSER"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`
DBPASS=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBPASSWORD"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`

master_status=`mysql -h $DBHOST -u $DBUSER -p$DBPASS -e \ "show master status;"`
master_status=`mysql --default-auth=mysql_native_password -h $DBHOST -u $DBUSER -p$DBPASS -e \ "show master status;"`
master_file=`echo $master_status | awk -F ' ' '{print $5}'`
master_pos=`echo $master_status | awk -F ' ' '{print $6}'`
clouddb_test=`mysql -h $DBHOST -u $DBUSER -p$DBPASS -e \ "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'cloud';"`
clouddb_test=`mysql --default-auth=mysql_native_password -h $DBHOST -u $DBUSER -p$DBPASS -e \ "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'cloud';"`
if [[ -n $clouddb_test ]]; then
registered_mgmt_servers=`mysql -h $DBHOST -u $DBUSER -p$DBPASS -e \ "SELECT service_ip FROM cloud.mshost where removed is null;" | grep -vE service_ip`
registered_mgmt_servers=`mysql --default-auth=mysql_native_password -h $DBHOST -u $DBUSER -p$DBPASS -e \ "SELECT service_ip FROM cloud.mshost where removed is null;" | grep -vE service_ip`
else
registered_mgmt_servers=""
fi
Expand Down
2 changes: 1 addition & 1 deletion Ansible/library/reconcile_db
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $projectnames"
#DBHOST=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBHOST"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`
#DBUSER=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBUSER"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`
#DBPASS=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBPASS"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//' | tr -d "'"`
MYSQLCOMMAND="mysql -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";
MYSQLCOMMAND="mysql --default-auth=mysql_native_password -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";

active_ids=""
for project in $projectnames; do
Expand Down
2 changes: 1 addition & 1 deletion Ansible/library/reconciledb_reportonly
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $projectnames"
#DBHOST=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBHOST"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`
#DBUSER=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBUSER"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//'`
#DBPASS=`echo $ARGS | tr " " "\n"| awk -F= '$1=="DBPASS"{print $2}'| tr -d '"' | sed -e 's/[[:space:]]*$//' | tr -d "'"`
MYSQLCOMMAND="mysql -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";
MYSQLCOMMAND="mysql --default-auth=mysql_native_password -h${DBHOST} -u${DBUSER} -p${DBPASS} -s -N -e";

active_ids=""
for project in $projectnames; do
Expand Down
2 changes: 1 addition & 1 deletion Ansible/roles/cloudstack-manager/tasks/centos8-acs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- name: Ensure python pre-req mysql repo is installed
dnf:
name: http://repo.mysql.com/mysql80-community-release-el8.rpm
name: http://repo.mysql.com/mysql84-community-release-el8.rpm
state: present

- name: "Setup Apache Cloudstack Repo file. baseurl={{ baseurl_cloudstack }} "
Expand Down
2 changes: 1 addition & 1 deletion Ansible/roles/cloudstack-manager/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
update_cache: yes

- name: Install python3-mysql.connector DEB package for cloudstack-management as the real package name is mysql-connector-python-py3
shell: 'wget http://launchpadlibrarian.net/717081070/python3-mysql.connector_8.0.15-4_all.deb -O /tmp/python3-mysql.connector_8.0.15-4_all.deb && DEBIAN_FRONTEND=noninteractive apt install -y /tmp/python3-mysql.connector_8.0.15-4_all.deb'
shell: 'wget http://ftp.debian.org/debian/pool/main/m/mysql-connector-python/python3-mysql.connector_9.5.0-1_all.deb -O /tmp/python3-mysql.connector_9.5.0-1_all.deb && DEBIAN_FRONTEND=noninteractive apt install -y /tmp/python3-mysql.connector_9.5.0-1_all.deb'

- name: Ensure CloudStack management-server only is installed (we install usage server later)
apt:
Expand Down
2 changes: 1 addition & 1 deletion Ansible/roles/cloudstack-manager/tasks/el9-acs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- name: Ensure python pre-req mysql repo is installed for el9
dnf:
name: http://repo.mysql.com/mysql80-community-release-el9.rpm
name: http://repo.mysql.com/mysql84-community-release-el9.rpm
state: present

- name: "Setup Apache Cloudstack Repo file. baseurl={{ baseurl_cloudstack }} "
Expand Down
2 changes: 1 addition & 1 deletion Ansible/roles/marvin/tasks/install_marvin_prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
- texttable
- lxml
- pycparser
- mysql-connector-python==8.0.30
- mysql-connector-python==8.4.0
- netaddr
- pyvmomi
tags:
Expand Down
12 changes: 10 additions & 2 deletions Ansible/roles/mysql/tasks/centos8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
- mysql
- mysqlconf

- name: Ensure mysql repo is installed
dnf:
name: http://repo.mysql.com/mysql84-community-release-el8.rpm
state: present
tags:
- mysql
- mysqlconf

- name: Ensure mysql server is installed
dnf:
name: mysql-server
Expand Down Expand Up @@ -120,14 +128,14 @@


- name: set root password
shell: mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
when: mysqlinstalled.changed
tags:
- mysql
- mysqlconf

- name: grant permissions
shell: mysql -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
ignore_errors: yes
when: mysqlinstalled.changed
tags:
Expand Down
4 changes: 2 additions & 2 deletions Ansible/roles/mysql/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@
# bypass ansible mysql8 connection/library issues.

- name: set root password
shell: mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
when: ansible_distribution_major_version|int >= 12 and mysqlinstalled.changed
tags:
- mysql
- mysqlconf

- name: grant permissions
shell: mysql -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
ignore_errors: yes
when: ansible_distribution_major_version|int >= 12 and mysqlinstalled.changed
tags:
Expand Down
12 changes: 10 additions & 2 deletions Ansible/roles/mysql/tasks/el9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
- mysql
- mysqlconf

- name: Ensure mysql repo is installed for el9
dnf:
name: http://repo.mysql.com/mysql84-community-release-el9.rpm
state: present
tags:
- mysql
- mysqlconf

- name: Ensure mysql server is installed
dnf:
name: mysql*-server
Expand Down Expand Up @@ -125,14 +133,14 @@


- name: set root password
shell: mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
when: mysqlinstalled.changed
tags:
- mysql
- mysqlconf

- name: grant permissions
shell: mysql -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
ignore_errors: yes
when: mysqlinstalled.changed
tags:
Expand Down
4 changes: 2 additions & 2 deletions Ansible/roles/mysql/tasks/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@
# shell: rm -rf /var/lib/mysql/*

- name: set root password
shell: mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
when: mysqlinstalled.changed
tags:
- mysql
- mysqlconf

- name: grant permissions
shell: mysql -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
ignore_errors: yes
when: mysqlinstalled.changed
tags:
Expand Down
4 changes: 2 additions & 2 deletions Ansible/roles/mysql/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
# bypass ansible mysql8 connection/library issues.

- name: set root password
shell: mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssword123';FLUSH PRIVILEGES;"
when: ansible_distribution_major_version|int >= 20 and mysqlinstalled.changed
tags:
- mysql
- mysqlconf

- name: grant permissions
shell: mysql -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
shell: mysql --default-auth=mysql_native_password -h localhost -u root -pP@ssword123 -e "CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssword123';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES"
ignore_errors: yes
when: ansible_distribution_major_version|int >= 20 and mysqlinstalled.changed
tags:
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/mariadb-my.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ skip_name_resolve

max_connections={{ mysql_max_connections }}

mysql_native_password=ON

innodb_buffer_pool_size={{ mysql_innodb_buffer_pool_size }}
innodb_file_per_table=1
innodb_additional_mem_pool_size=20M
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/mariadb-suse-my.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ socket=/var/lib/mysql/mysql.sock
user=mysql
skip_name_resolve

mysql_native_password=ON

max_connections={{ mysql_max_connections }}

innodb_buffer_pool_size={{ mysql_innodb_buffer_pool_size }}
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/my-centos8.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ datadir=/var/lib/mysql
max_connections={{ mysql_max_connections }}
skip_name_resolve

mysql_native_password=ON

{% if ansible_distribution_major_version|int < 10 %}
default_authentication_plugin=mysql_native_password
{% endif %}
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/my-debian.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ datadir=/var/lib/mysql
max_connections={{ mysql_max_connections }}
skip_name_resolve

mysql_native_password=ON

innodb_buffer_pool_size={{ mysql_innodb_buffer_pool_size }}
innodb_file_per_table=1
innodb_log_buffer_size=16MB
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/my.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ datadir=/var/lib/mysql
max_connections={{ mysql_max_connections }}
skip_name_resolve

mysql_native_password=ON

innodb_buffer_pool_size={{ mysql_innodb_buffer_pool_size }}
innodb_file_per_table=1
innodb_additional_mem_pool_size=20M
Expand Down
2 changes: 2 additions & 0 deletions Ansible/roles/mysql/templates/my.ubuntu.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ server-id=1

skip_name_resolve

mysql_native_password=ON

innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections={{ mysql_max_connections }}
Expand Down