puppet-pssh 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +17 -1
  2. data/bin/puppet-pssh +3 -0
  3. data/lib/puppet-pssh.rb +4 -2
  4. metadata +1 -1
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # puppet-pssh
2
2
 
3
- Puppet parallel-ssh integration
3
+ Puppet parallel-ssh integration.
4
+
5
+ Needs parallel-ssh installed (apt-get install pssh on Ubuntu/Debian).
4
6
 
5
7
  # Install
6
8
 
@@ -8,8 +10,22 @@ Puppet parallel-ssh integration
8
10
 
9
11
  # Usage
10
12
 
13
+ The command has a built-in help:
14
+
11
15
  puppet-pssh --help
12
16
 
17
+ The run command:
18
+
19
+ puppet-pssh run --puppetmaster 192.168.1.1 \
20
+ --match 'openstack|swift|compute' \
21
+ --nameserver 10.0.0.1 \
22
+ --no-host-key-verify \
23
+ puppet agent -t
24
+
25
+ This will run the command 'puppet agent -t' on every node whose FQDN matches /openstack|swift|compute/ (regexp). It will try to resolve node names using DNS server 10.0.0.1 and use the IP address instead.
26
+ Also, SSH host key verification also is disabled.
27
+
28
+
13
29
  # Copyright
14
30
 
15
31
  Copyright (c) 2012 Sergio Rubio. See LICENSE.txt for
data/bin/puppet-pssh CHANGED
@@ -1,3 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.join(File.dirname(__FILE__), '/../lib/puppet-pssh.rb')
3
+
4
+ puts
5
+ puts "Puppet PSSH".bold + " v#{PuppetPSSH::VERSION}\n\n"
3
6
  PuppetPSSH::Driver.run
data/lib/puppet-pssh.rb CHANGED
@@ -7,7 +7,7 @@ require 'colored'
7
7
 
8
8
  module PuppetPSSH
9
9
 
10
- VERSION = "0.1"
10
+ VERSION = "0.1.1"
11
11
 
12
12
  if !defined? Log or Log.nil?
13
13
  Log = Logger.new($stdout)
@@ -84,6 +84,7 @@ module PuppetPSSH
84
84
  option ["-H", "--hostlist-path"], "HOSTLIST_PATH", "Save host list to path", :default => '/tmp/puppet-pssh-run-hostlist'
85
85
  option ["-o", "--node-output-path"], "NODE_OUTPUT_PATH", "Save host list to path", :default => '/tmp/'
86
86
  option "--[no-]host-key-verify", :flag, "Verify SSH host key", :default => true
87
+ option "--threads", "THREADS", "Use up to N threads", :default => 40
87
88
 
88
89
  def execute
89
90
  unless File.exist?(pssh_path)
@@ -133,12 +134,13 @@ module PuppetPSSH
133
134
  command = "sleep `echo $[ ( $RANDOM % 30 ) + 1 ]`;" + command_list.join(' ')
134
135
  Log.info "Node log output path: #{node_output_path}"
135
136
  Log.info "Running command '#{command}' with parallel-ssh..."
137
+ Log.info "Max threads: #{threads}"
136
138
  ssh_opts = ''
137
139
  unless host_key_verify?
138
140
  Log.warn 'Disabled host key verification'
139
141
  ssh_opts = '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
140
142
  end
141
- system "#{pssh_path} -p 40 -o #{node_output_path} -t 300 -h #{hostlist_path} -x '#{ssh_opts}' " + "'#{command} 2>&1'"
143
+ system "#{pssh_path} -p #{threads} -o #{node_output_path} -t 300 -h #{hostlist_path} -x '#{ssh_opts}' " + "'#{command} 2>&1'"
142
144
  end
143
145
  end
144
146
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-pssh
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: