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
| module MCollective | |
| module Agent | |
| class Windowsrun<RPC::Agent | |
| action "run" do | |
| command = "dir" | |
| reply[:status] = run(command, :stdout => :out, :stderr => :err, :chomp => true) | |
| end | |
| def run(command, options) | |
| if MCollective::Util.windows? |
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
| # These two work fine with puppet apply non-root | |
| #class foo ($message=hiera(message)) { | |
| #class foo ($message='default') { | |
| # Hiera Data bindings doesn't work with puppet apply root or non-root | |
| class foo ($message) { | |
| #class foo { | |
| #$message = hiera(message) | |
| #notify { "A message from foo via hiera databindings or class param default: $message": } |
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
| class acts { | |
| runyer::posix_command { 'ls': | |
| command => 'ls -al', | |
| } | |
| runyer::posix_command { 'du': | |
| command => 'du -k', | |
| } |
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
| module Puppet::Parser::Functions | |
| newfunction(:tr_filename, :type => :rvalue) do |args| | |
| name = args[0] | |
| name.downcase.tr(" ", "_") | |
| end | |
| 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
| Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template runyer/posix_rb.erb: | |
| Filepath: /modules/runyer/templates/posix_rb.erb | |
| Line: 3 | |
| Detail: undefined method `capitalize' for nil:NilClass | |
| at /modules/runyer/manifests/posix_command.pp:10 on node master | |
| Warning: Not using cache on failed catalog | |
| Error: Could not retrieve catalog; skipping run | |
| dynamic scoping biting me when I moved from class param $action_name = $title to putting it in body of class. | |
| @action_name in template was no longer in scope. |
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
| import os | |
| import random | |
| import treelib | |
| from treelib import Node, Tree | |
| SPACER = '_' | |
| def init_board(): | |
| board = [[SPACER for x in xrange(3)] for x in xrange(3)] | |
| return board |
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
| 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', |
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
| 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 |
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
| # /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" } |
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
| git push origin --delete dev | |
| git branch -d dev | |
| git branch -D dev |