Skip to content

Instantly share code, notes, and snippets.

:octocat:
Coding

Antek Baranski Sauraus

:octocat:
Coding
  • Vid Inc
  • Los Angeles, CA
Block or report user

Report or block Sauraus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View encrypted data bag update
secret = Chef::EncryptedDataBagItem.load_secret("#{node['diw']['base']['secrets']}")
require 'net/ssh'
key = OpenSSL::PKey::RSA.new(4096)
private_key = key.to_pem
public_key = "#{key.ssh_type} #{[key.to_blob].pack('m0')}"
jenkins_keys = {
"id" => "#{node[:hostname]}",
@Sauraus
Sauraus / provider
Last active Aug 29, 2015
Force execution of provider
View provider
selinux_policy_module modulename do
action :deploy
end
end
file "#{path}/#{modulename}.pp" do
action :delete
end
selinux_policy_module modulename do
@Sauraus
Sauraus / chef-client
Created May 7, 2015
git recipe fails to install
View chef-client
Recipe: git::default
* git_client[default] action install
================================================================================
Error executing action `install` on resource 'git_client[default]'
================================================================================
NoMethodError
-------------
undefined method `package_version' for Chef::Resource::YumPackage
@Sauraus
Sauraus / error
Last active Aug 29, 2015
undefined method `action_create' for #<Chef::Provider::Package::Yum:0x000000014591f0>
View error
[2015-06-02T23:26:42+00:00] DEBUG: yum_package[chef] checking rpm status
warning: /tmp/kitchen/cache/omnibus_updater/chef-12.3.0-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
chef 12.3.0-1.el6
[2015-06-02T23:26:42+00:00] DEBUG: yum_package[chef] installed version: ["12.2.1-1.el6"] candidate version: 12.3.0-1.el6
================================================================================
Error executing action `create` on resource 'yum_package[chef]'
================================================================================
View recipe
# Support whyrun
def whyrun_supported?
true
end
action :create do
if @current_resource.exists
Chef::Log.info "#{ @current_resource } already exists - nothing to do."
else
converge_by("Create #{ @current_resource }") do
View gist:512df5b9ff626716e6f6
node.default['my-base']['centos']['repo_url'] = "SOME_URL_#{(node.chef_environment.eql? 'sandbox') ? 'dev' : 'prod'}"
node.default['yum']['base']['enabled'] = true
node.set['yum']['base']['mirrorlist'] = nil
node.set['yum']['base']['baseurl'] = "#{node['my-base']['centos']['repo_url']}/$releasever/os/$basearch/"
node.default['yum']['base']['sslverify'] = false
node.default['yum']['base']['gpgcheck'] = false
node.default['yum']['updates']['enabled'] = true
@Sauraus
Sauraus / result
Last active Aug 29, 2015
directory content serverspec test
View result
/etc/yum.repos.d/base.repo
/etc/yum.repos.d/updates.repo
/etc/yum.repos.d/extras.repo
veryfing centos yum channel repositories
File "/etc/yum.repos.d/base.repo"
should exist
should be owned by "root"
should be grouped into "root"
File "/etc/yum.repos.d/updates.repo"
View command line dscl to create user works
unless tagged?('jenkins_mac_user_created')
bash "Creating jenkins user on Mac OSX" do
user "root"
cwd "/tmp"
code <<-EOH
#!/bin/sh
. /etc/rc.common
dscl . create /Users/jenkins
dscl . create /Users/jenkins RealName "Jenkins user"
dscl . passwd /Users/jenkins L1\\$ten2me
@Sauraus
Sauraus / windows_package
Created Oct 27, 2015
only_if vs is on Chef resource
View windows_package
windows_package 'Visual Studio 2015 Tools for Unity' do
source 'http://MY_SECRET_SERVER//visualstudio/2015/vstu2015.msi'
checksum 'b326526c02c0142d0a2e7d6fe4f448a96bbebd5b4f8f333dd181d3ada911fbfa'
installer_type :msi
action :install
# only_if { platform_family?('windows') }
end if platform_family?('windows')
@Sauraus
Sauraus / chef-client 12.4.3 output
Last active Nov 2, 2015
LWRP silent failure :(
View chef-client 12.4.3 output
$ kitchen converge editor-macosx-1010
-----> Starting Kitchen (v1.4.2)
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/webagent-cookie.rb:458: warning: already initialized constant HTTPClient::CookieManager
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:8: warning: previous definition of CookieManager was here
-----> Creating <editor-macosx-1010>...
D, [2015-11-02T12:53:59.964757 #10867] DEBUG -- : Celluloid 0.17.0 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'macosx-10.10'. This can take some time...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
You can’t perform that action at this time.