Polycrate API for Teams: Centralized Monitoring and Remote Triggering
TL;DR The Polycrate API transforms individual workspaces into a team platform: all workspaces, …
Diese Serie zeigt Schritt für Schritt, wie Ansible mit Polycrate zu einer strukturierten, teilbaren und compliance-fähigen Automatisierungsplattform wird – von den Grundlagen bis zu Enterprise-Szenarien.
polycrate run – without a local Ansible installation.Many Windows admins know the dilemma: Microsoft Endpoint Configuration Manager (formerly SCCM) is powerful, but:
At the same time, the need is clear:
This is where Chocolatey, Ansible, and Polycrate form an exciting combination: You achieve many of the benefits of SCCM (standardized, repeatable, auditable) without its costs and complexity.
Chocolatey is – simply put – apt or yum for Windows:
choco install, choco upgrade, choco uninstall).For admins, this means:
choco install 7zip --version 22.1.0.Important: In production environments, you usually use an internal Chocolatey repository. The principle remains the same – only the source URL changes.
Ansible comes with its own module, win_chocolatey, which encapsulates exactly this Chocolatey functionality.
A minimal example playbook (without Polycrate, just for context):
- name: Windows Baseline with Chocolatey
hosts: windows_office
gather_facts: false
tasks:
- name: Ensure Chocolatey is installed
ansible.windows.win_chocolatey:
name: chocolatey
state: present
- name: Install 7zip
ansible.windows.win_chocolatey:
name: 7zip
version: '22.1.0'
state: present
- name: Install Google Chrome
ansible.windows.win_chocolatey:
name: googlechrome
version: '118.0.5993.90'
state: presentWith plain Ansible, this means for you:
ansible.cfg, collections) yourself.This is where Polycrate comes into play.
Polycrate does not replace Ansible – it provides a clean, reusable packaging for Ansible.
The relevant advantages in this scenario:
Dependency Problem Solved
choco, pwsh, kubectl) are consistently added via a Dockerfile.poly or a setup script.More on this in the Ansible Integration of Polycrate.
Guardrails and Sharable Automation
block.poly).registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0 is a “product” that your team can use, test, and share – internally or via the PolyHub.Best practices can be found under Polycrate Best Practices.
Secure Configuration
polycrate workspace encrypt.For you as a Windows admin, this means: You focus on the playbooks and software baselines – Polycrate takes care of the toolchain, structure, and reuse.
We build an example for the fictional acme-corp.com:
office-workstationdeveloper-workstationserverA minimal inventory.yml in the workspace root might look like this:
all:
hosts:
win-office-01.acme-corp.com: {}
win-office-10.acme-corp.com: {}
win-dev-01.acme-corp.com: {}
win-srv-01.acme-corp.com: {}
children:
windows_office_test:
hosts:
win-office-01.acme-corp.com:
vars:
ansible_user: Administrator
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
windows_office_prod:
hosts:
win-office-10.acme-corp.com:
vars:
ansible_user: Administrator
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
windows_developer:
hosts:
win-dev-01.acme-corp.com:
vars:
ansible_user: Administrator
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
windows_servers:
hosts:
win-srv-01.acme-corp.com:
vars:
ansible_user: Administrator
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignoreNo passwords in the inventory—set ansible_password in playbooks from secrets.poly / workspace.secrets.* (see Workspace encryption).
Polycrate automatically sets ANSIBLE_INVENTORY to this file. You don’t need an additional ansible.cfg.
Our workspace.poly defines which blocks exist:
name: acme-corp-automation
organization: acme
blocks:
- name: windows-office-baseline
from: registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0
config:
profile: office
target_group: windows_office_test
- name: windows-developer-baseline
from: registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0
config:
base_profile: office
profile: developer-extra
target_group: windows_developer
- name: windows-server-baseline
from: registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0
config:
profile: server
target_group: windows_servers
allow_reboot: falsefrom: is the full OCI registry reference including the version tag; registry.acme-corp.com is a fictional example (not tied to a specific production registry).
Important:
blocks/registry.acme-corp.com/acme/windows/windows-software-baseline/.profile, base_profile, etc.).More on generic inheritance in Polycrate can be found in the documentation on Inheritance.
name as full registry reference in block.polyNow we define the block itself under blocks/registry.acme-corp.com/acme/windows/windows-software-baseline/block.poly (directory layout = registry path). In block.poly, name must be the full registry URL—the same string as from: in workspace.poly, without the version tag (no :0.1.0 suffix). In short: from: = name + : + tag. That is not the same identifier as the block instances in workspace.poly (windows-office-baseline, windows-developer-baseline, …).
# name = from: without tag (full registry path)
name: "registry.acme-corp.com/acme/windows/windows-software-baseline"
version: 0.1.0
kind: generic
config:
chocolatey_source: "https://community.chocolatey.org/api/v2/"
# Central definition of software profiles
software_profiles:
office:
- name: 7zip
version: "22.1.0"
- name: googlechrome
version: "118.0.5993.90"
- name: sumatrapdf
version: "3.4.6"
developer-extra:
- name: vscode
version: "1.84.0"
- name: git
version: "2.44.0"
- name: postman
version: "10.21.0"
server:
- name: sysinternals
version: "2023.9.23"
- name: notepadplusplus
version: "8.6.2"
actions:
- name: baseline
playbook: baseline.ymlA few points about this:
polycrate run windows-office-baseline … and similar commands use the instance name from workspace.poly, not the full registry reference in name (block.poly).latest would be more convenient, but you lose all reproducibility. Your goal: “A workstation in April 2026 looks the same as one in June – as long as you don’t intentionally increase the block version.”office, developer-extra, and server are centrally defined. Workspace-specific, you only decide which profile is used.Once this block runs stably, you can push it to your OCI registry—for example (fictional registry, same path scheme as above):
registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0This makes your software baseline a sharable automation for other teams.
Now we need the playbook blocks/registry.acme-corp.com/acme/windows/windows-software-baseline/baseline.yml, which uses Chocolatey and combines profiles:
- name: Windows Software Baseline with Chocolatey
hosts: "{{ block.config.target_group }}"
gather_facts: false
vars:
choco_source: "{{ block.config.chocolatey_source }}"
base_profile_name: "{{ block.config.base_profile | default(None) }}"
profile_name: "{{ block.config.profile }}"
tasks:
- name: Ensure Chocolatey is installed
ansible.windows.win_chocolatey:
name: chocolatey
state: present
- name: Load base packages (e.g., office)
ansible.builtin.set_fact:
base_packages: "{{ block.config.software_profiles[base_profile_name] | default([]) }}"
- name: Load profile packages (e.g., developer-extra or server)
ansible.builtin.set_fact:
profile_packages: "{{ block.config.software_profiles[profile_name] }}"
- name: Merge final list of packages
ansible.builtin.set_fact:
final_packages: "{{ base_packages + profile_packages }}"
- name: Install/update all packages to desired version
ansible.windows.win_chocolatey:
name: "{{ item.name }}"
version: "{{ item.version }}"
state: present
source: "{{ choco_source }}"
loop: "{{ final_packages }}"
- name: Optional: Allow reboot after installation
ansible.windows.win_reboot:
msg: "Reboot after baseline installation by Polycrate/Ansible"
pre_reboot_delay: 60
when: block.config.allow_reboot | default(true)Important details:
hosts: "{{ block.config.target_group }}" ensures that you can control which host group is addressed per block instance – ideal for rolling rollouts.base_profile and profile implement our configuration inheritance:
profile: office without base_profile.base_profile: office and profile: developer-extra—that is “developer inherits office plus extra tools”.ansible.windows.win_chocolatey and ansible.windows.win_reboot modules come from the Windows collections; Polycrate provides a suitable Ansible environment in the container.With plain Ansible you would have to orchestrate all variable sources (e.g. group_vars, host_vars, extra_vars) and CLI calls yourself. With Polycrate, these parameters become part of the block and are versioned.
The rolling rollout follows naturally from inventory groups:
Define the test group
In the inventory.yml above, windows_office_test and windows_office_prod exist. In workspace.poly, the office baseline’s target_group is initially windows_office_test.
Run the baseline on the test group
polycrate run windows-office-baseline baselinePolycrate:
baseline.yml with the parameters from windows-office-baseline.After tests: switch target to production
Change workspace.poly:
- name: windows-office-baseline
from: registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0
config:
profile: office
target_group: windows_office_prodSave the workspace and commit to Git—so you record from which workspace definition version the baseline rolled out to production.
Roll out to production
polycrate run windows-office-baseline baselineYou can bundle these steps in a Polycrate workflow later if you want. For many teams it is already a big win that test vs. production is clear from inventory groups and Git history.
No—you can use the public Chocolatey repository as in the example (https://community.chocolatey.org/api/v2/). Many organizations still prefer an internal repository:
In the Polycrate block, the source is just a config variable (chocolatey_source); you can switch from public to internal without rewriting the playbook.
Two points matter most:
registry.acme-corp.com/acme/windows/windows-software-baseline:0.1.0) ran with which workspace configuration against which systems—supporting audit traceability.polycrate workspace encrypt, which helps meet requirements from standards such as ISO 27001 or internal policies without an external secrets manager.More in the documentation on workspace encryption.
Plain Ansible can implement everything in this article. The difference is everything around it:
Polycrate adds:
In short: Polycrate pays off when you have more than a few ad-hoc playbooks and want automation as a “product” in the team.
More questions? See our FAQ
With Chocolatey, Ansible, and Polycrate you have a practical path to Windows software deployment without SCCM infrastructure:
win_chocolatey keep automation idempotent and traceable, while Polycrate handles the container toolchain, workspace structure, and reuse.target_group change and a Git commit—not a new SCCM deployment.We often see Windows teams start with building blocks like these and then add patch management, local admin groups, browser hardening, and combined workspaces for Linux, Windows, and edge environments.
If you want to walk through this approach in your environment—from the first workspace structure to a tested rollout to your test group—we are happy to join you in a shared software deployment workshop.
TL;DR The Polycrate API transforms individual workspaces into a team platform: all workspaces, …
TL;DR Polycrate not only logs Action Runs (Ansible playbooks) but also SSH sessions, workspace …
TL;DR A well-named, clearly structured Polycrate workspace is half the battle: a consistent name …