100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
RHCE Exam Revision Questions with Revised Answers $12.49   Add to cart

Exam (elaborations)

RHCE Exam Revision Questions with Revised Answers

 11 views  0 purchase
  • Course
  • RHCE
  • Institution
  • RHCE

RHCE Exam Revision Questions with Revised Answers How to make sure "copy" module does not override present files? - Answer-Module "copy" assumes "force: yes" parameter by default, which means that if the file exists, copy will overwrite it regardless of its contents. Parameter "force: no" will onl...

[Show more]

Preview 2 out of 14  pages

  • August 18, 2024
  • 14
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • RHCE
  • RHCE
avatar-seller
Scholarsstudyguide
RHCE Exam Revision Questions
with Revised Answers

How to make sure "copy" module does not override present files? - Answer-Module
"copy" assumes "force: yes" parameter by default, which means that if the file exists,
copy will overwrite it regardless of its contents. Parameter "force: no" will only copy the
file from source to destination if no file of that name exists in the destination.

What is the "stat" module for? - Answer-Returns a hash dictionary of values containing
the file status data, which allows you to refer to individual pieces of information using
separate variables.

What is Jinja2? - Answer-Ansible uses the Jinja2 templating system for template files.
Ansible also uses Jinja2 syntax to reference variables in playbooks.

Jinja2 usage and syntax - Answer-Jinja2 templates can be used with "template" module
to deploy files tailored to the managed host based on the template.

Syntax:
{# COMMENT #}
{{ VARIABLE }}
{% EXPRESSION %} - e.g:
1. for loops: {% for i in list %} {{ variable }} {% endfor %}
2. if statements: {% if condition %} {{ variable }} {% endif %}

Basic host pattern rules in Ansible - Answer-Wildcard "*" can be used to match hosts by
pattern. Any pattern using wildcard will be allowed for hostnames that are included in
the inventory file. Character "!" before a hostname or group excludes this group. We can
create complex patterns, e.g.: '!group1, group*'.

Including and Importing files - how to and what is the difference - Answer-Ansible allows
for combining multiple playbooks into a main playbook modularly, or inserting lists of
tasks from a file into a play. There are two operations that Ansible can use to bring
content into a playbook. You can include content, or you can import content.

Include - dynamic operation, ansible processes it during the run of the playbook, as
content is reached

Import - static operation, ansible preprocesses imported content when the playbook is
initially parsed, before the run starts

, Import is done by the "import_playbook" directive, that allows to import external files
containing lists of plays into a playbook. In other words, we can have a master playbook
that imports one or more additional playbooks. Because the content being imported is a
complete playbook, the "import_playbook" feature can only be used at the top level of a
playbook and cannot be used inside a play. If you import multiple playbooks, then they
will be imported and run in order. It is treated as the completely separate play or set of
plays. It can't run as a task within the play.

How to import just tasks to the play? - Answer-To be able to include or import just tasks
to the particular play, a flat task file needs to be prepared with just a list of tasks.

Clause "import_tasks" can be used to include a list of tasks from the file to the play.
Clause "include_tasks" works in the same fashion, only that it adds those tasks
dynamically.

Imported tasks are always present in the playbook (see the --list-tasks command
param), included ones are not shown as they are dynamically determined. Because of
that e.g. you cannot use "ansible-playbook --start-at-task" to start playbook execution
from a task that is in an included task file. You cannot use a notify statement to trigger a
handler name that is in an included task file. You can trigger a handler in the main
playbook that includes an entire task file, in which case all tasks in the included file will
run.

We can pass variables to included/imported tasks by passing "vars" dictionary.

Ansible Roles - Answer-Provide a way to make it easier to reuse Ansible code
generically. You can package, in a standardized directory structure, all the tasks,
variables, files, templates, and other resources needed to provision infrastructure or
deploy applications. Copy that role from project to project simply by copying the
directory. You can then simply call that role from a play to execute it.

It has a standard directory structure. Not every directory is necessary.

Use "ansible-galaxy role init <role_name>" command to generate a template for
creating a role.

We use roles by passing them to the play in "roles" list at the top level. Those will run
first before any tasks.

The default roles_path on Red Hat Enterprise Linux includes /usr/share/ansible/roles in
the path.

Order of execution with Ansible Roles - Answer-1. When a role is added to a play, role
tasks are added to the beginning of the tasks list. If a second role is included in a play,
its tasks list is added after the first role

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Scholarsstudyguide. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

77333 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.49
  • (0)
  Add to cart