Polycrate vs. plain Ansible: What You Gain – and Why It's Worth It
TL;DR Plain Ansible is a powerful tool for ad-hoc automation, quick scripts, and simple setups – but …
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.
acme-corp-automation) and a simple directory structure prevent chaos before it starts.:latest.hosts: localhost instead of correct inventories, and missing version pins; with Polycrate and best practices, you avoid these mistakes from the start.The first productive workspace is more than a test balloon. It sets the stage for how you will automate in the future:
Many start with plain Ansible and a quick ansible-playbook on their laptop – and months later face a zoo of playbooks, Python versions, and inventories. Ansible is powerful, but without guardrails, complexity grows faster than you’d like.
Polycrate gives Ansible a clear structure:
This post provides a concrete checklist for your first productive workspace – including name, structure, initial blocks, encryption, Git, and team onboarding.
A good workspace name is:
Proven pattern:
{company}-{area}-automation or{company}-{product}-platformExamples:
acme-corp-automation (company-wide automation)acme-retail-platform (platform team for retail business)Avoid: Names with personal references or environments (max-dev-playground, ansible-test).
A typical workspace according to the best practices for Polycrate workspaces looks like this:
acme-corp-automation/
workspace.poly
inventory.yml
artifacts/
secrets/
kubeconfig.yml # if you use K8s
blocks/
linux-patch/
block.poly
patch.yml
windows-baseline/
block.poly
baseline.yml
k8s-deploy-app/
block.poly
deploy.yml
.git/workspace.poly defines the workspace and block instancesinventory.yml (YAML!) is the central inventory for all Ansible playbooksblocks/ contains your local blocks with block.poly and playbooks in the same directoryartifacts/secrets/ is the obvious place for encrypted files (via Polycrate workspace encryption)name: acme-corp-automation
organization: acme
blocks:
- name: linux-patch
from: linux-patch
config:
target_hosts: "linux_servers"
- name: windows-baseline
from: windows-baseline
config:
target_hosts: "windows_servers"
- name: k8s-deploy-app
from: k8s-deploy-app
config:
kubeconfig_path: ""Important:
from: points to the subdirectory under blocks/ for local blockssource: or version: in the block entry (the version is in the block definition or registry tag)config at workspace level is not a free-form key-value map—only documented fields (e.g. toolchain image, paths); see Configuration. Set SSH users per host in inventory.yml (e.g. ansible_user)workspace.poly (no {{ workspace.secrets[...] }}). Put sensitive values for kubeconfig_path in secrets.poly (merged with workspace.poly), not as templates in workspace.polykubeconfig_path: "" placeholder via secrets.poly or after you know the real pathLet’s start with a minimal but productive example for Linux admins: a block for patching all Linux servers.
name: linux-patch
version: 0.1.0
kind: generic
config:
target_hosts: "linux_servers"
actions:
- name: patch
description: "Patch Linux servers"
playbook: patch.ymlversion of the block is explicitly set – never work unversionedconfig.target_hosts defines the host group the playbook targetspatch clearly describes what happens: patching via Ansibleall:
children:
linux_servers:
hosts:
server01.acme-corp.com:
ansible_user: ubuntu
server02.acme-corp.com:
ansible_user: ubuntu
windows_servers:
hosts:
win01.acme-corp.com:
ansible_user: Administrator
ansible_connection: winrm
ansible_port: 5986
ansible_winrm_server_cert_validation: ignoreThis inventory is located at the workspace root (inventory.yml). Polycrate automatically sets ANSIBLE_INVENTORY to this file; you don’t need to configure anything further in the block.
- name: Patch Linux Servers
hosts: "{{ block.config.target_hosts }}"
become: true
gather_facts: true
tasks:
- name: Update package cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
- name: Upgrade all packages
ansible.builtin.apt:
upgrade: dist
autoremove: trueImportant:
hosts: localhost and no connection: local – this would only affect the Polycrate containerhosts is pulled from the block configuration and points to a group from inventory.ymlpolycrate run linux-patch patchThis fundamentally differs from plain Ansible:
ansible-playbook -i inventory.yml patch.yml on a locally configured systemansible.cfgMore on Ansible integration can be found in the official documentation:
https://docs.ayedo.de/polycrate/ansible/
Goal: Make routine tasks stable and reproducible.
Recommended first blocks:
linux-patch (as above)linux-users)For hardening, consider using an official block from PolyHub (hub.polycrate.io) or building a custom block that reflects internal policies.
Goal: Automate standard tasks around AD, GPO, and software deployment.
Typical starting blocks:
windows-baseline: Base roles, PowerShell policy, agentswindows-software-deploy: Standard software via Ansible win_* modulesad-user-mgmt: User and group maintenance via Ansible modules for Active DirectoryA block.poly for windows-baseline might look like this:
name: windows-baseline
version: 0.2.0
kind: generic
config:
target_hosts: "windows_servers"
actions:
- name: apply
description: "Apply Windows baseline"
playbook: baseline.ymlThe playbooks use hosts: "{{ block.config.target_hosts }}" and the windows_servers group from the inventory – just like in the Linux example.
Goal: Automate cluster operations via Ansible and additional tools (kubectl, Helm).
Useful first blocks:
k8s-deploy-app: Deliver application (manifests or Helm charts)k8s-cert-manager (often useful, via PolyHub block with pinned version)k8s-backup-ops: Recurring backup/restore tasksA block.poly that uses a kubeconfig from the workspace:
name: k8s-deploy-app
version: 0.1.0
kind: generic
config:
kubeconfig_path: ""
actions:
- name: deploy
description: "Deploy app to cluster"
playbook: deploy.ymlIn the playbook, you work with hosts: localhost and connection: local, because the API calls (e.g., kubernetes.core.k8s) go directly from the Polycrate container to the cluster – this is correct here, as the target endpoint is an API, not the container itself. More details can be found in the Kubernetes documentation:
https://docs.ayedo.de/polycrate/kubernetes/
These steps have proven effective for getting started:
Create Git Repository
git init acme-corp-automation.gitignore for local artifacts, e.g., *.retry, temporary filesCreate Workspace
workspace.poly (see above)inventory.yml and enter initial hosts – cleanly separated by groupsCreate First Block
blocks/linux-patch/ create block.poly and patch.ymlversion: 0.1.0)polycrate run linux-patch patchEnable Workspace Encryption
Polycrate comes with built-in encryption using age.
Typical process:
polycrate workspace encryptartifacts/secrets/kubeconfig.yml are stored encryptedConsistently Pin Block Versions
version field in block.poly- name: nginx-ingress
from: registry.acme-corp.com/acme/infra/nginx-ingress:0.3.1:latest – this is the most common source of “suddenly everything is different”.Integrate PolyHub Blocks (Where Appropriate)
Write Team Readme
polycrate run linux-patch patch
polycrate run windows-baseline apply
polycrate run k8s-deploy-app deployWith this checklist, you will quickly have a workspace that is:
– not just an experiment on your own laptop.
Using hosts: localhost for Real Servers
inventory.yml (linux_servers, windows_servers, etc.); no connection: local when managing hosts over SSH/WinRMStoring secrets unencrypted in Git
artifacts/secrets/ and manage them encryptedNot pinning block versions
block.poly and explicit registry tags; roll out changes via new versionsBuilding too many blocks at once
Playbooks not named for teams
misc.yml didpatch.yml, baseline.yml, deploy.yml) and matching action names (patch, apply, deploy)Polycrate should not be a single-person tool but a shared platform. Teams report good results with:
Simple entry commands
polycrate run linux-patch patchRole-based onboarding
linux-patch and linux-userswindows-baseline, windows-software-deployk8s-deploy-app, plus official K8s blocks from PolyHub as neededShared guardrails
Training and pairing
With Polycrate you have the right foundation: containerized execution fixes the dependency problem, the block model adds structure and guardrails, and workspace encryption makes compliance easier without heavyweight external tools.
No. Polycrate solves this by running Ansible fully in the container. Locally you only need Polycrate and a container runtime (e.g. Docker or Podman). Ansible version, Python packages, and extra tools (kubectl, Helm, Azure CLI, etc.) are defined centrally in the toolchain container—everyone uses the same environment.
Yes. In many starter projects we put existing playbooks into new blocks instead of rewriting everything:
inventory.yml in the workspacehosts to reference groups and/or block configurationansible-playbook invocations with polycrate run BLOCK ACTIONThe value comes from structure (blocks, workflows) and containerized execution. For a deeper migration we can plan together as part of our consulting.
Typically:
The goal is always that your team can evolve Polycrate independently—we provide the scaffold and know-how. For questions, use our contact form or https://ayedo.de/kontakt/
More questions: FAQ
At the end of this series you have not a finished product but a toolkit: With a first clean workspace, clear blocks, and consistent versioning, you have a foundation that lasts.
Polycrate addresses hurdles many teams see with plain Ansible:
age simplifies handling sensitive data and helps meet compliance (e.g. GDPR since 05/25/2018) without introducing a separate vault product.As the team behind Polycrate, ayedo supports you in this phase—from the first productive workspace to company-wide automation platforms. Our consulting offerings combine platform engineering practice with compliance, security, and enterprise architecture.
Whether you want to unify Linux and Windows administration, integrate Kubernetes clusters, or establish policy as code for audits—we define a workspace and block landscape that fits your organization.
If you do not want to plan your first productive workspace alone, or want to migrate existing Ansible cleanly into Polycrate, get in touch—with real examples from your day-to-day work.
Workshops and formats: Workshops · tailored support: Consulting.
TL;DR Plain Ansible is a powerful tool for ad-hoc automation, quick scripts, and simple setups – but …
TL;DR Most environments are hybrid: Windows servers for AD, file services, and specialized …
TL;DR Set up WinRM properly once with HTTPS, certificate, and firewall rules, and you’ll have …