upgrade windows minions

1,653 views
Skip to first unread message

Greg MacDonald

unread,
Apr 3, 2014, 7:45:28 PM4/3/14
to salt-...@googlegroups.com
What's the best way to automatically upgrade the salt minion service on windows? I tried saltutil.upgrade with an http server but it returns, "No updates available." Looking online it seems this requires a frozen build which isn't possible with windows. So how should I do this? Should I use powershell scripts or salt-ssh? Thanks.

-Greg

Olivier Trempe

unread,
Apr 7, 2014, 7:17:24 AM4/7/14
to salt-...@googlegroups.com
Hi Greg,

Here's how I do this. This might not be the best procedure but I didn't find another way.

1. Put the windows installer in a shared directory accessible by all your Windows minions.
2. In the same shared directory, put a cmd file named, for example, upgrade_minion.cmd with this content:
    \\shared\dir\Salt-Minion-2014.1.0-win32-Setup.exe /S /master=<your master id>
    exit
3. From the master execute this command:
    salt -G 'os:Windows' cmd.run 'start \\shared\dir\upgrade_minion.cmd'

Note that the exit is important in the upgrade_minion.cmd as well as the start in the salt command.

All your windows minions will be upgraded to the version specified in upgrade_minion.cmd and reconnected to the master when upgrade is done.

If someone has a better procedure, I would be glad to here about it.

Olivier Trempe

Greg MacDonald

unread,
Apr 9, 2014, 3:43:48 PM4/9/14
to salt-...@googlegroups.com
Thanks Olivier, That sounds good.

I wish there was an option in the installer to specify the minion config file. Otherwise it presents a problem when it comes time to scale the master servers.

-Greg

Benjamen Keroack

unread,
Apr 10, 2014, 9:21:54 PM4/10/14
to salt-...@googlegroups.com
I typically will put the windows installer in /srv/salt/files/.

Then I'll do:

$ salt 'servers' cp.get_file 'salt://files/Salt-minion-installer.exe' 'C:\saltminion.exe'

$ salt 'servers' cmd.run 'C:\saltminion.exe /S /master:salt /minion-name:server'

$ sleep 60 #make sure installer completed

$ salt 'servers' cmd.run 'Restart-Service salt-minion' shell=powershell

Often the last command will never actually return, but if I wait another 60 seconds the minion will respond.


On Monday, April 7, 2014 4:17:24 AM UTC-7, Olivier Trempe wrote:

Leon Hedding

unread,
Jun 2, 2014, 6:14:44 PM6/2/14
to salt-...@googlegroups.com
I use the built-in salt software repo installation method as documented here: http://salt.readthedocs.org/en/latest/topics/windows/windows-package-manager.html.

this is what I have in my init.sls file
Salt-Minion-AMD64:
  2014.1.4:
    installer: 'salt://win/repo/salt-minion/Salt-Minion-2014.1.4-AMD64-Setup.exe'
    full_name: Salt Minion 2014.1.4
    reboot: False
    install_flags: ' /S /master=FQDN /minion-name=%COMPUTERNAME%'
    uninstaller: 'C:\salt\uninst.exe'
    uninstall_flags: ' /S'
    refresh: true
Salt-Minion-win32:
  2014.1.4:
    installer: 'salt://win/repo/salt-minion/Salt-Minion-2014.1.4-win32-Setup.exe'
    full_name: Salt Minion 2014.1.4
    reboot: False
    install_flags: ' /S /master=FQDN /minion-name=%COMPUTERNAME%'
    uninstaller: 'C:\salt\uninst.exe'
    uninstall_flags: ' /S'
    refresh: true


To upgrade from the previous version I type:
salt -C 'G@saltversion:2014.1.3 and G@os:Windows and G@cpuarch:AMD64' pkg.install 'Salt-Minion-AMD64' -v -t 180
Message has been deleted

BKeep

unread,
Jun 23, 2016, 1:21:47 AM6/23/16
to Salt-users
I recently was upgrading from 2015.8 to the most recent version of salt and wanted an easy way to get the upgrade done. I ended up having a few issues with using a straight cmd.run example ot work. The service would stop but never get restarted. I ended up backgrounding the job (START /B), which seems to do the trick.

1) Download latest Salt to a folder on the master => /srv/salt/files/
2) salt -C 'G@os:win* not G@saltversion:2016.3.1' cp.get_file 'salt://files/Salt-Minion-
2016.3.1-AMD64-Setup.exe' 'C:\Salt-Minion-2016.3.1-AMD64-Setup.exe'
3) salt -C 'G@os:win* not G@saltversion:2016.3.1*' cmd.run 'START /B C:\Salt-Minion-2016.3.1-AMD64-Setup.exe /S /master=salt'

Regards,
Brandon
Reply all
Reply to author
Forward
0 new messages