Skip to Content
Ansible: Up and Running, 3ª Edición
book

Ansible: Up and Running, 3ª Edición

by Bas Meijer, Lorin Hochstein, René Moser
September 2024
Intermediate to advanced
472 pages
11h 16m
Spanish
O'Reilly Media, Inc.
Content preview from Ansible: Up and Running, 3ª Edición

Capítulo 9. Roles: Ampliando tus Guías de Juego

Este trabajo se ha traducido utilizando IA. Agradecemos tus opiniones y comentarios: translation-feedback@oreilly.com

En Ansible, el rol es el mecanismo principal para dividir un libro de jugadas en varios archivos. Esto simplifica la escritura de libros de jugadas complejos y facilita su reutilización. Piensa en un rol como algo que asignas a uno o más hosts. Por ejemplo, asignarías un rol de base de datos a los hosts que funcionarán como servidores de bases de datos. Una de las cosas que me gustan de Ansible es su escalabilidad, tanto ascendente como descendente. Ansible escala bien hacia abajo porque las tareas sencillas son fáciles de implementar. Se escala bien hacia arriba porque proporciona mecanismos para descomponer tareas complejas en piezas más pequeñas. Un rol está muy estructurado y no contiene datos específicos del sitio, por lo que puede compartirse con otros, que pueden componer su sitio combinando roles en sus propios libros de jugadas.

No me refiero al número de hosts que gestionas, sino a la complejidad de las tareas que intentas automatizar. Este capítulo te pondrá en marcha con los roles de Ansible.

Estructura básica de un rol

Un rol Ansible tiene un nombre, como database. Los archivos asociados al rol de base de datos van en el directorio roles/database, que contiene los siguientes archivos y directorios:

 defaults/   main.yml files/ pg_hba.conf handlers/   main.yml meta/   main.yml tasks/ main.yml templates/ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Redes y Kubernetes

Redes y Kubernetes

James Strong, Vallery Lancey
Kubernetes: Up and Running, 3ª Edición

Kubernetes: Up and Running, 3ª Edición

Brendan Burns, Joe Beda, Kelsey Hightower, Lachlan Evenson

Publisher Resources

ISBN: 9781098182922