Created
July 29, 2014 12:48
-
-
Save jpadams/a41f034435f6972fb1b0 to your computer and use it in GitHub Desktop.
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/bin/ruby | |
| require 'yaml' | |
| require 'base64' | |
| runlist = YAML.load_file(ARGV[0]) | |
| runlist.each do |manifest, node| | |
| text = File.read(manifest) | |
| encoded = Base64.strict_encode64(text) | |
| puts "applying #{manifest} on #{node}" | |
| command = "/bin/su - peadmin -c \'mco rpc stageit run manifest=\"#{encoded}\" -I #{node}\'" | |
| result = %x(#{command}) | |
| if /Return Value: 1/ =~ result | |
| print result | |
| exit | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment