我让 Hiera 与 puppet/vagrant 结合运行。
假设我有一个木偶执行官在做以下事情
exec { create-project-database:
command => 'mysql -u root -e "CREATE DATABASE project_db DEFAULT CHARACTER SET = \'utf8\';"',
unless => 'mysql -u root information_schema -e "select * from information_schema.schemata;" | grep "project_db"',
require => Package[mysql-server],
}
我想用"project_db"
我common.yaml
的 hiera中的变量替换字符串
---
machine_message: 'This is the dev machine!'
codes_path: '/vagrant/code/laravel/'
project_db: 'project_db'
我该怎么做?语法对我来说不清楚,这样的事情会带来错误:
command => 'mysql -u root -e "CREATE DATABASE 'hiera('project_db)' DEFAULT CHARACTER SET = \'utf8\';"',