The Terraform vs Ansible comparison on OctoCounts shows side-by-side source line counts for hashicorp/terraform and ansible/ansible, counted under the rules and on the dates stated below: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.
This page compares the source lines of code (SLOC) of hashicorp/terraform and ansible/ansible using cached OctoCounts reports. Code size is not code quality: a larger count only means more source material, not a better or worse project.
As of 2026-11-05, hashicorp/terraform contains 762,099 total lines (605,286 code) across 4,082 files, while ansible/ansible contains 168,713 total lines (127,988 code) across 826 files as of 2026-11-05. hashicorp/terraform has about 4.7x the counted code lines of ansible/ansible under the same engine and counting rules. Code size is not code quality: a larger count only means more source material, not a better or worse project.
| Metric | hashicorp/terraform | ansible/ansible |
|---|---|---|
| Files | 4,082 | 826 |
| Total lines | 762,099 | 168,713 |
| Code lines | 605,286 | 127,988 |
| Comment lines | 74,336 | 15,224 |
| Blank lines | 82,477 | 25,501 |
| Languages counted | 12 | 11 |
Top languages in hashicorp/terraform: Go (92.9% of code), JSON (4.5% of code), HCL (2.3% of code). Top languages in ansible/ansible: Python (82.1% of code), YAML (11.5% of code), C# (3.1% of code). Go, JSON, HCL, Protocol Buffers, Shell appear only in hashicorp/terraform's top languages; Python, YAML, C#, PowerShell, Jinja2 appear only in ansible/ansible's top languages.
Methodology: both counts come from cached OctoCounts reports generated with tokei. hashicorp/terraform was counted at ref main (commit a47b3c062d55) on 2026-11-05; ansible/ansible was counted at ref devel (commit 09838f3a1c60) on 2026-11-05. See the counting methodology for ignored directories and analysis options.
Both reports use the same engine and effective counting rules. Repository declarations, when enabled, are specific to each repository. hashicorp/terraform: tokei-15.0.0, policy directories-v1; docs excluded, tests excluded, generated excluded. Excluded directory names: .cache, .generated, .git, .next, __tests__, build, dist, doc, docs, documentation, fixtures, gen, generated, node_modules, target, test, tests, vendor. Ignored languages: none. Repository declarations: off. Exclusions are rule-based; they do not prove that every test, document or generated file was removed. ansible/ansible: tokei-15.0.0, policy directories-v1; docs excluded, tests excluded, generated excluded. Excluded directory names: .cache, .generated, .git, .next, __tests__, build, dist, doc, docs, documentation, fixtures, gen, generated, node_modules, target, test, tests, vendor. Ignored languages: none. Repository declarations: off. Exclusions are rule-based; they do not prove that every test, document or generated file was removed.
Background observations recorded on 2026-09-16; language descriptions here are historical context, not claims about the current filtered shares. Use this page's measured language breakdown for current counts. Repository layout before counting filters: hashicorp/terraform is the Terraform core repository — the configuration language, state management, plan/apply engine, and built-in providers for its plugin protocol — while ansible/ansible is the Ansible core: the automation engine, modules, and plugin machinery, with most content collections maintained in separate repositories. The two tools sit in adjacent but different categories, so the contains describe different kinds of software rather than two takes on one job.
The language tables show the implementation split directly: Terraform core is a Go codebase, while Ansible core is predominantly Python — each project's chosen language for its domain, visible without any inference from totals.
Ansible's count includes a large module and plugin surface inside the core repository, so its tree size partly reflects how much automation functionality ships from one repository rather than from a registry of collections.
This is not a like-for-like tool comparison: Terraform provisions and manages infrastructure resources declaratively, Ansible automates configuration and tasks across machines. The line counts say nothing about which fits a given workflow.
Sources: hashicorp/terraform repository · ansible/ansible repository. Statements verified 2026-09-16.
Evidence and next steps:
Saved reports remain subject to cache cleanup and replacement. Export their JSON for durable citation; live report URLs can change.
Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.
As of 2026-11-05, hashicorp/terraform contains 762,099 total lines (605,286 code) across 4,082 files, while ansible/ansible contains 168,713 total lines (127,988 code) across 826 files as of 2026-11-05. hashicorp/terraform has about 4.7x the counted code lines of ansible/ansible under the same engine and counting rules. Code size is not code quality: a larger count only means more source material, not a better or worse project.
Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for hashicorp/terraform, ansible/ansible, or any repository.
Methodology: both counts come from cached OctoCounts reports generated with tokei. hashicorp/terraform was counted at ref main (commit a47b3c062d55) on 2026-11-05; ansible/ansible was counted at ref devel (commit 09838f3a1c60) on 2026-11-05. See the counting methodology for ignored directories and analysis options.
Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.