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...
Configure a minion called
salt-minion
. Create a new state directory calledapache
.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.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 - source: http://mirror.nus.edu.sg/apache//httpd/httpd- 2.4.10.tar.gz - source_hash: http://www.apache.org/dist/httpd/httpd- 2.4.10.tar.gz.md5 extract_httpd_source: archive: - extracted - name: /opt/ - source: /opt/httpd...