-1

I have excercise where i have to deploy app war files onto multiple tomcat instances available on the same server. I am using Salt has my configuration mangement tool here, i have also gone through some examples of salt orchestrate runner but nothing seems to help. I am also confused arranging the pillar variables for multiple instances in the pillar file.

I am able to deploy app on only instance without any trouble.

Pillar file :

appname:
  name : location to instance1 webapps folder
  typer : war

State File:

  archive.download:
    download the war directly to instance1 webapp folder
  cmd.run
    restart instance1

Need help to include the second instance details and achieving the state deployment in optimized way possible. Thanks.

1 Answers1

0

You might be able to use on the pillar side an array and then a jinja loop for the installation in the state file.

pillar:

applist:
  - location : salt://path_to_archive_wi1
    destination: /webapps_i1
    name: test1
    typer : war
  - location : salt://path_to_archive_wi2
    destination: /webapps_i2
    name: test2
    typer : war
  - location : salt://path_to_archive_wi3
    destination: /webapps_i3
    name: test3
    typer : war

state file:

{%- for app in salt['pillar.get']("applist",[]) %}
copy {{ app[name] }} :
  file.managed:
    - name: {{ app['destination'] }}
    - source: {{ app['location'] }}
{%- endfor %}

Something like this should do it. In the loop if you are only installing one app in one instance, you can also restart the instance.

agm650
  • 111
  • 4