Skip to content

Instantly share code, notes, and snippets.

@jessereynolds
Last active February 3, 2017 02:15
Show Gist options
  • Save jessereynolds/15203962ba78e5fb90279bf3ce71c0b7 to your computer and use it in GitHub Desktop.
Save jessereynolds/15203962ba78e5fb90279bf3ce71c0b7 to your computer and use it in GitHub Desktop.
puppetlabs/vsphere module not seeing specified datacenter

/etc/puppetlabs/puppet/vcenter.conf

vcenter: {
  host: "vcenter5.example"
  port: "443"
  user: "foo"
  password: "password"
  datacenter: "BAR"
}

Yields:

# puppet resource vsphere_vm
Error: Could not run: Puppet detected a problem with the information returned from vSphere when accessing vsphere_vm. The specific error was:
Unable to find datacenter named BAR as specified in VCENTER_DATACENTER

Also removing datacenter in the config yields:

Error: Could not run: Puppet detected a problem with the information returned from vSphere when accessing vsphere_vm. The specific error was:
Unable to find datacenter

debug output:

# puppet resource --debug vsphere_vm
Debug: Runtime environment: puppet_version=4.7.0, ruby_version=2.1.9, run_mode=user, default_encoding=UTF-8
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (ttl = 0 sec)
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (ttl = 0 sec)
Debug: #<Puppet::Error: Unable to find datacenter named foo as specified in VCENTER_DATACENTER>
Debug: /opt/puppetlabs/puppet/cache/lib/puppet_x/puppetlabs/vsphere.rb:39:in `datacenter_instance' /opt/puppetlabs/puppet/cache/lib/puppet/provider/vsphere_vm/rbvmomi.rb:27:in `block in instances' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `block in benchmark' /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:222:in `benchmark' /opt/puppetlabs/puppet/cache/lib/puppet/provider/vsphere_vm/rbvmomi.rb:26:in `instances' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1169:in `block in instances' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1162:in `collect' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1162:in `instances' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/resource/ral.rb:24:in `search' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:269:in `search' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:221:in `find_or_save_resources' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:136:in `main' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:352:in `run_command' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:540:in `exit_on_fail' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute' /usr/local/bin/puppet:5:in `<main>'
Error: Could not run: Puppet detected a problem with the information returned from vSphere when accessing vsphere_vm. The specific error was:
Unable to find datacenter named BAR as specified in VCENTER_DATACENTER

gems in use:

]# /opt/puppetlabs/puppet/bin/gem list --local

*** LOCAL GEMS ***

bigdecimal (1.2.4)
builder (3.2.3)
deep_merge (1.0.1)
facter (3.4.1)
hiera (3.2.1)
hocon (1.2.4, 0.9.3)
io-console (0.4.3)
json (2.0.3, 1.8.1)
mini_portile2 (2.1.0)
minitest (4.7.5)
net-ssh (2.9.2)
nokogiri (1.7.0.1)
psych (2.0.5)
puppet (4.7.0)
rake (10.1.0)
rbvmomi (1.9.4)
rdoc (4.1.0)
semantic_puppet (0.1.2)
stomp (1.3.3)
test-unit (2.1.9.0)
trollop (2.1.2)

Puppet is 4.7.0 via PE 2016.4.2 vSphere is 5.5 Update 2

There are around 20 datacenters visible to this user when logging in to the vsphere web console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment