2015-12-18 9 views
5

私は現時点でOpsWorksを使ってシェフを習っていますが、現在は2つのパッケージを1つのインスタンスにインストールするレシピを作成しようとしています。 webserver.rbシェフがhttpdに依存しない

# Install apache and start the service 
httpd_service 'site' do 
    mpm 'prefork' 
    action [:create, :start] 
end 

# Add the site configuration 
httpd_config 'site' do 
    instance 'site' 
    source 'site.conf.erb' 
    notifies :restart, 'httpd_service[site]' 
end 

#create the document root directory 
#directory '/var/www/public_html' do 
# recursive true 
#end 

#write the homepage 
file '/var/www/index.html' do 
    content '<html>This is a web</html>' 
    mode '0644' 
    owner 'web_admin' 
    group 'web_admin' 
end 

# Install apache , config and etc END 

# Install the mod_php5 apache module 
httpd_module 'php' do 
    instance 'site' 
end 

#install php5-mysql 
package 'php-mysql' do 
    action :install 
    notifies :restart, 'httpd_service[site]' 
end 

#write the homepage 
file '/var/www/index2.php' do 
    content '<html><?php echo phpinfo(); ?></html>' 
    mode '0644' 
    owner 'web_admin' 
    group 'web_admin' 
end 

私はAWSはLAMP環境を作成するためのチュートリアル次のです - 私はこのようなものですレシピを持っているが... githubの上で私の料理の本を保管していました。残念ながら、これを私のインスタンス、opsworks_cookbook_demo :: default(Webサーバーを含むいくつかのインクルードを実行します。)に実行すると、precondition httpd cookbook not foundというエラーが表示されます。私はmetadaba.rbに既に 'httpd'〜〜.. '誰かが私にここで何が悪いのかを案内します。あなたが置くたびに 'httpd'を置くたびに私はそれを使ってその料理本を使うようにします。

このケースではベルセルフが必要ですか? (現在、私はAWS OpsWorksを使用しており、githubでレシピを持っています)

答えて

3

OpsWorksにフィードするには、事前にすべての依存関係をダウンロードする必要があります。詳細については、https://docs.aws.amazon.com/opsworks/latest/userguide/best-practices-packaging-cookbooks-locally.htmlを参照してください。古いシェフ11のスタックは、ターゲット上でberks vendorを実行することによってこれを幾分自動化するために使用されましたが、今は自分のワークステーションでそれを行う必要があります。

+0

私はドキュメントを読むでしょう。ありがとう! –

関連する問題