Skip to content

Instantly share code, notes, and snippets.

[chef@ip-172-31-58-233 ~]$ chef generate repo chef-repo
Generating Chef Infra repo chef-repo
- Ensuring correct Chef Infra repo file content
[2019-07-22T09:22:01+00:00] WARN: Found a directory chef-repo in the cookbook path, but it contains no cookbook files. skipping.
================================================================================
Error executing action `create_if_missing` on resource 'template[/home/chef/chef-repo/LICENSE]'
================================================================================
NoMethodError
@drrk
drrk / gist:aa762f3b12deec72d2ac8dd757382b04
Last active June 13, 2019 19:31
Chef Jumpstart Quick Reference
chef-run chef@node1 file '/etc/motd'
content='Welcome to Chef’ --password Cod3Can!
chef-run chef@node1 motd.rb --password Cod3Can!
chef-run winrm://Administrator@winnode1 file_experiment.rb --password Cod3Can!
chef generate cookbook -P setup
chef generate template motd
kitchen converge
kitchen verify
kitchen destroy
chef generate cookbook -P mycorp_resources
@drrk
drrk / fixsudo.rb
Last active March 29, 2017 14:34
Fix Sudo Hack
delete_lines 'remove requiretty from sudoers' do
path '/etc/sudoers'
pattern '^.*requiretty'
end
@drrk
drrk / .kitchen.yml
Last active March 29, 2017 14:21
Chef TTD Azure Workshop Test Kitchen Config
---
driver:
name: azurerm
driver_config:
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
location: 'West Europe'
machine_size: 'Standard_D1'
transport:
@drrk
drrk / README
Created September 6, 2016 17:15
remote_file error test recipe
The host 192.168.0.9 in the test above does not exist,
and bowerham.net does not respond on port 5678,
but is dropped by the firewall completly,
not even returning a port closed response.
lhrkjohnson001:test_remote_file kjohnson$ kitchen converge
-----> Starting Kitchen (v1.10.2)
-----> Creating <default-windows2012>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'windows-2012r2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: kitchen-test_remote_file-default-windows2012_default_1473181164709_29566
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat

Keybase proof

I hereby claim:

  • I am drrk on github.
  • I am drrk (https://keybase.io/drrk) on keybase.
  • I have a public key ASCfVkUm2sx6vDihokODR-Vt7n1nj_vLTtFMcU86SV7g3wo

To claim this, I am signing this object:

@drrk
drrk / gist:4a17c4394f93d0f9123560af056f6f30
Created August 5, 2016 22:53
NTP update micropython time
# borrowed from https://github.com/micropython/micropython/blob/master/esp8266/scripts/ntptime.py
import socket
import pyb
import network
import utime
import socket
# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
NTP_DELTA = 3155673600
@drrk
drrk / iis_demo\recipes\default.rb
Last active December 9, 2015 11:59
iis_demo recipe
powershell_script "Install IIS" do
code "add-windowsfeature Web-Server"
action :run
end
service "w3svc" do
action [:enable, :start ]
end
#node.default["iis_demo"]["indexfile"] = "Default2.htm"