mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-28 07:31:24 -07:00
Add default file for root necessary since using venv instead of docker
This commit is contained in:
parent
d781636f32
commit
8c5806848f
7 changed files with 48 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
dbdeployer_version: 1.64.0
|
||||
dbdeployer_home_dir: /opt/dbdeployer
|
||||
|
||||
home_dir: /root
|
||||
home_dir: "{{ playbook_dir }}/root"
|
||||
|
||||
mariadb_install: false
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
# - import_tasks: setvars.yml
|
||||
# - import_tasks: dir.yml
|
||||
- import_tasks: install.yml
|
||||
# - import_tasks: install.yml
|
||||
# - import_tasks: config.yml
|
||||
# - import_tasks: verify.yml
|
||||
|
||||
- name: Prepare the controller python and MySQL connector
|
||||
ansible.builtin.import_tasks:
|
||||
file: prepare_controller.yml
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
|
||||
- name: "{{ role_name }} | install | install python packages"
|
||||
pip:
|
||||
name: "{{ python_packages }}"
|
||||
register: connector
|
||||
|
||||
- name: Extract connector.name.0 content
|
||||
set_fact:
|
||||
connector_name: "{{ connector.name.0 }}"
|
||||
|
||||
- name: Debug connector_name content
|
||||
debug:
|
||||
msg: '{{ connector_name }}'
|
||||
|
||||
- name: Extract connector version
|
||||
set_fact:
|
||||
connector_ver: "{{ connector_name.split('=')[2].strip() }}"
|
||||
|
||||
- name: Debug connector_ver var content
|
||||
debug:
|
||||
msg: '{{ connector_ver }}'
|
||||
|
||||
- name: Ensure fake root folder
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/root"
|
||||
state: directory
|
||||
|
||||
- name: Ensure fake root default file exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/root/.my.cnf"
|
||||
state: touch
|
|
@ -1,9 +1,9 @@
|
|||
- set_fact:
|
||||
db_to_create: testdb1
|
||||
config_file: "/root/.my1.cnf"
|
||||
config_file: "{{ playbook_dir }}/.my1.cnf"
|
||||
fake_port: 9999
|
||||
fake_host: "blahblah.local"
|
||||
include_dir: "/root/mycnf.d"
|
||||
include_dir: "{{ playbook_dir }}/mycnf.d"
|
||||
|
||||
- name: Create custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
dump_file2: "{{ tmp_dir }}/{{ file3 }}"
|
||||
db_user: "test"
|
||||
db_user_unsafe_password: "pass!word"
|
||||
config_file: "/root/.my.cnf"
|
||||
config_file: "{{ playbook_dir }}/root/.my.cnf"
|
||||
|
||||
- name: create custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
- name: mysql_info - create default config file
|
||||
template:
|
||||
src: my.cnf.j2
|
||||
dest: /root/.my.cnf
|
||||
dest: "{{ playbook_dir }}/root/.my.cnf"
|
||||
mode: '0400'
|
||||
|
||||
# Create non-default MySQL config file with credentials
|
||||
- name: mysql_info - create non-default config file
|
||||
template:
|
||||
src: my.cnf.j2
|
||||
dest: /root/non-default_my.cnf
|
||||
dest: "{{ playbook_dir }}/root/non-default_my.cnf"
|
||||
mode: '0400'
|
||||
|
||||
###############
|
||||
|
@ -61,7 +61,7 @@
|
|||
login_user: '{{ mysql_user }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
config_file: /root/non-default_my.cnf
|
||||
config_file: "{{ playbook_dir }}/root/non-default_my.cnf"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -74,9 +74,9 @@
|
|||
file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- /root/.my.cnf
|
||||
- /root/non-default_my.cnf
|
||||
loop:
|
||||
- "{{ playbook_dir }}/.my.cnf"
|
||||
- "{{ playbook_dir }}/non-default_my.cnf"
|
||||
|
||||
# Access with password
|
||||
- name: mysql_info - check access with password
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
mysql_parameters: &mysql_params
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
login_host: 192.168.1.108
|
||||
login_host: 127.0.0.1
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
|
||||
block:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue