Comments (5)
Yes, you can use the mysql::user define to create users and mysql::grant define to manage permissions.
from psick.
Sorry, I was not very descriptive. I need to be able to setup multiple users so, I used this:
mysql::user { "db1":
mysql_password_hash => "db1",
mysql_user => "db1",
mysql_host => "host"
}
mysql::grant { "db1":
mysql_privileges => "ALL",
mysql_password => "pwd",
mysql_db => "db1",
mysql_user => "db1",
mysql_host => "host"
}
But, if I use the same for db2, it won't work since mysql::user would be repeated twice. I guess, I'm looking for a way to handle multiple users for multiple databases more gracefully.
from psick.
Uhm, not so sure I've understood well, but you should be able to create 2 different users for the same db with just 2 different mysql::grant :
mysql::grant { "db1":
mysql_privileges => "ALL",
mysql_password => "pwd",
mysql_db => "db1",
mysql_user => "db1",
mysql_host => "host"
}
mysql::grant { "db2":
mysql_privileges => "ALL",
mysql_password => "pwd",
mysql_db => "db1",
mysql_user => "db2",
mysql_host => "host"
}
or maybe I still haven't understood what you need :-)
Anyway, take a look at the templates user by these defines:
mysql::grant uses this:
<% if mysql_db != "" then %>
CREATE DATABASE IF NOT EXISTS <%= mysql_db %> ;
<% end %>
GRANT <%= mysql_privileges %> ON <%= mysql_db %>. TO '<%= mysql_user %>'@'<%= mysql_host %>' IDENTIFIED BY '<%= mysql_password %>';
FLUSH PRIVILEGES ;
mysql::user uses this:
GRANT USAGE ON .
TO '<%= mysql_user %>'@'<%= mysql_host %>'
IDENTIFIED BY
<% if has_variable?('mysql_password_hash') && mysql_password_hash then %>
PASSWORD '<%= mysql_password_hash %>'
<% else %>
'<%= mysql_password %>';
<% end %>
;
FLUSH PRIVILEGES ;
So actually mysql::user is somehow a subset of mysql::grant
from psick.
Hi guys,
I'm very new to puppet and have just been trying to change the configuration that I got from puphpet.com to automatically add a new user. In my default.pp manifest, I've added:
mysql::grant { "db1":
mysql_privileges => "ALL",
mysql_password => "password",
mysql_user => "root",
mysql_host => "%",
}
however, vagrant fails to build reporting:
Must pass mysql_db to Mysql::Grant[db1] at /tmp/vagrant-puppet/modules-0/mysql/manifests/grant.pp:1 on node precise32
Any help would be appreciated!
Thanks
from psick.
Try to explicitely pass the parameter mysql_db => 'db1'
from psick.
Related Issues (20)
- Refine general Vagrantfile and review/test all environments config.yaml
- puppet_install.sh not working on fedora 27 HOT 1
- Minimal install miss hiera.yaml
- More structured, dynamic, and manageable control-repo spec tests
- Move hieradata to separated module
- Missing development tools in vagrant gitlab.foss.psick.io HOT 3
- boxes.yaml has a duplicate line
- Allow to choose sync folder mount type
- all_roles task missing HOT 2
- Windows compatibility HOT 1
- Link does not work
- Rename Gitlab CI variable CI_BUILD_REF_NAME -> CI_COMMIT_REF_NAME HOT 4
- docs: image is missing
- pool_size throws errors HOT 1
- docs: pe vagrant environment README is missing a plugin
- tp-profile repo is wrong
- Vagrant FOSS shows missing profile psick::puppet::tp HOT 2
- add root passwords rotation script HOT 2
- Update Vagrant PE Env
- Vagrant PE environment causes puppet compiler error HOT 1
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 psick.