Comments (4)
Having a look at this, the root issue is with mysql_db, but I couldn't figure out how to make idempotency work in the context of having a list of dictionaries describing schemas which you want to interate over, all the while consulting another list of dictionaries being the results of database creation promises.
I settled on trying to put the idempotency into the SQL instead, which helps to make the schema management potentially more idempotent -- depending on how good your MySQL is.
Example schema commands:
--
-- NOTE NOTE NOTE
-- Ensure this schema definition is idempotent. Ansible will run it every bloody time you deploy.
--
--
-- Table structure for table `StorageRecords`
--
CREATE TABLE IF NOT EXISTS `StorageRecords` (
`context` varchar(255) NOT NULL,
`id` varchar(255) NOT NULL,
`expires` bigint(20) DEFAULT NULL,
`value` longtext NOT NULL,
`version` bigint(20) NOT NULL,
PRIMARY KEY (`context`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `tb_st`
--
CREATE TABLE IF NOT EXISTS `tb_st` (
`uid` varchar(100) NOT NULL,
`sharedToken` varchar(50) DEFAULT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
from ansible-role-mariadb.
I'll check out if it's possible to run the init scripts only if the database was created in the previous task. Would that be a valid strategy?
from ansible-role-mariadb.
Sounds reasonable. I tried doing that, but couldn't get it to work. Thanks for providing this module.
from ansible-role-mariadb.
I'll need to reorder the variables a bit, I think. Specifically, mariadb_databases
and mariadb_init_scripts
need to be merged into a single list of dicts. I'll be in touch...
https://docs.ansible.com/ansible/playbooks_loops.html#using-register-with-a-loop
from ansible-role-mariadb.
Related Issues (20)
- Value not written to custom.cnf when 0 HOT 1
- Fails when playbook is running with --check HOT 1
- Running the role in CentOS 8 fails
- "Set MariaDB root password for the first time" task fails HOT 1
- Control handler's service restarts HOT 2
- root-password.yml - Not vault compatible HOT 1
- Update root pwd HOT 3
- Add encoding and collation in create user table HOT 1
- How do the calls to mysql_user work? HOT 1
- Fatal error usermod: user mysql is currently used by process HOT 1
- missing password parameters in commands
- Add virtuozzo linux support
- Set [mariadb] configurable to allow MariaDB multi-instance
- Build fails when no "distribution dependent variables" files are found
- setting swappiness failes in an lxc container HOT 1
- Better to use copy module instead for template
- Fedora maridb package names HOT 1
- yum repository
- Added support for Debian doesn't work for Ubuntu HOT 2
- Need to run mariadb-install-db for newer versions of MariaDB on RPM systems
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-role-mariadb.