18 February 2016

Salt: Control a Windows Minion

Install the Windows Client

or from the file list:

NB: minion config is here by default:

On the Server

Create the 'top' file:
  1. Create a 'top.sls' file:
    vi /srv/salt/top.sls
  2. Add in the declarations the environment:
        - global
        - salt.minion
        - match: grain
        - windows
This tells salt that for the environment called base all minions will have state files /srv/salt/global.sls and /srv/salt/salt/minion.sls applied to them.

All systems that match the 'grain' of Windows all Minions will have the state file /srv/salt/windows.sls or /srv/salt/windows/init.sls applied to them.

Package Manager

See also the official documentation 'Windows Package Manager'
  1. Initialize the repository on your Salt master:
    salt-run winrepo.update_git_repos
  2. Run pkg.refresh_db on each of your Windows minions to synchronize the package repository:
    salt -G 'os:windows' pkg.refresh_db
  3. Show Installed packages:
    salt -G 'os:windows' pkg.list_pkgs

Use Chocolatey in a State

vi /srv/salt/windows.sls
    - name: chocolatey.bootstrap

    - unless: # command to check if firefox is already installed
    - name: chocolatey.install
    - m_name: firefox
    - require:
      - module: chocolatey

No comments:

Post a Comment