can I reboot windows minion in middle of state?

584 views
Skip to first unread message

Bryan Oakley

unread,
May 13, 2014, 11:34:33 AM5/13/14
to salt-...@googlegroups.com
I've seen old threads that ask a similar question, because salt is evolving so fast I want to ask again to get the latest facts. 

I need to write a state that installs some Windows server features, reboots the minion, and then installs some more software. It seems like all the pieces are there (cmd.wait, system.reboot), but I'm having trouble connecting the dots. 

For example, I have a "webserver" state that is supposed to install IIS on a machine. It needs to enable some server features, reboot (because Windows), and then continue on. We do this with a custom module named "website" which lets me install a website, and another module for installing app pools. Our state file looks something like this:

my_website:
  website.installed:
    - name: example.com 
    - version: alpha-1.0.0
        - type: Website
        - bindings:
           - hostheader: localhost
           - port: 1234
        - installdir: c:\\wwwroot\\example.com
        - apppool: static
    - require:
          - sls: serverstate.webserver
          - sls: apppool.static

The above works great, except for the fact we need to do a reboot between the "serverstate.webserver" and "apppool.static" requirements. As it stands, the state fails, we manually reboot, and then rerun the state and it works. Naturally we want to omit the manual reboot step.

Is there a common pattern to solve this type of problem? 


Colton Myers

unread,
May 15, 2014, 4:01:52 PM5/15/14
to salt-...@googlegroups.com
The problem is that we don't have any sort of "resume" functionality on a state run.  You can restart as part of a state run, but it needs to be at the *end* of the state run.  It's possible that we might be able to do something like this using the orchestrate runner -- run some states, including a restart, then wait for a time, then run the additional states, hoping the minion has come back up by then.  In fact, that's probably the best way to head towards implementing this, but I'm not sure it would fully work yet, we might need to add some additional functionality to orchestrate.

You could potentially also write a script which does a similar thing -- runs one set of states, then waits for the restart, then runs a second set of states, using `state.sls` or `state.top`.

You might consider opening an issue on Github so we could make sure a workflow like this works on the state.orchestrate runner.

--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Elias Probst

unread,
May 15, 2014, 4:18:24 PM5/15/14
to salt-...@googlegroups.com
On 05/15/2014 10:01 PM, Colton Myers wrote:
> You might consider opening an issue on Github so we could make sure a
> workflow like this works on the state.orchestrate runner.

https://github.com/saltstack/salt/issues/6792

signature.asc

Tami selvan

unread,
Aug 12, 2019, 1:52:27 PM8/12/19
to Salt-users

i want create a apppool and website creation using salt module
Reply all
Reply to author
Forward
0 new messages