Can Ansible be used for GitOps?
AdvancedProductionArchitecture Decisions and Tool Comparisons
Answer
Partly. GitOps means Git is the desired state and an agent continuously reconciles reality to it. Ansible is push-based and runs only when triggered, so out of the box it covers "Git is the source of truth" but not "continuous reconciliation".
Ways to get closer:
- Merge to main triggers the AWX job or CI pipeline (push-based GitOps).
- Scheduled check-mode runs detect drift and alert; scheduled real runs correct it.
ansible-pullon a timer gives pull-based reconciliation on each host.- EDA reacts to drift events.
For Kubernetes, use Argo CD or Flux. For VMs, scheduled runs plus drift detection are a reasonable, honest approximation of GitOps.
More on Architecture Decisions and Tool Comparisons
Ansible or Terraform: where do you draw the line?BeginnerHow does Ansible compare with Puppet, Chef and Salt?IntermediateWhy use Ansible instead of shell scripts?BeginnerWhere does Ansible fit once you run Kubernetes?Intermediatecloud-init or Ansible for first boot configuration?IntermediateWhen would you use AWS Systems Manager instead of, or together with, Ansible?Intermediate