Managing files

One of the very basic and important tasks in infrastructure management is to manage files. In this recipe, you will learn how to manage files and its variants such as directories and symlinks using Salt.

How to do it...

  1. Configure a minion called salt-minion. Create a new state directory called apache.
  2. In the apache directory, create the following directory structure:
    [root@salt-master ~]# mkdir –p /opt/salt- cookbook/staging/apache/files/apache_root/{produxts,services,b log,about}
    

    Also create an /opt/salt-cookbook/staging/apache/files/index.html file with some test HTML content in it.

  3. Create and edit /opt/salt-cookbook/staging/apache/init.sls to have the following contents:
    httpd_source: file.managed: - name: /opt/httpd-2.4.10.tar.gz ...

Get Salt Cookbook 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.