Question

I want to update the values in a MySQL table using Puppet.

Basically I want to run something like this:

update Servers set ipPrivate="10.1.2.3" where hostName="x.example.com";

ipPrivate and hostName will be in storeconfigs, and will have quite a few different combinations of values.

I could just do this with exec, but I'm wondering if there's a better way to do it.

Was it helpful?

Solution

If you don't like the idea of using a plain exec, you can always wrap it up as a defined type, i.e.

define mysqlupdate (params) {
    exec { "update-sql-${name}":
        ...
    }
}

Defined types let you easily reuse the code too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top