1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | knife cookbook create mariadb-galera-cluster cat environments/test.json <<EOF { "name": "test", "description": "", "cookbook_versions": { }, "json_class": "Chef::Environment", "chef_type": "environment", "default_attributes": { }, "override_attributes": { } } EOF |
1 2 3 4 5 6 7 8 9 10 11 | .. environments/ test.json cookbooks/ mariadb-galera-cluster/ recipes/ default.rb templates/ default/ attributes/ default.rb |
1 2 3 4 5 6 | [chef_server_repo] name=chef_server_repo baseurl=http://chefserver:80/yum_repo enabled=1 gpgcheck=0 sslverify=0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | template "/etc/yum.repos.d" do source "chef_server.repo.erb" owner 'root' mode 0755 action :create end ... execute "Install Mariadb" do command "yum clean metadata && yum -y install mariadb-server" end ... bash "Config database settings..." do cwd "#{CWD}" user "root" group "root" code <<-EOF printf "\n[mysqld]\nlower_case_table_names=1" >> /etc/my.cnf systemctl enable mariadb.service systemctl start mariadb.service mysql < init.sql systemctl restart mariadb.service EOF end |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |