Download Puppet Manifests and Modules and more Exams Social Sciences in PDF only on Docsity!
PUPPET EXAM QUESTIONS AND ANSWERS
puppet-enterprise-installer -s ./install-answers.txt Given the following command, which two parameters should be substituted to have the installer consume the answers in the install-answers file? (Choose two.) puppet-enterprise-installer ./install-answers.txt * - Answers --A or -a Which of the following are acceptable module names? Choose the 2 correct answers:
- main_module
- module
- 14module
- main - Answers -* module_
- main_module You've noticed an increase in the number of background tasks left inside the Puppet Enterprise console. This caused because a background task might have died and left invalid PID files. How might you resolve this issue? - Answers -service pe-puppet- dashboard-workers restart Given the following code, what key should be added to the YAML data source in order for automatic parameter lookup to apply to this class?: class ntp ($ntp = "default") { } - Answers -ntp::ntp: server.com classname::variablename::value The Puppet master event inspector is reporting a "change" event on the httpd package resource type in your Puppet module. What most likely has occurred with the resource type? (Choose 4 correct answers)
- The httpd package was not installed and the Puppet configuration installed the httpd package
- The httpd configuration was incorrect and the Puppet configuration updated the correct configuration
- A requirement for this resource was not met. Thus Puppet does not compare its current state to the desired state
- The httpd package was not installed but Puppet was not instructed to install the package - Answers -- The httpd package was not installed and the Puppet configuration installed the httpd package.
- The httpd configuration was incorrect and the Puppet configuration updated the correct configuration.
- The httpd package was not installed but Puppet was not instructed to install the package, a requirement for this resource was not met. A change event occurs when a property is out-of-sync and Puppet made a change to enforce the desired configuration and put the property in the desired state. When does a failure event occur in the event inspector?
- If a property is out of sync, when Puppet attempt to make changes, the changes failed.
- If a property is out of sync but a metaparameter is used to call the property and force changes
- A requirement for this resource was not met. Thus Puppet does not compare its current state to the desired state. This will occur when the schedule metaparemter is set and the time interval does not meet the requirements or it is a general failure of the resource type being enforced
- If a property is in sync and the Puppet master attempts to make a change anyway - Answers -If a property is out of sync, when Puppet attempts to make changes, the changes failed What are two ways to access the value of the ipaddress fact inside a manifest? - Answers -$ipaddress, $::ipaddress When using Facter, which parameter will load additional facts distributed by Puppet? - Answers -facter -p The event inspector, which is how Puppet manages configurations and what is happening when events occur, provides insights into our environment from what perspective? - Answers -Classes, nodes, and resources Which of the following is an acceptable class names? Choose the correct answer:
- Main
- var_test
- Ntp
- Settings - Answers -var_test Main is a reserved word in Puppet; class names cannot begin with capital letters Given the following code, what will the variable $0 output for a host with a hostname of "www01"?: $hostname = "webhead01" node "www01" { $hostname = "webserver01" include welcome }
It is 12:05 am. Given the following resource type definition what would you expect to happen during the 12:05 Puppet agent run?: schedule { 'maint': range => "2 - 4", period => daily, repeat => 1, } exec { 'yum update -y': schedule => 'maint', } - Answers -The yum update -y would not be executed on the system host { 'sles11a': name => 'sles11a.puppetlabs.com', ip => '10.20.1.77', host_aliases => ['zypper'], } host { 'centos64c': ip => '10.20.1.74', } host { 'server2008r2b': ip => '10.20.1.80', comment => 'windows', }
File: Original /etc/hosts
127.0.0.1 localhost 10.20.1.62 sles11a zypper # primary mirror 10.20.1.74 centos64c # decomissioned 10.20.1.80 server2008r2b 10.20.1.77 sles11a.puppetlabs.com After using Puppet to apply the manifest shown above, which two entries in the /etc/hosts file will remain unchanged? - Answers -10.20.1.62 sles11a zypper # primary mirror 10.20.1.74 centos64c The Puppet installation process fails due to a configuration error. How might you recover from the failed install? - Answers -Fix the configuration error and execute the script ./puppet-enterprise-uninstaller
Which setting should be present in a Puppet agent's puppet.conf [agent] section to enable submission of agent report logs to a Puppet master? - Answers -report = true You want to trigger the restart of a service after a configuration file is changed during a Puppet enforcement run. Which resource metaparameter should you use? - Answers - notify The node running Puppet agent has a fact osfamily with the value of Redhat: node /^webserver\d{1}.mylabserver.com$/ { $osfamily = "debian" include ntp include apache } node "webserver01.mylabserver.com" { $osfamily = "centos" include mysql include common } class mysql { $osfamily = "debian" notify { "the os family is ${osfamily}": } } Given the above code, what variable value will be displayed in the notify resource if the node's certificate name is webserver01.mylabserver.com? - Answers -$osfamily = "debian" You want to use live management to trigger a Puppet agent run only on nodes running Red Hat Enterprise Linux and its derivatives. How do you proceed? - Answers -Use the advanced filter to filter by facts for osfamily, with a value of RedHat, and trigger a run using the Control Puppet section of live management. You are managing a system with a modulepath of /etc/puppetlabs/puppet/modules. In which file will the autoloader look for the class definition for the ssh::server::keys class?
- Answers -/etc/puppetlabs/puppet/modules/ssh/manifests/server/keys.pp True or False: Resource titles in Puppet classes are case sensitive. - Answers -True Which attributes belong to the exec resource type makes it idempotent? - Answers - creates, onlyif, refreshonly, refresh, unless
Given the above code, what variable value will be displayed in the notify resource if the node's certificate name is webserver01.mylabserver.com? - Answers -$familyvar = "redhat" Because we are accessing the variable by top scope, that is why the value is redhat (::variablename) True or False: If a node matches multiple node definitions due to regular expressions, Puppet will use ONE of them with no guarantee as to which one it will use. - Answers -True Which of the following puppet module commands will create a boiler plate template for new modules? - Answers -puppet module generate Which of the following are type of events found in the event inspector? Choose the 2 correct answers:
- No-op: property was out of sync but Puppet was instructed not to make changes to the property
- Change-failed: a property was out of sync, when Puppet attempt to make changes, the changes failed.
- Change-success: A change event occurs when a property is out of sync and Puppet made a change to enforce the desired configuration and put the property in the desired state
- Skipped: a requirement for this resource was not met. Thus Puppet does not compare its current state to the desired state. This will occur when the schedule metaparameter is set and the time interval does not meet the requirements or it is a general failure of the resource type being enforced - Answers -* Skipped: a requirement for this resource was not met. Thus Puppet does not compare its current state to the desired state.
- No-op: a property was out of sync but Puppet was instructed not to make changes to the propery Skipped, Change, No-op, and Failure are the change event types found in the event inspector. If there is a file resource type with the same resource title/name declared twice, what will puppet parser output when run, given the following code?: file { 'demo': ensure => file, path => '/home/user/test', } file { 'demo': ensure => file,
path => '/home/user/tests', } - Answers -Puppet parser will not error because this is not a syntax error. However, during compilation an error will be thrown for duplicate resource declaration Which two actions does a puppet agent command complete? - Answers -- Send a report to the Puppet master
- Ensure presence of agent's private key Given the following Puppet code what value would you expect $server to have when executed in the notify resource?: node "webserver.mylabserver.com" { $server = "10.0.0.1" class { 'ntp' : } } class ntp ($server) { notify ("The value of the server variable is ${server}":) } - Answers -Compile error due to defining a parameter and it not having a default value True or False: The resource type exec has the ability to listen for relationship notifications such as subscribe and notify. - Answers -True When deactivating an enterprise Puppet agent, the command [~$] puppet node deactivate does what?
- Removes the puppet agents certificates from the puppet master
- Removes puppet agent from the node
- Removes a node from the Puppet master and frees up a license
- Removes the node from PuppetDB and frees up a license - Answers -Removes the node from PuppetDB and frees up a license Which of the following classes will be executed on the node "webserver01.mylabserver.com" based on the below code?: node /^webservers\d{1}.mylabserver.com$/ { include ntp include apache } node "webserver01.mylabserver" { include mysql include common }
Given the following resource type definition, what is suppose to occur during Puppet enforcement?: file { '/etc/motd': path => '/etc/motd.txt', source => 'puppet:///modules/motd/motd', } - Answers -The /etc/motd.txt file will be replaced with the motd file located in the modules/motd/files/ directory by the file named motd In your data center, servers have either 16 GB or 64 GB of memory. You are writing a Puppet module to manage a system service and you want to use different command- line arguments depending on how much memory the machine has. Which three Puppet syntax constructs would you use to allow the behavior of your service resource to change? - Answers -- if statement
- selector
- case statement Which statement is true about classes? Choose the correct answer:
- Classes are singleton and will only ever be declared once
- Classes can be declared multiple times
- Classes are singleton and will only ever be declared once, unless the class is parameterized
- Classes are singleton but can be declared multiple times if required - Answers - Classes are singleton and will only ever be declared once exec { "echo tests >> /etc/motd": path => "/bin", } The above Puppet code is not idempotent. True or False: It is possible using exec attributes to make it idempotent. - Answers -True The additional resource type attributes that make the exec resource idempotent are: refreshonly, unless, onlyif, creates Which class will be executed on the node with the certname "webserver.mylabserver.com", given the below code?: node "webserver.mylabserver.com" { include apache } node "webserver.mylabserver" {
include nginx } node "webserver" { include varnish } default { include base } - Answers -apache Why is Puppet idempotent? Choose the correct answer:
- Puppet has a --noop option preventing unwanted changes
- It will update all resources on every Puppet run
- It only uses REST APIs for communication
- The Puppet catalog can safely be applied multiple times - Answers -The Puppet catalog can safely be applied multiple times $title = "my title" node /^webserver\d{1}.mylabserver.com$/ { $title = "new title" include ntp include apache } node "webserver01.mylabserver.com" { $title = "the title" include mysql include common } class mysql { $title = "mysql title" package { 'mysql-server': } } Given the above code, if $title is used within a class, what would the value of the variable be if the nodes certificate name is webserver01.mylabserver.com? - Answers - $title = "mysql title" By default the parameter for pruning old data is set to 30 days. To change this what parameter name would you change? - Answers -prune_upto True or False:
Must begin with a lowercase letter Can start with numbers Can be named main Can include numbers and underscores but not start with them - Answers -* Must begin with a lowercase letter
- Can include numbers and underscores but not start with them What is the expected result of this code? package { 'ntp': ensure => 'present', } service { 'ntpd': ensure => running, enable => true, require => package['ntp'], } - Answers -Error because the require metaparameter has incorrect syntax. When referencing a resource managed by Puppet, you must always use capital reference to the title. (Package['ntp']) If webserver01 is classified both inside a node group on the console and within site.pp, given the following configurations, what would you expect the output to be for a Puppet agent run? : #Node group console configuration $variable = "hello world" #site.pp standard node definition $variable = "Linux Academy" node "webserver01.mylabserver.com" { } - Answers -Compiling error due to reassigning variables at the same scope level True or False: Any Puppet setting that's valid in the configuration file is also a valid long argument. i.e puppet agent --server puppetmaster.mylabserver.com - Answers -True Given the following Puppet code, what would you expect to happen? exec { "echo tests1 >> /etc/motd": path => "/bin:/usr/bin", onlyif => "test -f /etc/motd`",
} - Answers -onlyif makes exec idempotent and the exec command will only be executed if the /etc/motd file does exist Which metaparameter, when applied to a Puppet resource type, would cause the resource type to be ignored? - Answers ---noop Given the following resource definition what would be the expected result when the Puppet agent is run? exec { "echo tests >> /etc/motd": path => "/bin", } - Answers -Each time the agent is run, "tests" would be appended to the motd In what class is the prune_upto parameter located for setting the pruning database cronjob? - Answers -pe_console_prune In order to connect the Puppet master to an external node classifier which two settings are required in the [main] section of puppet.conf?
- node_terminus
- node_enc
- enc_enabled
- external_nodes - Answers -* node_terminus
- external_nodes True or False: If site.pp contains at least one node definition, it must have one for every node; compilation for a node will fail if one cannot be found. - Answers -True If you define a node, you must define the other nodes Given the following information, what classes would you expect to be declared on the node?: certname "webserver1.mylabserver.com" node /^webserver\d{1}.mylabserver.com$/ { include roles::webserver } node /^webserver\d{1}.mylabserver$/ { include roles::apache } node "webserver1.mylabserver" { include roles::apache }
Given the following resource definition what would be the expected result when the Puppet agent is run? exec { "echo tests1 >> /etc/motd": path => "/bin:/usr/bin", onlyif => "test -f /etc/motd", } Choose the correct answer:
- onlyif is not an attribute of exec
- Will append tests1 to the /etc/motd file
- Will append tests1 to the /etc/motd file only if tests1 does not already exist
- onlyif makes exec idempotent and the exec command will only be executed if the /etc/motd file does exist - Answers -tests1 will be appended to /etc/motd file only if the /etc/motd file exists, making the exec resource idempotent Where are functions executed? Hint: think about the catalog compiling process. - Answers -On the Puppet master During the Puppet Enterprise installation process, you are instructed to open the GUI install page. However, the page is non-responsive and does not load. What might you need to do in order to access the GUI installation guide? - Answers -Ensure that port 3000 and 443 is open and accessible on the Puppet master The PostgreSQL database is becoming large and causing the console to act slow. What might be a cause of this? (Select the best possible answer.)
- The autovacuumPostgreSQL setting has been changed from off to on
- The pe-puppet-dashboard-workers servce needs to be restarted
- The ake db:raw:optimize[mode] has not been run recently -The autovacuum PostgreSQL setting has been changed from on to off - Answers -The autovacuum PostgreSQL setting has been changed from on to off You want to publish a module to the Puppet Forge. Which file is required? - Answers - Metadata.json and modulefile You have noticed in your Puppet Enterprise console that there are several pending background tasks growing incrementally. You discover that there are several processes with stale PIDs due to a background task that recently died. You have removed the stale PIDs and there has not been any change within the console. What is a valid command to restart the service responsible for the background tasks? - Answers -service pe-puppet-dashboard-workers restart host { 'sles11a': name => 'sles11a.puppetlabs.com',
ip => '10.20.1.77', host_aliases => ['zypper'], } host { 'centos64c': ip => '10.20.1.75', } host { 'server2008r2b': ip => '10.20.1.80', comment => 'windows', }
File: Original /etc/hosts
127.0.0.1 localhost 10.20.1.62 sles11a zypper # primary mirror 10.20.1.74 centos64c # decomissioned 10.20.1.80 server2008r2b 10.20.1.77 sles11a.puppetlabs.com What is the expected value of the resource with name of centos64c? - Answers - 10.20.1.75 centos64c #decomissioned You have a Puppet node with the node name of "node1.mylabserver.com". This node has been destroyed and rebuilt and puppet agent has been run again for the first time. However, the following error is prompted during the first puppet agent run. "Error: Could not request certificate: The certificate retrieved from the master does not match the agent's private key." What might be the issue, and how would you solve it?
- Run puppet cert revoke node1.mylabserver.com and then run puppet agent again
- Run puppet cert clean node1.mylabserver.com and then run puppet agent again
- Run puppet cert sign node1.mylabserver.com and then run puppet agent again
- Run puppet cert revoke-clean node1.mylabserver.com and then run puppet agent again - Answers -Run "puppet cert clean node1.mylabserver.com" and then run puppet again True or False: Variables assigned to a node group within the console are considered top scope variables. - Answers -True True or False: The exec resource type by default is idempotent. - Answers -False Which statement is correct about Puppet Enterprise event inspector?
$variable = "Linux Academy" node "webserver01.mylabserver.com" { } - Answers -compiling error due to reassigning variables at the same scope level From where does a Puppet agent run start? - Answers -The node being managed class var_test { $osfamily = "test" notify { 'test': message => $osfamily, } notify { 'test': message => $::osfamily, } } Given the following code, what type of error will result when puppet parser validate is run? - Answers -Puppet parser will not report any errors the class name is acceptable. An error will occur when the catalog is compiled due to two resource titles having the same name. HOWEVER, puppet parser will not catch those errors because puppet parser validates for syntax only. True or False: Best practice is to always include a default match when using conditional expressions - Answers -True What happens if a class has not been declared using the include or class options, but the class is inherited by another class? i.e.: class ntp inherits ntp::params { } - Answers -If the class is not declared, it will then be declared $title = "my title" node /^webserver\d{1}.mylabserver.com$/ { $title = "new title" include ntp include apache } node "webserver01.mylabserver.com" { $title = "the title" include mysql include common }
class mysql { $title = "mysql title" notify { "The variable name is ${::title}": } } Given the above code, what variable value will be displayed in the notify resource if the node's certificate name is webserver01.mylabserver.com? - Answers -"my title" Because we used ${::title}, that means we are accessing top scope. What are three parameters that can be passed to the puppet module install command?
- Answers ---modulepath, --version, --force Which of the following commands will show what files that belong to a Puppet Forge module have been modified since the module's installation? - Answers -puppet module changes True or False: The event inspector will fetch the data once while loading and use the same data until it is closed or the data is reloaded. - Answers -True Which puppet module command will pepare a local module for release on the Puppet Forge by building a ready-to-upload archive file? - Answers -puppet module build Which of the following commands will display all installed modules from the Puppet Forge? - Answers -puppet module list Reports available form within the console, provide which of the following information? Choose the 3 correct answers:
- Total number of resources managed
- Total number of resources changed for each run
- Total number of resource relationships from the puppet agent run
- Runtime for the puppet agent run - Answers -- Total number of resources managed
- Total number of resources changed for each run
- Runtime for the puppet agent run What configuration file is used to configure Puppet report processors, such as sending reports to Twitter? - Answers -puppet.conf In which module sub-directory would you place custom facts to have them synchronized using plugin sync? - Answers -lib/facter True or False: Classes must first be added to the enterprise console before they can be assigned to a node. - Answers -True