O'Reilly logo

Salt Cookbook by Anirban Saha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required