Ask Your Question

Maintain Mysql configuration with puppet

asked 2019-01-10 14:12:43 -0600

cray gravatar image


I recently add the mysql module from puppetLabs in version 7.0 on our RHEL Satellite for managing all our MySql's servers and hold them with idempotency configuration and bloc any unwanted configuration. Works perfectly with some adjustement

In this case, a user with Granted privileges is able to create a Database (like root@localhost) and so add manually a Database with the command create database dbname; for example.

Problem, If i run my pupppet agent -t on my lab server, puppet is just ensuring that databeses defined in my smart class "Databeses" exist (or not) and do nothing else...

The result expected was it can remove any modification (like database creation) when ran the agent an make my server only managed by puppet.

Is there a way to do this ?

Thanks for replies

edit retag flag offensive close merge delete


Puppet is declarative - it can only manage what you tell it to manage. In a simple example, if you told puppet to manage a file resource /etc/foo, and a root user created /etc/bar, how would puppet know if /etc/bar should exist? If you know something shouldn't be there, you can `ensure=>absent`

DarylW gravatar imageDarylW ( 2019-01-11 08:02:25 -0600 )edit

In the case of a database, if they are managing it in the location specified by puppet, puppet would overwrite the configurations with what puppet thinks should be there - but if they are managing it's configs and servers somewhere else / somehow else, puppet won't be aware of it

DarylW gravatar imageDarylW ( 2019-01-11 08:03:28 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-11 08:39:52 -0600

cray gravatar image

updated 2019-01-11 08:50:43 -0600


thanks for your reply. I pretty understand what you mean about "declarative" with your example.

I thank it's was able to "read the datadir (/var/lib/mysql/...) defined in /etc/my.cnf (managed by puppet) and compare for making all the other Database with the state "Absent"

If i declare DB1,DB2,DB3 in my puppet database class, i expect having only theses 3 DBs without

So i can't trust at 100% what i see in my puppet configuration...

Any idea get around this ?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-01-10 14:12:43 -0600

Seen: 164 times

Last updated: Jan 11