Chef can't make httpd hang

I am studying a chef at the moment using OpsWorks, I am currently trying to create a recipe that will install 2 packages in one copy. I saved my cookbook on github .. there I have a recipe that looks like this: webserver.rb

# 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 

I am following an AWS tutorial creating a LAMP environment. Unfortunately, when I run this in my instance, opsworks_cookbook_demo :: default (it will run some of them, including the web server.) I get an error that precondition httpd cookbook not found , I already added to my metadaba.rb, it depends from httpd '' ~> .. ', Can anyone guide me on what's wrong here. Coz I assume that whenever you put "httpd" depends, it will expand my cookbook to use this cookbook.

Do I need berkshelf for this case? (I am currently using AWS OpsWorks and have my recipe on github)

+5
source share
1 answer

You must download all dependencies ahead of time to submit to OpsWorks. See https://docs.aws.amazon.com/opsworks/latest/userguide/best-practices-packaging-cookbooks-locally.html for details. Older chef stacks 11 were used to automate this for you by running the berks vendor on target, but now you need to do it yourself on your workstation.

+3
source

Source: https://habr.com/ru/post/1238587/


All Articles