Skip to content

Instantly share code, notes, and snippets.

@alexpop
alexpop / inspec-waivers-demo.md
Last active October 18, 2019 16:46
Example for using the new waivers support in InSpec v4.18.5

Example for using the new waivers support in InSpec

myprofile1/controls/profile1.rb

control 'pro1-con1' do
  impact 0.8
  title 'Profile 1 - Control 1'
  describe file('/etc/hosts11111') do
    its('mode') { should eq 0644 }
@alexpop
alexpop / compliance_api_demo.rb
Last active October 21, 2016 10:47
Sample script to auth, list nodes, environments in Chef Compliance using the API
# encoding: utf-8
### Sample script to auth, list nodes, environments in Chef Compliance using the API
### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below
### Chef Compliance API docs: https://docs.chef.io/api_compliance.html
require 'json'
require 'uri'
require 'net/http'
require 'openssl'
@alexpop
alexpop / kitchen_sink.rb
Last active March 16, 2017 10:04
Script to export Chef Server nodes and add them to Chef Compliance
# encoding: utf-8
### Sample script to export Chef Server nodes and import them to Chef Compliance
### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below
### Change the nodes_array json suit your environment
### Go to your chef-repo and check Chef Server access first
# cd chef-repo; knife environment list
### Save this Ruby script as kitchen_sink.rb and run it like this:
# cat kitchen_sink.rb | knife exec
### Chef Compliance API docs: https://docs.chef.io/api_compliance.html
@alexpop
alexpop / gists_checker.rb
Last active November 28, 2017 23:57
Read user's github gists
require 'net/http'
require 'json'
require 'set'
# Method to return the content of the local db as a set
def read_db(file_db)
unless File.exists?(file_db)
return nil
end
read_gists = Set.new