Skip to content

Instantly share code, notes, and snippets.

View johnduarte's full-sized avatar

John Duarte johnduarte

View GitHub Profile
file { 'C:/Users/Administrator/jdk-8u45-windows-x64.exe':
mode => '0777',
}
->
package {'java':
ensure => installed,
source => 'C:/Users/Administrator/jdk-8u45-windows-x64.exe',
install_options => ['INSTALLDIR=C:\java8', 'STATIC=1', '/s'],
}
registry_value { 'HKLM\System\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME':
@johnduarte
johnduarte / gist:42f6f9bc0fcf17fcbe09
Created May 26, 2015 22:41
exec test for Shaigy
test_name "Test exec subscribed to file" do
manifest =<<EOS
$thing = "hi there"
...
...
exec {'cp /root/mytestfile.rb /root/newtestfile.rb'}
EOS
step "Create manifest" do
apply_manifest_on(master, manifest)
master.file_exists? "/root/mytestfile.rb"
@johnduarte
johnduarte / gist:aa7ad8d8f45e382c0bcb
Created May 28, 2015 18:30
Mount failure when loop kernel module is not loaded
root@kchejzi5z568vxr:~# cat manifest.pp
mount { '/pl21474':
ensure => 'mounted',
device => '/tmp/pl21474',
dump => '0',
fstype => 'ext3',
options => 'loop',
pass => '0',
target => '/etc/fstab',
}
@johnduarte
johnduarte / gist:acbd702cfff0e8306391
Last active October 9, 2015 23:46
Create OS X user
MYNAME=john
dscl . create /Users/$MYNAME
dscl . create /Users/$MYNAME UserShell /bin/bash
dscl . create /Users/$MYNAME UniqueID 600
dscl . create /Users/$MYNAME PrimaryGroupID 20
dscl . create /Users/$MYNAME NFSHomeDirectory /Users/$MYNAME
dscl . passwd /Users/$MYNAME secret
dscl . append /Groups/admin GroupMembership $MYNAME
mkdir /Users/$MYNAME
chown $MYNAME:staff /Users/$MYNAME
...
pe-aix-61-acceptance executed in 2.95 seconds
pe-aix-61-acceptance: package repo configuration not modified
setting local environment on pe-aix-61-acceptance
pe-aix-61-acceptance 14:01:10$ mkdir -p ~/.ssh
pe-aix-61-acceptance executed in 0.20 seconds
pe-aix-61-acceptance 14:01:10$ chmod 0600 ~/.ssh
forge "http://forge.puppetlabs.com"
# Forge modules
mod "puppetlabs-stdlib"
mod "puppetlabs-git"
mod "puppetlabs-apt"
mod "puppetlabs-vcsrepo"
mod "nanliu-staging"
mod "gildas-homebrew"
mod "saz-vim"
include 'vim'
package { 'lsb-release': ensure => present, }
apt::source { 'debian_jessie':
location => 'http://debian.osuosl.org/debian/',
release => 'jessie',
repos => 'main contrib non-free',
include => {
'src' => true,
'deb' => true,
},
# cat /tmp/puppetdb_manifest.pp.T6vbjj
class { 'puppetdb::server':
database => 'postgres',
puppetdb_version => '71646c6d05547147faf87a3382c6fac75a07f0cd-1.el7',
}
# get the pg server up and running
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.3',
@johnduarte
johnduarte / gist:da7efd7ac303cb5c5136cdb7c1063f68
Created September 1, 2016 03:28
Patching and running puppet tests with puppetstein
# get puppetstein
# the commands below assume that you are running
# puppetstein from its repo directory and
# using bundler to manage it rather than
# installing it for your default environment
git clone https://github.com/whopper/puppetstein.git
cd puppetstein
bundle install
bundle exec gem install bundler
# Assumptions:
# * Following commands are run as a non-root user on a POSIX OS
# * Puppet-agent is installed and has been invoked at least once by the
# user in order to create the local puppetlabs directory path.
# This can be done with `puppet module install motd`
# * Git is installed
# * Ruby is installed
# * Bundler is installed
git clone https://github.com/johnduarte/puppet-beaker_101.git ~/.puppetlabs/etc/code/modules/beaker_101