Generate .my.cnf for all sections

MySQL ecosystem has a lot of tools that use .my.cnf such as mysqldump or
mysqladmin. Generating all sections allows operator to use them under
root account without passing -p<password>
This commit is contained in:
Sergii Golovatiuk 2016-02-18 11:48:16 +01:00
parent 7a92634f69
commit 4faa3f12ee

View file

@ -1,9 +1,11 @@
### MANAGED BY PUPPET ###
[client]
<% %w(mysql client mysqldump mysqladmin mysqlcheck).each do |section| %>
[<%= section -%>]
user=root
host=localhost
<% unless scope.lookupvar('mysql::server::root_password') == 'UNSET' -%>
password='<%= scope.lookupvar('mysql::server::root_password') %>'
<% end -%>
socket=<%= @options['client']['socket'] -%>
socket=<%= @options['client']['socket'] %>
<% end %>