This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plain_pass = Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")["password"] | |
p plain_pass | |
#if unix box | |
if node['platform'] == 'ubuntu' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'core::local_users' do | |
before (stub_resources) | |
let (:chef_run) do | |
ChefSpec::SoloRunner.new do |node, server| | |
env = Chef::Environment.new | |
env.name 'my_environment' | |
env.override_attributes(encrypted_data_bag_secret_key_path: 'C:/tmp/vagrant-chef-2/encrypted_data_bag_secret') | |
allow(server).to receive(:encrypted_data_bag_secret_key_path).and_return(env.override_attributes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def svc_create_user(user,shadow_password) | |
user user do | |
supports :manage_home => true | |
comment "chef created service user: #{user}" | |
home "/home/#{user}" | |
shell 'usr/sbin/nologin' | |
action :create | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_login_rights(user) | |
cookbook_file "ntrights.exe" do | |
source "ntrights.exe" | |
path "C:/users/#{user}" | |
mode '0644' | |
action :create_if_missing | |
notifies :run, 'execute[remove-right]', :immediately | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_login_rights(user) | |
cookbook_file "ntrights.exe" do | |
source "ntrights.exe" | |
path "/windows/temp" | |
mode '0644' | |
action :create_if_missing | |
notifies :run, 'execute[remove-right]', :immediately | |
end | |
execute "remove-right" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it\cookbook-core>vagrant provision windows | |
windows: Loading Berkshelf datafile... | |
windows: Sharing cookbooks with VM | |
windows: Updating Vagrant's Berkshelf... | |
windows: Resolving cookbook dependencies... | |
windows: Fetching 'core' from source at . | |
windows: Using apt (2.6.1) | |
windows: Using chef-client (4.2.4) | |
windows: Using chocolatey (0.2.1) from https://github.com/chocolatey/chocolatey-cookbook.git (at master) | |
windows: Using chef_handler (1.1.6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'core::local_users_linux' do | |
let (:chef_run) { ChefSpec::SoloRunner.new.converge('core::local_users_linux') } | |
let(:databag){Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")} | |
before do | |
allow(databag).and_return({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = Elasticsearch::Client.new hosts: [{host: 'localhost:9200', port: 9200}] | |
value = client.search index: logstash_date, | |
body: { | |
"facets"=> { | |
"0"=> { | |
"date_histogram"=> { | |
"field"=> "@timestamp", | |
"interval"=> "15m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'localhost:9200/logstash-2015.04.30/_search?pretty' -d '{ | |
"facets": { | |
"3": { | |
"date_histogram": { | |
"field": "@timestamp", | |
"interval": "1m" | |
}, | |
"global": true, | |
"facet_filter": { | |
"fquery": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dashing service | |
# Add this file to /etc/init.d/ | |
# $ sudo cp dashboard /etc/init.d/ | |
# Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation | |
# $ sudo nano /etc/init.d/dashboard | |
# Make executable | |
# $ sudo chmod 755 /etc/init.d/dashboard | |
# Update rc.d | |
# $ sudo update-rc.d dashboard defaults |