Config Management
Overview
Desired state lives in git; you converge machines and manifests to it idempotently and you always show the diff before applying.
When to use
- Configure or patch a fleet with Ansible, bootstrap VMs with cloud-init.
- Maintain Helm values and Kustomize overlays per environment.
- Drift detection between git and live systems.
Engine
infra action=discover provider=ansible(modules viaansible-doc -l -j),provider=helm,provider=kubernetes.infra action=check command="ansible-playbook ..."- the engine classifies scope and risk.infra action=planwith a check step (--check --diff) before the apply step,infra action=run,infra action=verify.
Workflow
- Read the inventory and target group; confirm it is the intended environment.
- Lint (
ansible-lint,yamllint,kustomize build), syntax check. - Dry-run with diff on a canary host or one overlay.
- Apply in batches (
serial:), stop on first failure (max_fail_percentage: 0). - Re-run in check mode: zero changes means converged.
Command families
ansible-inventory -i <inv> --graph; ansible -i <inv> <group> -m ping
ansible-playbook -i <inv> site.yml --syntax-check
ansible-playbook -i <inv> site.yml --check --diff --limit <canary>
ansible-playbook -i <inv> site.yml --limit <group>
ansible-lint; ansible-doc <module>
ssh -o BatchMode=yes <host> 'systemctl is-active <svc>'
cloud-init status --long; cloud-init schema --system
helm template <rel> <chart> -f values-prod.yaml | kubectl diff -f -
kustomize build overlays/prod | kubectl diff -f -
Safety rules
- Playbooks against production groups,
shell/commandmodules with destructive commands, user/SSH key and firewall roles are critical: user validation. - Never apply without a check/diff run shown to the user first.
- Secrets via Ansible Vault / SOPS / external secret stores, never plain in vars.
Verification and rollback
- Verify: second check run reports changed=0, service health checks pass.
- Rollback: revert the commit and re-apply, previous Helm revision, restore of backed-up config files (
backup: yes).
Deliverable
Hosts/overlays targeted, diff shown, apply results per host, convergence evidence, rollback.
