mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-06-05 07:49:11 -07:00
mysql modules: fix failing when \!include_dir is in config file (#47)
* mysql modules: fix failing when \!include_dir is in .my.cnf * Add changelog fragment * fix CI * fix CI * Fix CI * Fix CI * Fix comment
This commit is contained in:
parent
8c79011dbd
commit
82ad06e072
3 changed files with 44 additions and 9 deletions
|
@ -3,6 +3,7 @@
|
|||
config_file: "/root/.my1.cnf"
|
||||
fake_port: 9999
|
||||
fake_host: "blahblah.local"
|
||||
include_dir: "/root/mycnf.d"
|
||||
|
||||
- name: Create custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
@ -10,6 +11,28 @@
|
|||
- name: Add fake port to config file
|
||||
shell: 'echo "port = {{ fake_port }}" >> {{ config_file }}'
|
||||
|
||||
- name: Get pymysql version
|
||||
shell: pip show pymysql | awk '/Version/ {print $2}'
|
||||
register: pymysql_version
|
||||
|
||||
- name: Add blank line
|
||||
shell: 'echo "" >> {{ config_file }}'
|
||||
when: (pymysql_version.stdout | default('1000', true)) is version('0.9.3', '>=')
|
||||
|
||||
- name: Create include_dir
|
||||
file:
|
||||
path: '{{ include_dir }}'
|
||||
state: directory
|
||||
mode: '0777'
|
||||
when: (pymysql_version.stdout | default('1000', true)) is version('0.9.3', '>=')
|
||||
|
||||
- name: Add include_dir
|
||||
lineinfile:
|
||||
path: '{{ config_file }}'
|
||||
line: '!includedir {{ include_dir }}'
|
||||
insertafter: EOF
|
||||
when: (pymysql_version.stdout | default('1000', true)) is version('0.9.3', '>=')
|
||||
|
||||
- name: Create database using fake port to connect to, must fail
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue