Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Created September 3, 2012 18:55
Puppet faces experiment - from within ruby
require 'puppet'
require 'puppet/face'
# List available faces
Puppet::Face.faces
# >>> => [:status, :plugin, :man, :help, :resource, :catalog, :node, :file, :config, :certificate_revocation_list, :resource_type, :parser, :module, :instrumentation_data, :facts, :certificate, :key, :certificate_request, :report, :instrumentation_probe, :ca, :secret_agent, :instrumentation_listener]
# List possible actions
Puppet::Face[:module,:current].actions
# >>> [:build, :changes, :generate, :install, :list, :search, :uninstall, :upgrade]
# Invoke an installation
Puppet::Face[:model,:current].install('yum', { :target_dir => 'lalal', :ignore_dependencies => true})
# Get the available options for a face action
Puppet::Face[:module,:current].get_action(:install).options
=> [:force, :target_dir, :ignore_dependencies, :modulepath, :version, :environment]
# Get more info about an option
Puppet::Face[:module,:current].get_action(:install).get_option(:force).description
=> "Force overwrite of existing module, if any.\n"
Puppet::Face[:module,:current].get_action(:install).get_option(:force).required?
=> false
Puppet::Face[:module,:current].get_action(:install).get_option(:modulepath).takes_argument?
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment