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

fix if mysql is not listening on localhost #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tasks/database-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
- name: Check if the MySQL databases are empty
command: >
mysql --user="{{ item['value']['user'] }}" --password="{{ item['value']['password'] }}"
--host="{{ item['value']['host'] }}" --port "{{ item['value']['port'] | default('3306') }}" --batch --skip-column-names
{% if not (pdns_mysql_query_use_socket | default(false)) %} --host="{{ item['value']['host'] }}" --port "{{ item['value']['port'] | default('3306') }}"{% endif %}
--batch --skip-column-names
--execute="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '{{ item['value']['dbname'] }}'"
when: item.key.split(':')[0] == 'gmysql'
with_dict: "{{ pdns_backends }}"
Expand Down Expand Up @@ -68,8 +69,9 @@
mysql_db:
login_user: "{{ item['item']['value']['user'] }}"
login_password: "{{ item['item']['value']['password'] }}"
login_host: "{{ item['item']['value']['host'] }}"
login_port: "{{ item['item']['port'] | default('3306') }}"
login_host: "{{ item['item']['value']['host'] if not (pdns_mysql_query_use_socket | default(false)) else omit }}"
login_port: "{{ item['item']['port'] | default('3306') if not (pdns_mysql_query_use_socket | default(false)) else omit }}"
login_unix_socket: "{{ '/var/run/mysqld/mysqld.sock' if (pdns_mysql_query_use_socket | default(false)) else omit }}"
name: "{{ item.item['value']['dbname'] }}"
state: import
target: "{{ pdns_mysql_schema_file_to_use }}"
Expand Down
3 changes: 3 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ default_pdns_backends_packages:

# The directory where the PowerDNS Authoritative Server configuration is located
default_pdns_config_dir: "/etc/powerdns"

# Do not use --host --port for mysql connections
pdns_mysql_query_use_socket: true
Loading