Int333 MCQ 2
Int333 MCQ 2
Int333 MCQ 2
a) /etc/puppet/puppet.conf
b) /etc/hosts
c) /etc/ssh/sshd_config
d) /etc/httpd/conf/httpd.conf
Answer: a
Question: In advanced Puppet, what is the purpose of using "Hiera" for data separation?
Question: When using Puppet, which operation ensures that the desired state of a resource is
maintained?
a) Inspection
b) Execution
c) Compilation
d) Realization
Answer: b) Execution
Question: What command can you use to apply a Puppet manifest from the command line?
a) puppet validate
b) puppet apply
c) puppet run
d) puppet execute
Question: When using the puppet apply command, what does the -e flag allow you to do?
Puppet Manifests:
a) A Puppet function
b) A custom resource type
Puppet Configuration:
Question: In Puppet, which configuration file is commonly used to specify the Puppet Master's settings?
a) puppet.conf
b) hiera.yaml
c) site.pp
d) manifests.pp
Answer: a) puppet.conf
Question: Which Puppet resource type is typically used to manage package installations?
a) file
b) user
c) package
d) service
Answer: c) package
Puppet Module:
Question: What is the primary purpose of a Puppet module?
Question: In Puppet, which tool is commonly used for monitoring web servers?
a) Nagios
b) PuppetDB
c) Hiera
d) Puppet Bolt
Answer: a) Nagios
Question: How does a Puppet Agent communicate with the Puppet Master?
Extending Puppet:
Question: In Puppet, what are "custom types and providers" used for?
Puppet Classes:
d) A Puppet function
What is Nagios:
Why Nagios:
Nagios Architecture:
Question: In Nagios, what is the primary role of the Nagios Core component?
a) To generate reports
b) To provide a web-based interface
c) To perform actual monitoring and alerting
d) To manage configuration files
Introducing Plugins:
Benefits of Monitoring:
Main Features:
Installing Nagios: Installing Nagios using Package Managers: Installation with apt-get/dpkg:
Question: Which package management system is commonly used for installing Nagios on
Debian-based systems?
a) apt-get/dpkg
b) yum/rpm
c) pip
d) brew
Answer: a) apt-get/dpkg
yum/rpm:
Question: Which package management system is commonly used for installing Nagios on Red
Hat-based systems?
a) apt-get/dpkg
b) yum/rpm
c) pip
d) brew
Answer: b) yum/rpm
Installing Prerequisites:
Question: Before installing Nagios, what are some typical prerequisites that need to be
installed?
Question: In some cases, what might be required after downloading the Nagios source code?
a) Internet Explorer
b) Apache
c) Firefox
d) Chrome
Answer: b) Apache
Commands:
Objects:
a) Physical items
b) JavaScript files
c) Configuration elements such as hosts, services, and contacts
d) Software applications
Question: What is the primary configuration file in Nagios where you define host and service
definitions?
a) nagios.cfg
b) hosts.conf
c) nagios.conf
d) objects.cfg
Answer: d) objects.cfg
Question: Which programming language is commonly used to develop the Nagios web
interface?
a) JavaScript
b) Ruby
c) Python
d) PHP
Answer: d) PHP
Question: In the Nagios web interface, what does the "Downtime" feature allow you to do?
Managing Hosts:
Managing Services:
Question: Why might you schedule downtime for a host or service in Nagios?
a) To permanently disable it
b) To simulate a network outage
c) To perform maintenance without generating alerts
d) To speed up the monitoring process
Question: In Nagios, how do you schedule downtime for multiple hosts or services
simultaneously?
Managing Comments:
Question: In Nagios, what is the purpose of adding comments to hosts and services?
Question: How can you add a comment to a host or service in the Nagios web interface?
Nagios Information:
Question: Which command is commonly used to start, stop, or restart the Nagios service from
the command line?
a) start-nagios
b) nagios-restart
c) systemctl
d) run-nagios
Answer: c) systemctl
a) Network routing
b) System monitoring
c) Configuration management
d) Web development
Question: What is the primary method Ansible uses to communicate with target hosts?
a) SSH
b) HTTP
c) FTP
d) Telnet
Answer: a) SSH
a) Microsoft
b) Amazon Web Services (AWS)
c) Red Hat
d) Google
Architecture of Ansible:
Installing Ansible:
Question: Which of the following package managers is commonly used to install Ansible on
Linux systems?
a) brew
b) pip
c) yum/dnf
d) npm
Answer: c) yum/dnf
a) A list of playbooks
b) A file containing variables
c) A list of target hosts and their groupings
d) A file used for debugging
Question: How can you specify a group of target hosts in an Ansible inventory file?
Question: How does Ansible interact with virtual machines managed by Vagrant?
Question: What are Ansible roles used for, and how do they promote best practices in
playbooks?
a) Ansible roles are used for creating complex playbooks, and they simplify code management.
b) Ansible roles are used for defining variables, and they enhance code readability.
c) Ansible roles are used for organizing and reusing playbooks, and they encourage
modularization and code reuse.
d) Ansible roles are used for running playbooks with multiple inventories, and they optimize
inventory management.
Answer: c) Ansible roles are used for organizing and reusing playbooks, and they encourage
modularization and code reuse.
Question: What is idempotence in the context of Ansible playbooks, and why is it important?
a) Idempotence refers to playbooks that only run once and are not suitable for production
environments.
b) Idempotence means that a playbook's result is the same, whether it's run once or multiple
times, which is crucial for ensuring predictable and safe automation.
c) Idempotence is a deprecated feature in Ansible, no longer relevant in modern versions.
d) Idempotence refers to the speed at which playbooks execute, making them faster for large-
scale deployments.
Answer: b) Idempotence means that a playbook's result is the same, whether it's run once or
multiple times, which is crucial for ensuring predictable and safe automation.
Running Playbooks with ansible-playbook:
Question: How can you limit the execution of specific tasks within a playbook when using
ansible-playbook from the command line?
Answer: b) Use the --tags flag followed by the task tag name.
Real-world Playbook:
a) Playbooks are used only for initial system setup; they are not part of the deployment
pipeline.
b) Playbooks are used to automate the entire application deployment process, from configuring
servers to deploying application code.
c) Playbooks are used solely for monitoring and alerting in the deployment pipeline.
d) Playbooks are used to create backups but not for application deployment.
Answer: b) Playbooks are used to automate the entire application deployment process, from
configuring servers to deploying application code.
Handlers:
Question: How are Ansible handlers different from regular tasks in a playbook?
a) Handlers are executed immediately when triggered, while tasks are executed at the end of
the playbook run.
b) Handlers are tasks that respond to events and are only executed when notified, while regular
tasks are always executed.
c) Handlers can only be defined in roles, while regular tasks can be defined anywhere in a
playbook.
d) Handlers are used for debugging and testing, while regular tasks are used in production.
Answer: b) Handlers are tasks that respond to events and are only executed when notified,
while regular tasks are always executed.
Environment Variables:
Question: How can you set environment variables for an Ansible playbook to use during
execution?
Answer: c) Export them in the shell where you run the playbook.
Variables:
Question: What's the difference between Ansible's fact variables and user-defined variables?
a) Fact variables are predefined by Ansible and cannot be modified, while user-defined
variables are set by the playbook author.
b) Fact variables are defined in the playbook, while user-defined variables are collected from
target hosts during playbook execution.
c) Fact variables store facts about the Ansible control node, while user-defined variables store
facts about target hosts.
d) Fact variables and user-defined variables are the same; there's no distinction.
Answer: a) Fact variables are predefined by Ansible and cannot be modified, while user-defined
variables are set by the playbook author.
Facts:
Question: How can you gather facts about target hosts in Ansible?
a) Facts are automatically collected by Ansible during playbook execution; no specific action is
required.
b) Use the ansible-facts command to manually collect facts.
c) Facts can only be gathered from AWS instances, not other types of hosts.
d) Define facts in the playbook's vars section.
Answer: a) Facts are automatically collected by Ansible during playbook execution; no specific
action is required.
Prompts:
Tags:
Question: How can you use tags in Ansible playbooks, and why are they useful?
Answer: b) Tags are used to filter which tasks in a playbook are executed, allowing for selective
execution and better playbook control.
Blocks:
Question: What is an Ansible block, and how can it simplify playbook structure?
a) An Ansible block is a unit of code that can be executed multiple times in a playbook.
b) An Ansible block is a way to group tasks together and apply common error handling or rescue
actions to them.
c) An Ansible block is a deprecated feature and should not be used in modern playbooks.
d) An Ansible block is a complex data structure used to define variables.
Answer: b) An Ansible block is a way to group tasks together and apply common error handling
or rescue actions to them.
Answer: c) Ansible provides AWS-specific modules to manage AWS resources, including EC2
instances, S3 buckets, and more.
Question: How can Ansible roles enhance code maintainability and reusability in playbooks?
a) Roles allow you to define variables, but they cannot be reused in other playbooks.
b) Roles encapsulate reusable tasks, variables, and handlers, making playbooks more modular
and shareable.
c) Roles are used for specifying host groups, simplifying playbook structure.
d) Roles can only be applied to individual tasks, not entire playbooks.
Answer: b) Roles encapsulate reusable tasks, variables, and handlers, making playbooks more
modular and shareable.
Question: Explain the concept of playbook "roles" in Ansible and how they differ from
traditional playbooks.
a) Roles are used only for defining variables, while traditional playbooks contain tasks.
b) Roles are a way to organize tasks and variables within a playbook, improving playbook
readability.
c) Roles are synonymous with traditional playbooks, and there is no difference between them.
d) Roles are deprecated in Ansible, and traditional playbooks should be used instead.
Answer: b) Roles are a way to organize tasks and variables within a playbook, improving
playbook readability.
Question: What is the purpose of the --check flag in the ansible-playbook command, and how
does it affect playbook execution?
a) The --check flag performs a dry run of the playbook without making any changes to the
target hosts, allowing you to preview the changes.
b) The --check flag is used to check if the playbook is syntactically correct but does not execute
it.
c) The --check flag checks the health status of target hosts and reports any issues.
d) The --check flag skips tasks marked with the no_log parameter.
Answer: a) The --check flag performs a dry run of the playbook without making any changes to
the target hosts, allowing you to preview the changes.
Handlers:
Question: Explain the purpose of Ansible handlers and provide an example scenario where they
are useful.
a) Handlers are used to perform cleanup tasks after playbook execution, such as deleting
temporary files.
b) Handlers are used to execute tasks immediately when triggered by a specific event, like
restarting a service after a configuration change.
c) Handlers are used to run tasks on the Ansible control node to prepare for playbook
execution.
d) Handlers are used for debugging purposes only.
Answer: b) Handlers are used to execute tasks immediately when triggered by a specific event,
like restarting a service after a configuration change.
Environment Variables:
Question: In what situations might you use environment variables to influence playbook
behavior, and how can they be set?
a) Environment variables are used for defining variables within a playbook to improve code
readability.
b) Environment variables are primarily used for securing sensitive information in playbooks.
c) Environment variables can be used to configure dynamic inventory sources or provide
credentials and can be set in the shell environment where ansible-playbook is executed.
d) Environment variables are deprecated in Ansible.
Variables:
Question: How can you override variable values defined in an Ansible role from within a
playbook?
Answer: c) Define the same variable with a different value in the playbook, and it will take
precedence.
Facts:
Question: Explain the role of Ansible facts in playbooks, and provide an example of how they
can be used.
a) Facts are user-defined variables that are available to playbooks for customization.
b) Facts are used to store static data in playbooks.
c) Facts are automatically collected information about target hosts, such as network interfaces,
operating system, and available memory, and they can be used for conditional tasks or
template rendering.
d) Facts are deprecated in modern Ansible versions.
Answer: c) Facts are automatically collected information about target hosts, such as network
interfaces, operating system, and available memory, and they can be used for conditional tasks
or template rendering.