Cannot use chef provisioning in vagrant - vagrant

I created a basic vagrant box and config provisioning as below
config.vm.provision :chef_solo do |chef|
chef.add_recipe "apache2"
chef.json = { :apache => { :default_site_enabled => true } }
end
I also add cookbook to my project
git submodule add https://github.com/svanzoest-cookbooks/apache2/ cookbooks/apache2
But when I run vagrant provision, I get this
==> default: [2015-03-26T14:55:52+00:00] INFO: Forking chef instance to converge...
==> default: [2015-03-26T14:55:52+00:00] INFO: *** Chef 12.1.2 ***
==> default: [2015-03-26T14:55:52+00:00] INFO: Chef-client pid: 1130
==> default: [2015-03-26T14:55:54+00:00] INFO: Setting the run_list to ["recipe[apache2]"] from CLI options
==> default: [2015-03-26T14:55:54+00:00] INFO: Run List is [recipe[apache2]]
==> default: [2015-03-26T14:55:54+00:00] INFO: Run List expands to [apache2]
==> default: [2015-03-26T14:55:54+00:00] INFO: Starting Chef Run for precise32
==> default: [2015-03-26T14:55:54+00:00] INFO: Running start handlers
==> default: [2015-03-26T14:55:54+00:00] INFO: Start handlers complete.
==> default: [2015-03-26T14:55:54+00:00] ERROR: Running exception handlers
==> default: [2015-03-26T14:55:54+00:00] ERROR: Exception handlers complete
==> default: [2015-03-26T14:55:54+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-03-26T14:55:54+00:00] ERROR: Cookbook iptables not found. If you're loading iptables from another cookbook, make sure you configure the dependency in your metadata
==> default: [2015-03-26T14:55:54+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Maybe iptables cookbook is required, so I add it. And then I get this message
==> default: [2015-03-26T14:58:32+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-03-26T14:58:32+00:00] ERROR: Cookbook logrotate not found. If you're loading logrotate from another cookbook, make sure you configure the dependency in your
==> default: [2015-03-26T14:58:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
logrotate cookbook is required?
Why does it continuously require cookbook? What is metadata here?
Can anyone help me?

Cookbooks can have dependencies to other cookbooks. This allows them to rely on functionality provided by these other cookbooks.
In your case, your apache2 cookbook depends on the iptables and the logrotate cookbooks. You can check this in each cookbook's metadata.rb file. In case of your apache2 cookbook, you can find the metadata.rb file on GitHub.
Note that cookbooks can also have recursive dependencies, i.e. they can have further dependencies which must all be fulfilled. Because if this, it is often recommended to manage your cookbooks with a tool like Berkshelf or Librarian which can download all cookbook dependencies automatically and consistent.

Related

Custom Chef Resource to start newrelic-infra in ubuntu

Initially I started looking at Configure New Relic Infrastructure using Chef to setup newrelic infra chef cookbook for my project using chef solo, after some research I found that the dependencies in the cookbook is no longer supported.
So I decided to write a custom resource in the recipe so I can utilize chef idempotency.
I have tried the following steps under Install for Ubuntu in my ubuntu box and verified new relic-infra installation:
Now I am trying write a chef resource like this:
Step1: Create a configuration file, and add your license key:
echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
Added this resource block in my recipe for Step1:
file '/etc/newrelic-infra.yml' do
content 'license_key: added_key_here'
mode '0755'
owner 'root'
group 'root'
end
Step2: Enable New Relic's GPG key:
curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
Added this resource block in my recipe for Step2:
apt_repository 'newrelic_key' do
uri 'https://download.newrelic.com/infrastructure_agent/gpg'
trusted true
key 'https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg'
end
I verified this step in the local box by listing the keys using this command:
sudo apt-key list
Step3: Create the agent's apt repo using the command for your distribution version:
printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt bionic main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
Added this resource block in my recipe for Step3:
file '/etc/apt/sources.list.d/newrelic-infra.list' do
content 'deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt bionic main'
mode '0755'
owner 'root'
group 'root'
end
Step4: Update your apt cache and Run the install script:
sudo apt-get update
sudo apt-get install newrelic-infra -y
Added this resource block in my recipe for Step4:
apt_update
apt_package 'newrelic-infra'
Error:
But the install fails with the following error:
===============================================================================
default: Error executing action `update` on resource 'apt_update[newrelic-infra]'
default: ================================================================================
default:
default: Mixlib::ShellOut::ShellCommandFailed
default: ------------------------------------
default: execute[apt-get -q update] (/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.4.56/lib/chef/provider/apt_update.rb line 70) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
default: ---- Begin output of ["apt-get", "-q", "update"] ----
default: STDOUT:
default:
default: STDERR: E: Malformed entry 1 in list file /etc/apt/sources.list.d/newrelic-infra.list (Component)
default:
default:
default: * apt_package[newrelic-infra] action install
default: * No candidate version available for newrelic-infra
default:
default:
default: ================================================================================
default:
default: Error executing action `install` on resource 'apt_package[newrelic-infra]'
default:
default: ================================================================================
default:
default:
default:
default:
default: Chef::Exceptions::Package
default: -------------------------
default: No candidate version available for newrelic-infra
default:
default: Resource Declaration:
default: ---------------------
default: # In /etc/chef/local-mode-cache/cache/cookbooks/repo/recipes/default.rb
default:
default: 38: apt_package 'newrelic-infra'
default: 39:
default:
default: Compiled Resource:
default: ------------------
default: # Declared in /etc/chef/local-mode-cache/cache/cookbooks/repo/recipes/default.rb:38:in `from_file'
default:
default: apt_package("newrelic-infra") do
default: package_name "newrelic-infra"
default: action [:install]
default: default_guard_interpreter :default
default:
default: declared_type :apt_package
default:
default:
default: cookbook_name "repo"
default: recipe_name "default"
default: end
default:
default: System Info:
default: ------------
default: chef_version=14.4.56
default: platform=ubuntu
default: platform_version=18.04
default: ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
default: program_name=/usr/bin/chef-solo
default: executable=/opt/chefdk/bin/chef-solo
default:
default:
default: Running handlers:
default: [2019-08-30T18:19:30+00:00] ERROR: Running exception handlers
default: Running handlers complete
default: [2019-08-30T18:19:30+00:00] ERROR: Exception handlers complete
default: Chef Client failed. 6 resources updated in 48 seconds
default: [2019-08-30T18:19:30+00:00] FATAL: Stacktrace dumped to /etc/chef/local-mode-cache/cache/chef-stacktrace.out
default: [2019-08-30T18:19:30+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
default: [2019-08-30T18:19:30+00:00] FATAL: Chef::Exceptions::Package: apt_package[newrelic-infra] (repo-deploy::default line 38) had an error: Chef::Exceptions::Package: No candidate version available for newrelic-infra
I ran my vagrant file and it works for every step successfully but fails in the final install step... What am I doing wrong? Any troubleshooting tips would be helpful. Thanks!
firstly, you can combine together steps 2 and 3 using apt_repository by utilizing the arch and distribution.
if you read apt_repository documentation, you can see that you can even drop the apt update in step 4
Adding a new repository will update the APT package cache immediately.
secondly, back to your question...
from looking at your logs, specifically
default: execute[apt-get -q update] (/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.4.56/lib/chef/provider/apt_update.rb line 70) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
it appears that you do not run chef-client on your node, rather you are using chef-dk. make sure that you are running chef-client (or chef infra client nowadays) within the node that you like to converge.
you can run chef-client in higher log level to reveal more about the execution by specifying the log_level
The level of logging to be stored in a log file. Possible levels: auto (default), debug, info, warn, error, or fatal. Default value: warn (when a terminal is available) or info (when a terminal is not available).
i hope it will help you solving your issue
Thanks again #Mr for providing your input. If anyone is wondering about the custom resource for new relic infra, here you go:
file '/etc/newrelic-infra.yml' do
content 'license_key: added my license key here'
mode '0755'
owner 'root'
group 'root'
end
apt_repository 'newrelic-infra' do
uri 'https://download.newrelic.com/infrastructure_agent/linux/apt'
trusted true
arch 'amd64'
components ['main']
distribution 'bionic'
key 'https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg'
end

Installation of MediaWiki Vagrant - error logs

I try to install MediaWiki Vagrant. Also, I follow this page.
I'm on a very new Ubuntu 16.04 installation and I've got this error message :
==> default: Error: /usr/local/bin/multiversion-install /vagrant/mediawiki --wiki wiki --dbname wiki --dbpass wikipassword --dbuser wikiadmin --pass vagrant --scriptpath /w --server http://dev.wiki.local.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/wiki wiki Admin
==> default: returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_setup]/returns: change from notrun to 0 failed: /usr/local/bin/multiversion-install /vagrant/mediawiki --wiki wiki --dbname wiki --dbpass wikipassword --dbuser wikiadmin --pass vagrant --scriptpath /w --server http://dev.wiki.local.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/wiki wiki Admin
==> default: returned 1 instead of one of [0]
Here are all my logs :
cywil#cywil-GT70-2OC-2OD:~$ cd vagrant
cywil#cywil-GT70-2OC-2OD:~/vagrant$ ./setup.sh
You're all set! Simply run `vagrant up` to boot your new environment.
(Or try `vagrant config --list` to see what else you can tweak.)
cywil#cywil-GT70-2OC-2OD:~/vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'debian/contrib-jessie64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 8080 (guest) => 8080 (host) (adapter 1)
default: 443 (guest) => 4430 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.36
default: VirtualBox Version: 5.0
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/cywil/vagrant
default: /vagrant/logs => /home/cywil/vagrant/logs
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default: Vanilla Debian box. See https://atlas.hashicorp.com/debian/ for help and bug reports
cywil#cywil-GT70-2OC-2OD:~/vagrant$ vagrant roles list
Available roles:
abusefilter inputbox restbase
accountinfo interwiki revisionslider
analytics invitesignup sal
antispam jsduck sandboxlink
antispoof jsonconfig scholarships
apex kafka score
apparmor kartographer scribunto
articleplaceholder kartographerwv securepoll
babel keystone semanticextraspecialproperties
betafeatures l10nupdate semanticmediawiki
buggy labeledsectiontransclusion semanticresultformats
campaigns langwikis semantictitle
cassandra ldapauth sentry
categorytree liquidthreads shorturl
centralauth livingstyleguide simple_miser
centralnotice lockdown simple_performant
checkuser loginnotify sitematrix
cirrussearch maps spark
cite massaction statsd
citoid massmessage striker
cldr math svg
codeeditor mathoid swift
cologneblue mathsearch templatedata
commons memcached templatesandbox
commons_datasets mleb templatestyles
commonsmetadata mobileapp testwiki
confirmedit mobilecontentservice textextracts
contactpage mobilefrontend three_d
contenttranslation modern throttleoverride
disableaccount molhandler thumb_on_404
disambiguator * monobook thumbor
doublewiki multimedia tidy
easytimeline multimediaviewer timedmediahandler
echo navigationtiming timeless
education newsletter titleblacklist
elk newusermessage torblock
emailauth notebook translate
embedvideo nuke uls
eventbus oathauth uploadslink
eventlogging oauth uploadwizard
externalstore oauthauthentication urlgetparameters
featuredfeeds oozie urlshortener
fileannotations openbadges usermerge
flaggedrevs ores variables
flow pageassessments varnish
fss pagedtiffhandler vectorbeta
fundraising pageimages vipsscaler
gadgets pagetriage visualeditor
gadgets2 pageviewinfo warnings_as_errors
geodata parserfunctions widgets
geodata_elastic parsoid wikibase_repo
geshi payments wikidata
gettingstarted pdfhandler wikidatapagebanner
globalblocking performanceinspector wikidiff2
globalcssjs phabricator wikieditor
globalusage phptags wikigrok
globaluserpage phragile wikihiero
gpgmail pipeescape wikilove
graph poem wikimediaevents
graphoid poolcounter wikimediaflow
greystuff popups wikimediaincubator
guidedtour private wikimediamaintenance
gwtoolset proofreadpage wikimediamessages
hadoop psr3 wikimetrics
headertabs questycaptcha wikispeech
hive quicksurveys wikitech
https quips xanalytics
hue quiz xhprofgui
iabot raita youtube
iegreview relatedarticles zend
imagemetrics renameuser zero
Roles marked with '*' are enabled.
Note that roles enabled by dependency are not marked.
Use `vagrant roles enable` & `vagrant roles disable` to customize.
cywil#cywil-GT70-2OC-2OD:~/vagrant$ vagrant roles enable monobook
Ok. Run `vagrant provision` to apply your changes.
cywil#cywil-GT70-2OC-2OD:~/vagrant$ vagrant provision
==> default: Running provisioner: lsb_check...
==> default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20170425-9233-r1b890.sh
==> default: Running provisioner: puppet...
==> default: Running Puppet with site.pp...
==> default: Info: Loading facts
==> default: Notice: Compiled catalog for mediawiki-vagrant.dev in environment production in 4.18 seconds
==> default: Info: Applying configuration version '1493114917.f0b87099'
==> default: Notice: /Stage[main]/Npm/Exec[npm_set_cache_dir]/returns: executed successfully
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_setup]/returns: Could not open input file: /vagrant/mediawiki/maintenance/install.php
==> default: Error: /usr/local/bin/multiversion-install /vagrant/mediawiki --wiki wiki --dbname wiki --dbpass wikipassword --dbuser wikiadmin --pass vagrant --scriptpath /w --server http://dev.wiki.local.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/wiki wiki Admin
==> default: returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_setup]/returns: change from notrun to 0 failed: /usr/local/bin/multiversion-install /vagrant/mediawiki --wiki wiki --dbname wiki --dbpass wikipassword --dbuser wikiadmin --pass vagrant --scriptpath /w --server http://dev.wiki.local.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/wiki wiki Admin
==> default: returned 1 instead of one of [0]
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_include_extra_settings]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_include_extra_settings]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_copy_LocalSettings]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_copy_LocalSettings]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/File[/lib/systemd/system/mediawiki-ready.service]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/File[/lib/systemd/system/mediawiki-ready.service]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/Exec[systemd reload for mediawiki-ready]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/Exec[systemd reload for mediawiki-ready]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/Service[mediawiki-ready]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Ready_service/Systemd::Service[mediawiki-ready]/Service[mediawiki-ready]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/File[/etc/systemd/system/hhvm.service.d]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/File[/etc/systemd/system/hhvm.service.d]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/File[/etc/systemd/system/hhvm.service.d/puppet-override.conf]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/File[/etc/systemd/system/hhvm.service.d/puppet-override.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/Exec[systemd reload for hhvm]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/Exec[systemd reload for hhvm]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/Service[hhvm]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Hhvm::Fcgi/Systemd::Service[hhvm]/Service[hhvm]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Group[devwiki_suppress]/Mediawiki::Settings[devwiki_suppress_group]/File[/vagrant/settings.d/wikis/wiki/settings.d/puppet-managed/10-devwiki_suppress_group.php]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::Group[devwiki_suppress]/Mediawiki::Settings[devwiki_suppress_group]/File[/vagrant/settings.d/wikis/wiki/settings.d/puppet-managed/10-devwiki_suppress_group.php]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Exec[update_all_databases]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Exec[update_all_databases]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::User[admin_user_in_steward_suppress_on_wiki]/Mediawiki::Maintenance[mediawiki_user_Admin_wiki]/Exec[mediawiki_user_Admin_wiki]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::User[admin_user_in_steward_suppress_on_wiki]/Mediawiki::Maintenance[mediawiki_user_Admin_wiki]/Exec[mediawiki_user_Admin_wiki]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::User[admin_user_in_steward_suppress_on_wiki]/Mediawiki::Maintenance[mediawiki_user_Admin_wiki_steward,suppress]/Exec[mediawiki_user_Admin_wiki_steward,suppress]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::User[admin_user_in_steward_suppress_on_wiki]/Mediawiki::Maintenance[mediawiki_user_Admin_wiki_steward,suppress]/Exec[mediawiki_user_Admin_wiki_steward,suppress]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Import::Text[Main_Page]/Mediawiki::Maintenance[add page devwiki/Main_Page]/Exec[add page devwiki/Main_Page]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::Import::Text[Main_Page]/Mediawiki::Maintenance[add page devwiki/Main_Page]/Exec[add page devwiki/Main_Page]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Import::Text[Template:Main_Page]/Mediawiki::Maintenance[add page devwiki/Template:Main_Page]/Exec[add page devwiki/Template:Main_Page]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki/Mediawiki::Import::Text[Template:Main_Page]/Mediawiki::Maintenance[add page devwiki/Template:Main_Page]/Exec[add page devwiki/Template:Main_Page]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/File[/etc/default/jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/File[/etc/default/jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/File[/etc/jobrunner.json]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/File[/etc/jobrunner.json]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/File[/etc/logrotate.d/mediawiki_jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/File[/etc/logrotate.d/mediawiki_jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/File[/etc/logrotate.d/mediawiki_jobchron]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/File[/etc/logrotate.d/mediawiki_jobchron]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Git::Clone[mediawiki/services/jobrunner]/File[/vagrant/srv/jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Git::Clone[mediawiki/services/jobrunner]/File[/vagrant/srv/jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Git::Clone[mediawiki/services/jobrunner]/Exec[git_clone_mediawiki/services/jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Git::Clone[mediawiki/services/jobrunner]/Exec[git_clone_mediawiki/services/jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Service::Gitupdate[jobrunner]/File[/etc/mw-vagrant/services/jobrunner.conf]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Service::Gitupdate[jobrunner]/File[/etc/mw-vagrant/services/jobrunner.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Service::Gitupdate[jobchron]/File[/etc/mw-vagrant/services/jobchron.conf]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Service::Gitupdate[jobchron]/File[/etc/mw-vagrant/services/jobchron.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/File[/lib/systemd/system/jobrunner.service]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/File[/lib/systemd/system/jobrunner.service]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/Exec[systemd reload for jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/Exec[systemd reload for jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/Service[jobrunner]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobrunner]/Service[jobrunner]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/File[/lib/systemd/system/jobchron.service]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/File[/lib/systemd/system/jobchron.service]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/Exec[systemd reload for jobchron]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/Exec[systemd reload for jobchron]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/Service[jobchron]: Dependency Exec[wiki_setup] has failures: true
==> default: Warning: /Stage[main]/Mediawiki::Jobrunner/Systemd::Service[jobchron]/Service[jobchron]: Skipping because of failed dependencies
==> default: Notice: Finished catalog run in 5.22 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
What can I do ?
Many thanks by advanced for your answers !
Cyril

Can't find external cookbooks, Vagrant with Chef Solo

I inherited a project that hasn’t been deployed in a couple of years. It was originally set-up for local deployment on a Vagrant machine using Chef.
When I run the the vagrant up command, I get an error that it is not finding some cookbooks. First it was not finding cookbooks in the cookbooks directory specified in the Vagrantfile. I fixed this by adding a metadata.rb file to the cookbook i was trying to run. It looks like
#cookbooks/app/metadata.rb
depends "openssl" # this is in the cookbooks directory
depends "build-essential" # this in the cookbooks directory
depends "git" # this in the cookbooks directory
Now when I run vagrant up it breaks in the git cookbook because it cannot find one of it’s dependencies, dmg (which I don’t even need).
So how do I install these cookbooks dependencies so that it will run. Should these cookbooks be installed on my host machine (i.e. my Mac which hosts the Vagrant box) or on the Vagrant itself.
I have downloaded the ChefDK and have Berkshelf but am not sure how to use it on and existing project. Also based on the solo.rb file it looks like it is looking for cookbooks in /etc/chef/cookbooks.
# solo.rb
log_level :info
cookbook_path "/etc/chef/cookbooks"
json_attribs "/etc/chef/cookbooks/node_staging.json"
role_path "/etc/chef/roles"
Here is sample output from running vagrant up.
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-11-30T19:46:31+00:00] INFO: Forking chef instance to converge...
==> default: [2015-11-30T19:46:31+00:00] WARN:
==> default: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
==> default: SSL validation of HTTPS requests is disabled. HTTPS connections are still
==> default: encrypted, but chef is not able to detect forged replies or man in the middle
==> default: attacks.
==> default:
==> default: To fix this issue add an entry like this to your configuration file:
==> default:
==> default: ```
==> default: # Verify all HTTPS connections (recommended)
==> default: ssl_verify_mode :verify_peer
==> default:
==> default: # OR, Verify only connections to chef-server
==> default: verify_api_cert true
==> default: ```
==> default:
==> default: To check your SSL configuration, or troubleshoot errors, you can use the
==> default: `knife ssl check` command like so:
==> default:
==> default: ```
==> default: knife ssl check -c /tmp/vagrant-chef/solo.rb
==> default: ```
==> default:
==> default: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
==> default: Starting Chef Client, version 11.18.12
==> default: [2015-11-30T19:46:31+00:00] INFO: *** Chef 11.18.12 ***
==> default: [2015-11-30T19:46:31+00:00] INFO: Chef-client pid: 1844
==> default: [2015-11-30T19:46:32+00:00] INFO: Setting the run_list to ["role[vagrant]"] from CLI options
==> default: [2015-11-30T19:46:32+00:00] INFO: Run List is [role[vagrant]]
==> default: [2015-11-30T19:46:32+00:00] INFO: Run List expands to [app::default]
==> default: [2015-11-30T19:46:32+00:00] INFO: Starting Chef Run for geosurvey
==> default: [2015-11-30T19:46:32+00:00] INFO: Running start handlers
==> default: [2015-11-30T19:46:32+00:00] INFO: Start handlers complete.
==> default: Compiling Cookbooks...
==> default:
==> default: Running handlers:
==> default: [2015-11-30T19:46:32+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default:
==> default: [2015-11-30T19:46:32+00:00] ERROR: Exception handlers complete
==> default: [2015-11-30T19:46:32+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: Chef Client failed. 0 resources updated in 1.06392657 seconds
==> default: [2015-11-30T19:46:32+00:00] ERROR: Cookbook dmg not found. If you're loading dmg from another cookbook, make sure you configure the dependency in your metadata
==> default: [2015-11-30T19:46:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Vagrant on its own doesn't support Berkshelf integration. There is a plugin available for it (vagrant-berkshelf) which will pull in dependencies and sync them to the VM, but it isn't recommended given that it can be a bit flaky. Test Kitchen (with kitchen-vagrant) is generally easier. You can also do it manually by using the berks vendor command to download the deps and dump them into a folder structure chef-solo can use.
I have similar problems and managed to solved them party.
Installing vagrant berkshelf plugin solves it party. As I understand one has to go through each cookbook and type barks install appart from configuring vagrant barkshelf like this:
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = "./cookbooks/database/Berksfile"
But I'm exploring this vendor solution that didn't work quite well.
As far I understand to coderanger if I had a a directory named "./cookbooks-source" and within have a bunch of cookbooks (cb1, cb2, cb3, ...) I would have to iterate each of them and type something like
berks vendor ../../cookbooks
but then each of these cookbooks dependencies might conflict with each other ? Plus I find it quite inconvenient. Also exploring berks package but just don't know how to hook it up to vagrant.

Vagrant Provision, Chef Error: You must specify at least one cookbook repo path

I'm trying to set up Vagrant for web development, on Windows 8.1. I've already hit the problem undefined method “cheffish” for nil:NilClass, so am using Vagrant 1.7.4 with Chef 12.3.0.
I can't solve this error:
ERROR: You must specify at least one cookbook repo path
from:
c:\web\project>vagrant provision
==> default: The cookbook path 'c:/web/project/cookbooks' doesn't exist. Ignoring...
==> default: The cookbook path 'c:/web/project/site-cookbooks' doesn't exist. Ignoring...
==> default: Chef 12.3.0 Omnibus package is already installed.
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-07-21T10:08:00+00:00] INFO: Forking chef instance to converge...
==> default: Starting Chef Client, version 12.3.0
==> default: [2015-07-21T10:08:00+00:00] INFO: *** Chef 12.3.0 ***
==> default: [2015-07-21T10:08:00+00:00] INFO: Chef-client pid: 1813
==> default: [2015-07-21T10:08:01+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[nodejs]", "recipe[postgresql]", "recipe[postgresql::ser
ver]", "recipe[postgresql::client]"] from CLI options
==> default: [2015-07-21T10:08:01+00:00] INFO: Run List is [recipe[apt], recipe[nodejs], recipe[postgresql], recipe[postgresql::server], recipe[postgr
esql::client]]
==> default: [2015-07-21T10:08:01+00:00] INFO: Run List expands to [apt, nodejs, postgresql, postgresql::server, postgresql::client]
==> default: [2015-07-21T10:08:01+00:00] INFO: Starting Chef Run for vagrant-ubuntu-trusty-64
==> default: [2015-07-21T10:08:01+00:00] INFO: Running start handlers
==> default: [2015-07-21T10:08:01+00:00] INFO: Start handlers complete.
==> default: Running handlers:
==> default: [2015-07-21T10:08:01+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2015-07-21T10:08:01+00:00] ERROR: Exception handlers complete
==> default: [2015-07-21T10:08:01+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: Chef Client failed. 0 resources updated in 0.736170145 seconds
==> default: [2015-07-21T10:08:01+00:00] ERROR: You must specify at least one cookbook repo path
==> default: [2015-07-21T10:08:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
config.vm.network :forwarded_port, guest: 8000, host: 8000
# config.omnibus.chef_version = :latest
config.omnibus.chef_version = "12.3.0"
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "nodejs"
chef.add_recipe "postgresql"
chef.add_recipe "postgresql::server"
chef.add_recipe "postgresql::client"
chef.json =
{
postgresql: {
users: [
{
"username" => "postgres",
"password" => "password",
"superuser" => true,
"replication" => false,
"createdb" => true,
"createrole" => false,
"inherit" => true,
"replication" => false,
"login" => true
}
]
}
}
end
end
Cheffile
site "http://community.opscode.com/api/v1"
cookbook 'apt'
cookbook 'nodejs'
cookbook 'build-essential'
cookbook 'postgresql', git: 'https://github.com/phlipper/chef-postgresql'
This vagrant-berkshelf issue looked similar, but deleting .vagrant.d, reloading and provisioning again didn't solve it.
What's causing this?
Thanks!
I installed Chef Dev Tools as this is the simplest way to install Berkshelf 3.0 on Windows. I set up a Berksfile in my project, based on my Cheffile, and enabled Berkshelf in the Vagrantfile. Now it provisions using Berkshelf, and it works.
Given there was no indication that Vagrant was using Berkshelf, I'm still not convinced that Berkshelf was the issue.
It would still be helpful to know how to install the latest Berkshelf version without Chef Dev Tools on Windows.

Set up a test kitchen cookbook recipe to generate chef server inside vagrant

I'm experimenting with chef and test kitchen.
The problem I'm facing is as follows.
I'm using arch linux and I couldn't get chef installed on my machine, so I decided to use a centos7 box for a working vm to do so.
My goal is to have enterprise chef server created using a cookbook by test kitchen and have both machines (server and the working vm) accessible on the same network one depending on the other. So yeah, it's a nested setup.
If anyone has a better idea, I'm open to different suggestions.
For the working vm, I used this box:
https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box
Here's the contents of my Vagrant file:
Vagrant.configure(2) do |config|
config.vm.box = "chef-repo"
config.vm.network "public_network"
end
So really basic stuff ...
I successfully installed chef and test kitchen on that machine and life was good.
The problem now is using test kitchen to install chef server from here:
https://downloads.chef.io/chef-server/
I created a really simple config with test kitchen that resembles the following:
recipes/default.rb
package_url = node['enterprise-chef']['url']
package_name = ::File.basename(package_url)
package_local_path = "#{Chef::Config[:file_cache_path]}/#{package_name}"
# omnibus_package is remote (i.e., a URL) let's download it
remote_file package_local_path do
source package_url
end
package package_local_path
# reconfigure the installation
execute 'private-chef-ctl reconfigure'
...and attributes/default.rb
default['enterprise-chef']['url'] = 'https://web-dl.packagecloud.io/chef/stable/packages/el/7/chef-server-core-12.1.0-1.el7.x86_64.rpm'
After which I run $ kitchen converge and it fails miserably with this:
[vagrant#localhost enterprise-chef]$ kitchen converge
-----> Starting Kitchen (v1.4.0)
-----> Creating <default-centos-65>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'opscode-centos-6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: kitchen-enterprise-chef-default-centos-65_default_1436040993946_29931
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) eth1
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
Vagrant is attempting to interface with the UI in a way that requires
a TTY. Most actions in Vagrant that require a TTY have configuration
switches to disable this requirement. Please do that or run Vagrant
with TTY.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider virtualbox ----
STDOUT: Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'opscode-centos-6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: kitchen-enterprise-chef-default-centos-65_default_1436040993946_29931
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) eth1
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
STDERR: Vagrant is attempting to interface with the UI in a way that requires
a TTY. Most actions in Vagrant that require a TTY have configuration
switches to disable this requirement. Please do that or run Vagrant
with TTY.
---- End output of vagrant up --no-provision --provider virtualbox ----
Ran vagrant up --no-provision --provider virtualbox returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
[vagrant#localhost enterprise-chef]$
I'm currently trying to figure out the problem by manually changing the Vagrantfile located in .kitchen/kitchen-vagrant/kitchen-enterprise-chef-default-centos-65:
Vagrant.configure("2") do |c|
c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf")
c.vm.box = "opscode-centos-6.5"
c.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box"
c.vm.network :public_network
c.vm.synced_folder ".", "/vagrant", disabled: true
c.vm.provider :virtualbox do |p|
end
end
so far, I'm getting this error:
[vagrant#localhost kitchen-enterprise-chef-default-centos-65]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) eth1
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
default: Which interface should the network bridge to? 1
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
^C==> default: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.
$
The default: Warning: Connection timeout. Retrying... goes indefinitely and I'm forced to stop it.
But the machine seems to be running, only inaccessible to the first vagrant instance.
[vagrant#localhost kitchen-enterprise-chef-default-centos-65]$ vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
[vagrant#localhost kitchen-enterprise-chef-default-centos-65]$
My guess is that something is terrible wrong with the network configuration.
Any ideas or some feedback around my setup are very much welcome.
Thank you.
I'd suggest you just use chef-zero provisioner for foodcritic.
provisioner:
name: chef_zero
data_bags_path: /some/path
...
That will spin up a temporary chef-zero server on the host box, and make it available to the foodcritic run. This also saves you the major overhead of a second server running. The only setback I know of here is if you happen to need multiple nodes under test at the same time. I'm not entirely sure how the plugin would handle that. Either it would share one Chef-zero (which could be good or bad), create one per test suite (again, good or bad, depending on what you actually want), or it may just crash.
The chef server cookbook is already setup to run test kitchen:
git clone https://github.com/chef-cookbooks/chef-server.git
cd chef-server
kitchen converge default-centos-71
It leverages vagrant to setup a local IP address for the chef server to run. Would be interesting if this works within your virtual machine (nested virtualization).
An alternate approach is to run your test VMs on Digital ocean leveraging the cloud kitchen file:
https://github.com/chef-cookbooks/chef-server/blob/master/.kitchen.cloud.yml

Resources