LearnDevOps
DevOps05. Configuration Management·EXPERT·6 min read

16. Configuration Tools

Configuration Tools

TL;DR

  • Puppet uses pull-based (agent-initiated) continuous drift correction; Ansible uses push-based (controller-initiated) on-demand execution; Puppet requires persistent agent/master infrastructure but self-corrects continuously.
  • Chef uses Ruby as the configuration language; this enables complex logic but requires more discipline to avoid non-idempotent or unmaintainable code.
  • For greenfield projects, the decision is whether continuous unattended drift correction is a genuine requirement; most projects default to Ansible unless pull-model correction is load-bearing.
  • Migration decisions should be based on real, quantifiable operational pain points, not tool popularity or age; a decade of working configuration logic represents validated organizational knowledge.
  • Agent health monitoring is critical for Puppet; a silently-stopped agent is the primary failure mode and easy to miss without active monitoring.

Core Concepts

Puppet: pull-based continuous drift correction

Puppet uses an agent-based, pull-model architecture: agents installed on managed hosts periodically (every 30 minutes, typically) contact a Puppet master, pull down the current desired-state catalog, and apply it locally. Key characteristics:

Advantage: Continuous, unattended drift correction. Configuration self-corrects without anyone triggering a run. If a human or another process manually changes configuration, the next agent run restores it to the declared state.

Trade-off: Requires maintaining persistent agent and master infrastructure. More operational overhead than Ansible’s agentless model. A critical failure mode: a silently-stopped or misconfigured agent continues pulling the same catalog, so drift can accumulate unnoticed for hours or days before anyone detects it.

Use case: Environments where “configuration must automatically correct itself without manual intervention” is a genuine, load-bearing requirement (regulated environments, critical infrastructure).

Chef: Ruby-based configuration language

Chef uses Ruby as the configuration language (unlike Puppet’s constrained DSL). This unlocks full programming language expressiveness:

# Chef recipe — full Ruby
package "postgresql" do
  action :install
end

service "postgresql" do
  action [:enable, :start]
end

# Complex conditional logic
if node['environment'] == 'production'
  ruby_block "backup_database" do
    block do
      # Arbitrary Ruby code
      system('pg_dump | gzip > /backups/latest.dump.gz')
    end
  end
end

# Classes and inheritance
class MyRecipe < Chef::Recipe
  def setup_database
    # Implementation
  end
end

Advantage: Complex conditional and programmatic logic is genuinely easier to express in full Ruby than in a constrained DSL.

Trade-off: Full programming language expressiveness requires discipline. Without guardrails like Ansible’s built-in idempotent modules, teams can accidentally write non-idempotent code. Ruby complexity can become unmaintainable if not disciplined.

Push vs. Pull: when each model makes sense

Push-based (Ansible, most modern tools):

  • Controller initiates runs on demand (on-demand execution)
  • Simpler operational model: no persistent agent/master infrastructure
  • Well for: DevOps teams, ephemeral infrastructure, rapid iteration, most greenfield projects

Pull-based (Puppet, Chef in pull mode):

  • Agents initiate runs on a schedule (continuous, unattended)
  • Self-correction without manual intervention
  • Well-suited for: regulated environments, infrastructure that must self-heal, large enterprises with change-averse cultures

Decision for new projects: unless unattended, continuous drift correction is a genuine, named requirement, push-based is the simpler default.

Migration decisions: operational pain vs. tool popularity

The decision most organizations face isn’t “which tool for something new,” it’s “should we migrate off a mature Puppet/Chef deployment?”

Proper evaluation:

  • ✅ Genuine operational pain point (can’t hire people who know Puppet, tool structurally can’t support a real initiative)
  • ✅ Real risk analysis (a decade of production code represents validated knowledge; migration risk is real)
  • ✅ Honest budget estimate (migration takes time; regression testing is not optional)

Poor evaluation:

  • ❌ “Tool is old” or “less popular now”
  • ❌ Underestimating migration and validation effort
  • ❌ Assuming zero regression risk

Puppet vs Chef vs Ansible

Aspect Puppet Chef Ansible
Architecture Agent-based, pull Agent-based, push/pull Agentless, push
Language Puppet DSL (constrained) Ruby (full language) YAML (declarative)
State model Agent-enforced (continuous) Agent-enforced or on-demand On-demand (controller-initiated)
Drift correction Automatic (continuous) Manual (unless scheduled) On-demand (when triggered)
Agent infrastructure Persistent agents + master Persistent agents + master SSH (ephemeral)
Learning curve Medium (DSL) High (Ruby) Low (YAML)
Typical use Regulated, large enterprise Complex infrastructure code DevOps, ephemeral infra
Complexity at scale Well-tested patterns Risk of unmaintainable code Simple and auditable

Migration Decision Tree

Does the infrastructure require continuous, unattended drift correction?
├─ Yes → Puppet's pull model may be justified; evaluate migration cost
└─ No → Ansible's simpler model is likely the better default

Is the team already maintaining a mature, working Puppet/Chef deployment?
├─ Yes → Evaluate specific pain points before migrating
│   ├─ Real hiring/knowledge gap? → Migration may be justified
│   ├─ Structural capability gap? → Migration may be justified
│   └─ Just "it's old"? → Stay on current tool
└─ No → Greenfield projects default to Ansible unless special requirements

Migration effort and risk?
├─ Decade of production code → Real regression risk
├─ Need honest validation budget → Not a quick swap
└─ Consider incremental adoption (parallel runs) before full cutover

Common Pitfalls

  • Pitfall: Puppet agent silently stops for weeks; drift accumulates unnoticed until it causes an incident. Why: Agent health monitoring wasn’t implemented; the primary failure mode of pull-based systems is easy to miss. Fix: Implement agent health monitoring; alert on agents that haven’t checked in recently.

  • Pitfall: Chef recipe becomes unmaintainable Ruby code; single engineer is the only one who understands it. Why: Ruby expressiveness was used without discipline; no guardrails like Ansible’s idempotent modules. Fix: Apply code review rigor to Chef recipes the same as application code; consider style guides and linting.

  • Pitfall: Migration off Puppet justified by “it’s old”; takes months of regression fixing with no operational improvement to show for it. Why: Migration was based on tool popularity, not real pain points. Fix: Require specific, named operational pain points before approving any migration; cost-benefit analysis is mandatory.

  • Pitfall: Greenfield project defaults to Puppet’s pull model; absorbs unnecessary agent/master overhead without needing the benefits. Why: Architecture decision wasn’t explicitly evaluated. Fix: For new projects, explicitly decide: is continuous unattended drift correction a real requirement, or is on-demand execution simpler?

  • Pitfall: Team can’t hire anyone who knows Puppet; unable to maintain critical system. Why: Skill obsolescence in a long-running legacy system. Fix: Evaluate this as a real operational pain point; if hiring gap is genuine, migration has a real, quantifiable cost-benefit case.

Interview Questions

  • You inherit a decade-old Puppet deployment. How do you decide whether to keep, improve, or migrate it? — Tests whether the decision is based on real pain points, not tool-age bias.

  • Explain the operational trade-off between Puppet’s pull model and Ansible’s push model. — Tests genuine architectural understanding of continuous vs. on-demand.

  • What’s the real risk of configuration as full Ruby code (Chef) instead of a constrained DSL? — Tests understanding of expressiveness-versus-guardrails trade-offs.

  • Puppet agents haven’t checked in for days. What’s happening, and how do you detect and prevent it? — Tests understanding of pull-model failure modes and the necessity of agent health monitoring.

  • Design a decision framework for migrating from Puppet to Ansible for an organization managing 5000 servers. — Tests whether migration decisions are grounded in real operational factors, not just tool preference.

🔒 Locked
Sign in and unlock the full syllabus to keep reading.
Sign in to continue
Knowledge check
5 scenario questions on this topic
Take the quiz →
Related in 05. Configuration Management
15. Automation
EXPERT