Chapter 5. Managing Files and Resources
Managing hosts is much more than just installing and updating software, creating users, or restarting a service. It also involves copying applications or configuration files to managed hosts.
This chapter covers different modules to manipulate files in Ansible; from copying files from the control node to the managed node to creating templates.
Speaking about templates, you’ll get an introduction to the Jinja2 Template engine as it’s used in Ansible to render manifests.
Modules to manage files and folders
There are several modules available for managing files and folders in Ansible. Let’s explore some of the modules that can be used to manipulate files in Ansible.
file module
The file module has the following purposes:
-
Setting attributes (ownership, group, permissions) for files, directories, and symbolic links.
-
Deleting remote content like files, directories, or symbolic links.
Get Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.