Add python-pymysql to default packages and add mysql_connection variable

master
Oleg "Zmey!" Vasiliev 2022-05-09 21:13:23 +03:00
parent 87ac16013e
commit 00d6be5bd4
2 changed files with 22 additions and 2 deletions

View File

@ -2,6 +2,7 @@
mysql_packages: mysql_packages:
- mariadb - mariadb
- python-pymysql
mysql_service_name: mariadb mysql_service_name: mariadb
@ -13,5 +14,12 @@ mysql_main_conf:
dest: /etc/my.cnf dest: /etc/my.cnf
mysql_confd: [] mysql_confd: []
mysql_connection:
unix_socket: /run/mysqld/mysqld.sock
# host:
# port:
# user:
# password:
mysql_databases: [] mysql_databases: []
mysql_users: [] mysql_users: []

View File

@ -35,14 +35,26 @@
mysql_db: mysql_db:
name: "{{ item.name }}" name: "{{ item.name }}"
state: "{{ item.state | d(omit) }}" state: "{{ item.state | d(omit) }}"
login_unix_socket: "{{ mysql_connection.unix_socket | d(omit) }}"
login_host: "{{ mysql_connection.host | d(omit) }}"
login_port: "{{ mysql_connection.port | d(omit) }}"
login_user: "{{ mysql_connection.user | d(omit) }}"
login_password: "{{ mysql_connection.password | d(omit) }}"
with_items: "{{ mysql_databases }}" with_items: "{{ mysql_databases }}"
- name: MySQL | Create users - name: MySQL | Create users
mysql_user: mysql_user:
name: "{{ item.name }}" name: "{{ item.name }}"
state: "{{ item.state | d(omit) }}" state: "{{ item.state | d(omit) }}"
password: "{{ item.password | d(omit) }}" password: "{{ item.password | d(omit) }}"
priv: "{{ item.priv | d(omit) }}" priv: "{{ item.priv | d(omit) }}"
login_unix_socket: "{{ mysql_connection.unix_socket | d(omit) }}"
login_host: "{{ mysql_connection.host | d(omit) }}"
login_port: "{{ mysql_connection.port | d(omit) }}"
login_user: "{{ mysql_connection.user | d(omit) }}"
login_password: "{{ mysql_connection.password | d(omit) }}"
with_items: "{{ mysql_users }}" with_items: "{{ mysql_users }}"
- name: unbound | Run handlers - name: unbound | Run handlers