NinjaGaiden
NinjaGaiden

Reputation: 3146

Create a windows service in a salt state

I know how to create a windows service by doing,

salt service.create "servicename" "c:\executable.exe" display="serviceIcreated"

How can I incorportate this into a state?

c:\temp\somedir:
  file.recurse:
    -source: salt:/d/ser

Upvotes: 0

Views: 1526

Answers (1)

alejdg
alejdg

Reputation: 2473

As the service.create is not available in Salt States you will need to run the execution module from within your own state or sls file.

You could do it this way:

create_executable:
  module.run:
    - name: service.create
    - m_name: servicename
    - bin_path: c:\executable.exe
    - display: serviceIcreated

About the piece of code in your question I did not understand how it adds value to your question.

c:\temp\somedir:   
   file.recurse:
    -source: salt:/d/ser

If it is relevant, please make an edit in order to make it easier to understand.

Upvotes: 3

Related Questions