Giter Site home page Giter Site logo

Comments (4)

cameronkerrnz avatar cameronkerrnz commented on July 27, 2024

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.

bertvv avatar bertvv commented on July 27, 2024

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.

cameronkerrnz avatar cameronkerrnz commented on July 27, 2024

Sounds reasonable. I tried doing that, but couldn't get it to work. Thanks for providing this module.

from ansible-role-mariadb.

bertvv avatar bertvv commented on July 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.