Custom Chef Resource to start newrelic-infra in ubuntu - ruby

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

Related

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

'Vagrant up' error - No file(s) found for import of 'nodes/**/*.pp'

I am new to OpenAM, vagrant, and puppet. I am trying to setup OpenAM following OpenAM Vagrant (& here). Using Oracle VirtualBox 5.1.8, Windows 7, and Vagrant 1.8.7 I tried:
git clone https://github.com/phinze/openam-vagrant.git
cd openam-vagrant
cp puppet/nodes/openam.pp.example vagrant up
The (error) trace:
default: Could not parse for environment production: No file(s) found
for import of 'nodes/**/*.pp' at
/tmp/vagrant-puppet/manifests-768747907b90c39ab6f16fcb3320897a/site.pp:3
on node openam.vagrant.dev (changed to my.dev.url)
I have set a FQDN in /etc/hosts and updated the Vagrantfile and openam.pp.example file. I also looked at similar reported issues at SO, but was unsuccessful.
did you rename the /puppet/nodes/openam.pp.example file to /puppet/nodes/openam.pp ?
once you do the update and run vagrant up :
==> default: notice: /Stage[main]/Timer_entropyd::Package/File[timer-entropyd-deb]/ensure: defined content as '{md5}cf94b08aac1f19e0b0681a5abf1964e1'
==> default: notice: /Stage[main]//Exec[apt-get-update]/returns: executed successfully
==> default: notice: /Stage[main]//Node[openam.vagrant.dev]/Package[vim-nox]/ensure: ensure changed 'purged' to 'present'
==> default: notice: /Stage[main]/Timer_entropyd::Package/Package[timer-entropyd]/ensure: ensure changed 'purged' to 'latest'
==> default: notice: /Stage[main]//Node[openam.vagrant.dev]/Package[curl]/ensure: ensure changed 'purged' to 'present'
==> default: notice: /Stage[main]/Tomcat::Package/Package[tomcat6]/ensure: ensure changed 'purged' to 'present'
==> default: notice: /Stage[main]/Tomcat::Config/File[/etc/default/tomcat6]/content: content changed '{md5}bc5b21625e2fa3cc8ada6ba03fe3bcd3' to '{md5}dbf709ff719e76ded1734582c6a1e2f1'
==> default: notice: /Stage[main]/Tomcat::Config/File[/etc/tomcat6/server.xml]/content: content changed '{md5}1733213f7f85c894ee210c14de6eddc1' to '{md5}0210005c49f6e01ada8dc27c3b712709'
==> default: notice: /Stage[main]/Tomcat::Config/File[/usr/share/tomcat6]/owner: owner changed 'root' to 'tomcat6'
==> default: notice: /Stage[main]/Tomcat::Config/File[/usr/share/tomcat6]/group: group changed 'root' to 'tomcat6'
==> default: notice: /Stage[main]/Openam::Prereqs/Package[unzip]/ensure: ensure changed 'purged' to 'present'
==> default: notice: /Stage[main]/Openam::Download/File[/usr/local/src/openam]/ensure: created
==> default: notice: /Stage[main]/Openam::Download/Exec[download-openam]/returns: executed successfully
==> default: notice: /Stage[main]/Openam::Download/Exec[unzip-openam]/returns: executed successfully
==> default: notice: /Stage[main]/Openam::War/Exec[install-openam-war]/returns: executed successfully
==> default: notice: /Stage[main]/Openam::Configurator/File[/var/lib/openam]/ensure: created
==> default: notice: /Stage[main]/Openam::Configurator/File[/var/lib/openam/configurator.jar]/ensure: defined content as '{md5}9c95981acd876be865a0293eb16eab89'
==> default: notice: /Stage[main]/Tomcat::Service/Service[tomcat6]: Triggered 'refresh' from 1 events
==> default: notice: /Stage[main]/Openam::Config/File[/etc/openam]/ensure: created
==> default: notice: /Stage[main]/Openam::Config/File[/etc/openam/initial_configuration.properties]/ensure: defined content as '{md5}b528e7c1773ae0bd5568657a90241b2a'
==> default: notice: /Stage[main]/Openam::Config/Exec[openam-configurator]/returns: Checking configuration directory /etc/openam/....Success.
....

chef on virtualbox. guest is downloading very slowly from host

I am using vagrant and chef to build a VM.
Host: OSX 10.9.5
audrey:ubuntu2 jluc$ chef -v
Chef Development Kit Version: 0.10.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2
audrey:ubuntu2 jluc$ vagrant -v
Vagrant 1.8.1
audrey:ubuntu2 jluc$ vagrant plugin list
vagrant-berkshelf (4.1.0)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.5, system)
Virtualbox: 5, but same on 4 previously.
Guest: Ubuntu 14.04
Background: I am using alien to install Oracle rpm. However, you can't just point the client to a url or package somewhere, you need to download the rpms from Oracle, accept conditions and then make the files available to your client install. There are 2 rpms, one 30MB, one 640KB.
I am doing this by launching a http server on the host, on port 9003.
Problem:
The download/remote_file time, within the chef run, is anywhere from 5-20 minutes, while I can wget/curl them from within the guest in 5-15 seconds.
Details:
The following chef code deals with those files:
ip = node[:network][:default_gateway]
simplehttp_port=node[:basedjango][:port_host_fileserver]
fn_basic = "oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm"
execute 'download_basic' do
cwd "/tmp"
command "wget http://#{ip}:#{simplehttp_port}/#{fn_basic} "
not_if do ::File.exists?(fnp_basic) end
end
#I have also used this instead, just as slow...
remote_file fnp_basic do
uri = "http://#{ip}:#{simplehttp_port}/#{fn_basic}"
not_if do ::File.exists?(fnp_basic) end
mode '0755'
action :create
end
My problem is that I can vagrant ssh into the guest and wget or curl the file in anything from 5 to 15 seconds. From the chef cookbooks, I am looking at 5-20 minutes each time (there is a condition guard to avoid downloading it if it exists).
==> default: [2016-01-18T11:13:58-08:00] INFO: file[/etc/profile.d/ORACLE_HOME.sh] mode changed to 755
==> default:
==> default: - change mode from '' to '0755'
==> default:
==> default: - change owner from '' to 'root'
==> default:
==> default: - change group from '' to 'root'
==> default:
==> default: (up to date)
==> default: Recipe: basedjango::oracle
==> default:
==> default: * execute[download_basic] action run
!!! 11:13 to 11:28 => 15 minutes here.
==> default: [2016-01-18T11:28:04-08:00] INFO:
execute[download_basic] ran successfully
==> default:
==> default: - execute wget http://10.0.2.2:9003/oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm
==> default: * execute[install_basic] action run
And here is the same command, executed manually via vagrant ssh. About 2 seconds in this case.
vagrant#vagrant:/tmp$ wget http://10.0.2.2:9003/oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm
--2016-01-18 11:50:40-- http://10.0.2.2:9003/oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm
Connecting to 10.0.2.2:9003... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30940809 (30M) [text/html]
Saving to: ‘oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm’
100%[====================================================================================================================================================================================>] 30,940,809 17.8MB/s in 1.7s
2016-01-18 11:50:41 (17.8 MB/s) - ‘oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm’ saved [30940809/30940809]
The remote_file resource behaves the same way, so at first I thought it was something wrong with it or the way I use it. The rpms are NOT being served from the Vagrant shared directory, btw.
Any ideas?
I don't know if you haven't already found a solution, but when I had that issue (even downloading from another server) I could 'fix' it by enabling debug output for chef. This magically increased the download speed.
Simply put
config.vm.provion :chef_solo |chef|
chef.log_level = 'debug'
[...]
end

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.

Cannot use chef provisioning in 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.

Resources