Skip to content

Instantly share code, notes, and snippets.

<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="[email protected]">
<projectUrl>https://github.com/txag1995/sample-cookbook/</projectUrl>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
</properties>
Here is my sample recipe
```
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
if node['tomcat']['base_version'].to_i == 7
if platform_family?('rhel') and node[:platform_version].to_i < 7
include_recipe 'yum-epel'
end
require 'serverspec'
require 'winrm'
set :backend, :winrm
user = 'vagrant'
pass = 'vagrant'
endpoint = "http://#{ENV['TARGET_HOST']}:55985/wsman"
winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
Chef Client failed. 0 resources updated in 24.000853 seconds
[2015-05-21T10:37:19-04:00] INFO: Sending resource update report (run-id: 11174cc4-3612-491c-876b-d62d97a0499b)
[2015-05-21T10:37:19-04:00] FATAL: OpenSSL::SSL::SSLError: windows_package[7z920-x64.msi] (xxx-tomcat::default line 13)
had an error: OpenSSL::SSL::SSLError: remote_file[c:/chef/cache/7z920-x64.msi] (dynamically defined) had an error: OpenS
SL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
PS C:\opscode\chef\bin> cat c:/chef/cache/chef-stacktrace.out
Generated at 2015-05-21 10:37:19 -0400
OpenSSL::SSL::SSLError: windows_package[7z920-x64.msi] (xxx-tomcat::default line 13) had an error: OpenSSL::SSL::SSLErr
or: remote_file[c:/chef/cache/7z920-x64.msi] (dynamically defined) had an error: OpenSSL::SSL::SSLError: SSL_connect re
turned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
#!/bin/bash
#
# consul Manage the consul agent
#
# chkconfig: 2345 95 95
# description: Consul is a tool for service discovery and configuration
# processname: consul
# config: /etc/consul.conf
# pidfile: /var/run/consul.pid
Result of checking assemblies: Ok
Checking environment variables...
EPMINS-01056: Could not set the environment variable TMP.
EPMINS-01056: Could not set the environment variable TMPDIR.
Environment variable /tmp would be used.
Ok
EPMINS-01087: Checking if the file exist and have read permissions: /root...
Failed!
EPMINS-01099: User home have to exist for successful installation.
EPMINS-01001: One or more preinstallation checks failed. Correct the errors before continuing with the installation.
execute 'install-foundation-config' do
command "sudo -u epmsys #{node['xxx-essbase']['hyperion_home']}/configtool.sh --silent #{node['xxx-essbase']['install_dir']}/xxx/foundation-config.xml"
user 'epmsys'
group 'epmsys'
returns [0,5]
action :run
end
[rreilly@wxxxrreilly chef-repo]$ knife bootstrap x.x.x.x -x root -P 'xxx'
Node exists, overwrite it? (Y/N) Y
ERROR: Method Not Allowed
Response: <html><head><title>405 Method Not Allowed</title></head><body><h1>Method Not Allowed</h1>Method Not Allowed<
p><hr><address>mochiweb+webmachine web server</address></body></html>
chef_gem 'chef-provisioning-vsphere' do
action :install
compile_time true
end
require 'chef/provisioning/vsphere_driver'
with_vsphere_driver host: 'xx.xxx.com',
insecure: true,
user: 'admin',
knife bootstrap windows winrm -N xx.xx.xx.net 10.10.64.44 -x 'userxx'
INFO: Using configuration from /home/rreilly/chef-repo/.chef/knife.rb
Waiting for remote response before bootstrap.DEBUG: Adding xx.xx.64.44
DEBUG: :session => :init
DEBUG: :relay_to_servers => echo . & echo Response received.
DEBUG: :relayed => xx.xx.64.44
DEBUG: xx.xx.64.44 => :run_command
DEBUG: xx.xx.64.44[D5E14E88-379E-446A-92BB-48AABA4C8A12] => :shell_open
DEBUG: xx.xx.64.44[D5E14E88-379E-446A-92BB-48AABA4C8A12] => :run_command[echo . & echo Response received.]