(this is a copy of a question I asked on the salt-users group, FWIW)
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?