fourforbusiness.mysql-prepare-db
Ansible Role: SQL Prepare DB
A collection of tasks that can be used as a toolset to prepare the target machines MySQL-Database.
Requirements
None.
Role Variables
Available variables are listed below, along with default values (see defaults/main.yml):
remote_tmp_folder
The folder on the remote system where to copy the dumpslocal_dump_folder
The folder in the hosts file system with the dumpsmysql_import_dumps
The config variables for each dump.Mandatory sub-key/values are:
filename(string)database(string) (database must exist on the given mysql-server)
Optional sub-key/values are:
replacements(List)pattern(string) +replacement(string)
The inclusion ofreplacementscause the role to replace all listedpatternfound in the sql-file withreplacement.
mysql_additional_scripts
The additional mysql-scripts to execute (this is only executed if at least 1 dump was given for import and if it failes, it will not stop the playbook from provisioning)
Dependencies
Example Playbook
- hosts: db-servers
become: yes
vars_files:
- vars/main.yml
roles:
- geerlingguy.mysql
- fourforbusiness.mysql-prepare-db
Inside vars/main.yml:
mysql_import_dumps:
- filename: test_dump.sql
database: test_database
replacements:
- pattern: xyz.de
replacement: xyz.local
- pattern: https
replacement: http
License
MIT / BSD
Author Information
This role was created in 2018 by four for business AG.
