Skip to content

Instantly share code, notes, and snippets.

node nonrootuser {
file { 'C:\Users\nonrootuser\Desktop\nonroot_Puppet_Agent_run_30m.xml':
ensure => file,
}
exec { 'myscript':
command => 'C:\Windows\System32\schtasks.exe /Create /XML C:\Users\nonrootuser\Desktop\nonroot_Puppet_Agent_run_30m.xml /RU WINDOWS\nonrootuser /RP Pupp3t! /tn nonroot_puppet_agent_run',
unless => 'C:\Windows\System32\schtasks.exe /Query /TN nonroot_puppet_agent_run',
class nonpriv_setup {
define nonpriv_pe_user (
$password,
$nonpriv_user=$name,
$ensure='present', # 'present' or 'absent'
$certname=$nonpriv_user,
$server='puppet', # puppet master
$enable_sched_task=true, # true or false
$run_interval_mins='30', # in minutes, one of 5, 10, 15, 30, 60
# /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/reports/http.rb
# http://devsops.blogspot.com/2013/04/3.html
def process
raw_urls = Puppet[:reporturl]
url_array = raw_urls.gsub!(/\s+/, "").split(',')
url_array.each do |url|
#url = URI.parse(Puppet[:reporturl])
body = self.to_yaml
headers = { "Content-Type" => "application/x-yaml" }
git push origin --delete dev
git branch -d dev
git branch -D dev
1) Put these files on the master and the staging server which has PE installed (2 files on 2 servers)
2) `service pe-mcollective restart` on the master and staging server
3) try it! mco rpc stageit run manifest="ZmlsZSB7ICcvdG1wL2Zvbyc6CiAgZW5zdXJlID0+IGRpcmVjdG9yeSwKfQoK" -I centos65a
# /opt/puppet/libexec/mcollective/mcollective/agent/stageit.rb on Linux
module MCollective
module Agent
class Stageit<RPC::Agent
activate_when do
cd REPONAME
git init
git add .
git commit -m 'initial commit' -a
git remote add origin git@YOUR_SERVER_HOSTNAME:REPONAME
git push origin master:refs/heads/master
puppet master --compile master --debug |less -R
---
test::ipaddress: "%{hiera('ipaddress')}"
#!/bin/bash
MANIFEST=$(cat)
echo class $1 {
echo "$MANIFEST" | sed 's/^/ /'
echo }
<enforce>
<a></a>
<b></b>
</enforce>
<simulate>
<a></a>
<b></b>
</simulate>
class mydb {
class { 'mysql::server':
root_password => 'Pupp3tlabs!',
override_options => {
'mysqld' => { 'datadir' => '/tmp/lib/mysql', 'log-error' => '/tmp/log/jeremysql.log' },
},
}
mysql::db { 'mydb':
user => 'myuser',