Greg Karékinian a32f34b408 Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
2019-10-13 19:17:42 +02:00

32 lines
836 B
Ruby
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
package('libmysqlclient-dev') { action :nothing }.run_action(:install)
build_essential 'mediawiki' do
compile_time true
end
node.normal['mediawiki']['db']['pass'] = secure_password
node.save unless Chef::Config[:solo]
db = node["mediawiki"]["db"]
package %w(mysql-client mysql-server)
service 'mysql' do
action [:enable, :start]
end
# Create database
execute "create #{db["name"]} db" do
command "mysql -e \"CREATE DATABASE IF NOT EXISTS #{db["name"]};\""
user "root"
end
# Create user
execute "create #{db["user"]} user" do
command "mysql -e \"CREATE USER IF NOT EXISTS '#{db["user"]}'@'localhost' IDENTIFIED BY '#{db["pass"]}'; GRANT ALL PRIVILEGES ON #{db["name"]}.* to '#{db["user"]}'@'localhost'; FLUSH PRIVILEGES;\""
sensitive true
user "root"
end