Digital Library

Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide (Alex Soto Bueno, Andrew Block)(Z-Library)

Alex Soto Bueno, Andrew Block

Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide (Alex Soto Bueno, Andrew Block)(Z-Library)

Author Alex Soto Bueno, Andrew Block

后端

With the Ansible automation tool, developers and system administrators in the enterprise can automate the provisioning, configuration, and management of distributed and on-premises systems. This study guide prepares you for the Red Hat Certified Engineer (RHCE) certification exam, 90% of which covers Ansible. Red Hat's Alex Soto Bueno and Andrew Block walk you through all the material covered in the exam. You'll begin with foundational concepts that build on one another and then dive into specific exam topics. The performance-based RHCE exam requires a deep knowledge of Ansible systems and tasks under time pressure. This comprehensive guide is the ideal way to prepare. Learn how Ansible can simplify your day-to-day operations Solve real-world Ansible problems in a hands-on command-line environment Install Ansible and set up managed environments Use ad hoc commands and include them in scripts as requested in the exam Prepare your Ansible configuration file and inventory file Set up and prepare nodes, including SSH key-based authentication Install required Ansible packages

Format PDF
Size 7.8 MB
14
Views
0
Downloads
0.00
Total Donations

Text Preview (First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
(This page has no text content)
Page 2
Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide In-Depth Guidance and Practice Alex Soto Bueno and Andrew Block
Page 3
Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide by Alex Soto Bueno and Andrew Block Copyright © 2025 Alex Soto Bueno and Andrew Block. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com. Acquisitions Editor: John Devins Development Editor: Jeff Bleiel Production Editor: Katherine Tozer Copyeditor: Sonia Saruba Proofreader: Andrea Schein Indexer: Ellen Troutman-Zaig Interior Designer: David Futato Cover Designer: José Marzan Jr. Illustrator: Kate Dullea June 2025: First Edition Revision History for the First Edition
Page 4
2025-05-27: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781098162139 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the authors and do not represent the publisher’s views. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. This work is part of a collaboration between O’Reilly and Red Hat Developer. See our statement of editorial independence. 978-1-098-16213-9 [LSI]
Page 5
Dedication [Ada i Alexandra] Amor verdadero nos une por siempre en el latido de mi corazon. —Alex To all the engineers out there. Automate the planet! —Andrew
Page 6
Preface The Red Hat Certified Engineer (RHCE) exam focuses on the use of Ansible as a tool for managing the entire IT landscape. Like all Red Hat exams, it is completely performance based, and as such, requires a deep understanding of Ansible concepts, under time constraints. This book is designed to introduce you to the key areas of Ansible and walk you through the topics covered in the exam using practical and reliable examples so that you are adequately prepared. Who Should Read This Book This book is written for users interested in learning how to manage their infrastructure and systems with Ansible. Since automation plays an increasingly important role in the operation of infrastructure and applications, this book is of interest to a range of personas: everyone from system administrators seeking their next certification, to junior engineers looking to master new technologies and concepts, to software architects looking to stay on top of technology trends. Users familiar with IT automation, the tools, and available common approaches will also see how Ansible is uniquely positioned to excel regardless of where it operates—on premises, in the cloud, or at the edge. Why We Wrote This Book Writing a book about Ansible was a natural step for us. We started our careers as developers, and as we grew professionally, we started getting experience in the whole lifecycle of an application, from development to production. Over the years, we’ve seen firsthand how Ansible simplifies the complexities of automating IT processes, from
Page 7
system configuration to application deployment. Our experience with Ansible has made it clear that it’s one of the most powerful, yet accessible, automation tools available. We’ve seen this in our day-to-day work and with all customers who adopt this technology to operate their applications. This inspired us to create a comprehensive guide that would help others leverage Ansible to its fullest potential. Moreover, we’ve seen in the field how valuable becoming an Ansible-certified engineer is and how this boosts engineer careers. For this reason, we decided to write this book so you can level up your knowledge and career in Ansible. Navigating This Book Here is an overview of what we cover in the book: Chapter 1 gives an overview of the topics covered in the exam and discusses the benefits of certification. Chapter 2 provides an introduction to Ansible, including basic concepts, and lays the groundwork for the rest of the book. Chapter 3 introduces Ansible Playbooks, and walks through how to run your first playbook. Chapter 4 focuses on how Ansible manages hosts and how to organize and target automation against them. Chapter 5 looks at flow control and examines how to influence the execution of automation activities. Chapter 6 looks at how to manipulate files in Ansible, including basic operations and templating. Chapter 7 is a deep dive into Ansible modules and how to develop a new module.
Page 8
Chapter 8 covers how to organize Ansible content using roles and collections, their purpose, and how they enable you to package and share Ansible content with others. Chapter 9 introduces Ansible Execution Environments as a method for running Ansible automation, the challenges they solve, and how they can be created. Chapter 10 covers how to effectively manage systems using Ansible, and looks at management-related activities, including filesystem management and security considerations. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values determined by context.
Page 9
NOTE This element signifies a general note. TIP This element signifies a tip or suggestion. WARNING This element signifies a warning. IMPORTANT This element signifies important information. Using Code Examples Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/lordofthejars/red-hat-certified-engineer- ansible-automation-study-guide-src. If you have a technical question or a problem using the code examples, please email support@oreilly.com. This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting
Page 10
example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but generally do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide by Alex Soto Bueno and Andrew Block (O’Reilly). Copyright 2025 Alex Soto Bueno and Andrew Block, 978-1-098-16213-9.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. O’Reilly Online Learning NOTE For more than 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, visit https://oreilly.com. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc.
Page 11
1005 Gravenstein Highway North Sebastopol, CA 95472 800-889-8969 (in the United States or Canada) 707-827-7019 (international or local) 707-829-0104 (fax) support@oreilly.com https://oreilly.com/about/contact.html We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/red-hat- certified. For news and information about our books and courses, visit https://oreilly.com. Find us on LinkedIn: https://linkedin.com/company/oreilly-media. Watch us on YouTube: https://youtube.com/oreillymedia. Acknowledgments We would like to say thank you very much to our O’Reilly editor Jeff Bleiel, acquisitions editor John Devins, and production editor Katie Tozer, for your trust and supporting us. Also thank you very much to the book’s technical reviewers: Jan-Piet Mens, Marek Vette, and Raju Gandhi, because you help us make this book look perfect. Alex Soto
Page 12
Bit by bit, you’ll end up finishing the book, but as in the movies, first the credits. I’d like to acknowledge Santa (yellow planes are better than yellow submarines), Uri (water at 2C works better, trust me), Guiri (2026 surt el Tour de Barcelona, yo aquí lo dejo), Gavina and Gabi (thanks for the support), and all my friends at the Red Hat developers team (we are the best). Thank you to Jonathan Vila, Abel Salgado, and Jordi Sola for the fantastic conversations about Java and Kubernetes. Last but certainly not least, I’d like to acknowledge Anita, “you fill up my senses…like a storm in the desert”; my parents Mili and Ramon for buying my first computer; my daughters Ada and Alexandra, “sou les ninetes dels meus ulls.” Andrew Block Collaboration and shared experiences are what make writing technical publications possible. I would like to thank my fellow colleagues at Red Hat for their knowledge, experience, and guidance with Ansible automation over the years. In particular, a huge shout out to Chad Ferman who helped develop and deliver Ansible-based enablement hackathons worldwide, which help others see the possibilities that can be achieved through automation. To the Red Hat Certification team members who provided guidance and helped shape what this publication would become. And finally, I would like to thank my mother, who inspired me to realize my true potential—no matter how long (and painful) the journey was.
Page 13
Chapter 1. Exam Details and Resources If you have this book in your hands (literally or figuratively), it indicates that you are planning to use (or already using) Ansible. This book is targeted at those who aspire to become a Red Hat Certified Engineer (RHCE), and in particular, those who are preparing for the Ansible EX294 (Red Hat Certified Engineer) exam. The ultimate goal is to learn about Ansible, how to use it, and how it can be used to automate your day-to-day tasks as a system administrator. Why Should You Be Certified? Ansible is one of the most used DevOps tools in enterprises to automate the provisioning, configuration, and management of distributed and on- premises systems. Gartner evaluated Red Hat’s DevOps solution (where Ansible is placed) in the new Magic Quadrant, recognizing it as a key tool for managing infrastructures. If you are an IT professional, system administrator, or DevOps engineer, you are interested in becoming certified for the following reasons: It shows that you deeply understand Ansible and can apply it effectively in real-world scenarios. Because of the wide usage of Ansible in the industry, certification increases your career opportunities and distinguishes you from other candidates. It accelerates your career progression because certified professionals are often considered for senior roles.
Page 14
It boosts your skills in Ansible, making you more performant. Ansible certification isn’t just a credential that you acquire. It’s an investment in your future. It will give you the skills to manage complex IT environments, help you stay ahead in the competitive job market, and position you as a trusted professional in automation and DevOps. EX294 Prerequisites Several prerequisites must be satisfied prior to beginning your certification journey: You must have earned the Red Hat Certified System Administrator (RHCSA) certification. You must have taken the Red Hat System Administration I (RH124), the Red Hat System Administration II (RH134), and the RHCSA Rapid Track Course (RH199). Or you must have comparable work experience as a system administrator on Red Hat Enterprise Linux. You must have taken Red Hat Enterprise: Linux Automation with Ansible (RH294) or have comparable work experience. Let’s start with the topics that will be covered in this book and the exam. Topics Covered in the Exam In this book, you will learn how to automate most common tasks you might find when administrating infrastructure using Ansible. Some of these tasks include: Understanding and use essential tools for handling files, directories, command-line environments, and documentation. Creating simple shell scripts.
Page 15
Operating running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services. Configuring local storage using partitions and logical volumes. Creating and configuring filesystems and filesystem attributes, such as permissions, encryption, access control lists, and network filesystems. Deploying, configuring, and maintaining systems, including software installation, update, and core services. Managing users and groups. Managing security, including basic firewall and SELinux configuration. Performing basic container management. Configuring remote access using the web console and SSH. Configuring network interfaces and settings. Managing software using DNF. While knowing these topics is important for exam certification, we are also introducing many of these concepts to make this book applicable for a wider audience. Information About Certifications For more information about the certification, suggested material, and additional resources related to Ansible, see Red Hat’s official documentation. The other certifications that you might take a look at are as follows: Red Hat Certified System Administrator
Page 16
Red Hat Certified System Administrator (RHCSA) certifies that you can perform the core system administration. Red Hat System Administration I (RH124) Red Hat System Administration I (RH124) is tailored for professionals with no prior experience in Linux system administration. It provides essential Linux administration skills by emphasizing fundamental tasks. Additionally, this course serves as a foundation for those aspiring to become full-time Linux system administrators, introducing critical command-line concepts and enterprise-grade tools. Red Hat System Administration II (RH134) Red Hat System Administration II (RH134) builds on foundational Linux administration skills, focusing on advanced topics such as storage configuration and management, security management with SELinux, automation of recurring tasks, boot process management and troubleshooting, basic system performance tuning, and enhancing productivity through command-line automation. Red Hat Certified System Administrator Rapid Track Course This course integrates the comprehensive content of Red Hat System Administration I (RH124) and Red Hat System Administration II (RH134), presenting the material in an accelerated format for an efficient review of key tasks. Red Hat Enterprise Linux Automation with Ansible (RH294) Red Hat Enterprise Linux Automation with Ansible (RH294) is crafted for Linux administrators and developers aiming to streamline and automate repetitive, error-prone tasks such as system provisioning, configuration, application deployment, and orchestration. Exam Details
Page 17
This certification exam is not a typical test exam with a question and possible answers to choose from, but a hands-on, practical exam to perform real-world tasks using Ansible. You will need to create Ansible Playbooks and use them to configure systems for specific roles and behaviors in an environment provided for you. The playbook will be executed, and finally, a process will verify that those systems and services work as specified in the exam. Please take your seat, and let’s dive in.
Page 18
Chapter 2. Introduction to Ansible Ansible is an automation tool for managing your infrastructure elements such as cloud, virtual or bare metal servers, network, and application configuration. Like other automation tools, Ansible uses a code-first approach to describe the state of your infrastructure, so you can expect the same result every time you run it. Ansible focuses on three important topics to make it the perfect tool for your IT operations: Ansible provides instructions to automate operations. Ansible provides configuration management. Ansible lets you automate the deployment of your applications into the infrastructure. This chapter is one of the most important in the book because you’ll get the ground knowledge to understand the rest of the book. You’ll learn how Ansible works, the basic concepts on which Ansible is built, its architecture, and why it is essential to use. You’ll also prepare your environment to run Ansible, and boot up some minimal virtual machines, which you’ll use to run examples. Finally, you’ll start executing your first Ansible commands to practice what you’ve learned in the chapter. Ansible Overview Before we discuss the more advanced capabilities of Ansible, it is important to understand what Ansible is, why it is used, and how it works. These concepts will be expanded upon in subsequent chapters.
Page 19
Why Ansible? In the past, you may have managed only a small number of servers, for example, two web servers, two database servers, and one proxy instance. Nowadays, things are more complex, with options such as cloud, virtual, and bare metal infrastructures. Applications are bigger and distributed, meaning that requirements for infrastructure are higher than ever before. This implies that there are now more servers to install, configure, and manage. Due to the increased complexity of infrastructure, managing these resources manually is simply not an option anymore. Changes applied manually can introduce errors with unintended consequences, invalidating the state of the entire environment. Automation is the key to maintaining this complexity under control. Moreover, Ansible lets you store your infrastructure as code, making it maintainable and reproducible every time. So, how does Ansible work to communicate with nodes and execute operations against them? Ansible Nodes Ansible, unlike other solutions, uses a push-out approach, meaning that instructions are transmitted from a central location to each of the managed instances (or hosts). One of the big advantages of this approach is that the remote (or managed) machines need no specialized software (or agent) to be installed; Ansible is considered to be an agentless technology. Also, this approach keeps nodes more performant, as no extra software is installed, and more secure because you are eliminating a vector attack from the node. Ansible also supports a pull approach, but this is not the default, so we won’t cover it. When you want to start using Ansible, you first set up a control node. This is usually a local machine where you will install Ansible and store all the instructions to push out to the managed nodes. The control node connects to each of the different managed nodes and applies all the instructions defined for each case, for example, installing system packages, copying some files from the control to the managed node,
Page 20
adding users, and so on. This communication occurs over the network, usually (but not always) over the SSH protocol, making all these interactions secure. IMPORTANT Linux/Unix hosts use SSH by default, while Windows hosts are configured with WinRM or OpenSSH. Figure 2-1 shows the communication between a control node and the managed nodes.
The above is a preview of the first 20 pages. Register to read the complete e-book.

Support Author

0.00
Total Amount (¥)
0
Donation Count
Please enter an amount Minimum ¥1

You will be redirected to Alipay to complete payment, then return here.

Recommended for You

Loading recommended books...
Failed to load, please try again later
Back to List