Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Deploying the WAR file in Apache Tomcat


After all the configurations have been completed, the final step is to deploy the WAR files, which contain all the application-related files and are served by the application server. In this recipe, we will learn how to deploy WAR files using Salt.

How to do it...

We will use the same minion as in the previous recipe.

For this example, we will use a sample WAR file called sample.war. Many such example application WAR files can be found online, for example at this location https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war.

The file is downloaded and located in the /opt/salt-cookbook/development/tomcat/files/sample.war location.

  1. Create and edit /opt/salt-cookbook/development/tomcat/deploy.sls to have the following entries:

    include:
      - tomcat
    
    sample_war:
      file.managed:
        - name: /opt/tomcat/webapps/sample.war
        - source: salt://tomcat/files/sample.war
        - mode: 0644
        - require:
          - file: /opt/tomcat
  2. Apply the state to the minion...