Skip to content

docs(ansible): stop shipping ansible_user: root in the inventory template - #66

Merged
thiras merged 2 commits into
mainfrom
docs/drop-default-ansible-user
Sep 22, 2026
Merged

thiras merged 2 commits into
mainfrom
docs/drop-default-ansible-user

Conversation

@thiras

@thiras thiras commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Drop ansible_user: root from inventory/hosts.yml.example. With it unset, Ansible connects as your local $USER, which is the admin account baseline already creates (roles/baseline/tasks/main.yml, runner autodetect).
  • New hosts bootstrap once with make deploy LIMIT=<host> ANSIBLE_ARGS='-u root' (or the image's default sudo user). Later runs need no flag, so there's no inventory edit after the first converge.
  • The template and README now say when a per-host ansible_user is still needed: the admin name differs from $USER, or baseline_sudo_autodetect_runner: false. They also warn against setting it to the bootstrap user, because an inventory ansible_user overrides -u.

Why: after the first converge, ssh_hardening disabled root login, but the template still said root. Every host broke until someone edited the inventory by hand, and a fleet-wide make deploy failed on any host that was missed.

No Makefile or role changes: ANSIBLE_ARGS already passes -u through.

Test plan

  • ansible-inventory --host decdn-node-1 on a .yml copy of the template: only ansible_host resolves
  • yamllint (repo .yamllint) on the template copy
  • pre-commit (markdownlint, hygiene) on both files
  • CI: ansible-lint + galaxy-build

🤖 Generated with Claude Code

…late

With ansible_user unset, Ansible connects as the control machine's $USER,
which is exactly the admin account baseline creates. The shipped
`ansible_user: root` broke every host after its first converge (ssh_hardening
disables root login) until the operator edited the inventory by hand, and it
overrode `-u`. New hosts now bootstrap once with
`make deploy LIMIT=<host> ANSIBLE_ARGS='-u root'`; later runs need no flag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 14:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved documentation issues could cause bootstrap failures on supported host configurations.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates Ansible documentation and the inventory template to stop defaulting connections to root after bootstrap.

Changes:

  • Removes the shipped ansible_user: root.
  • Documents bootstrap with the image’s actual bootstrap account.
  • Clarifies post-bootstrap ansible_user configuration.
File Summary Findings
ansible/​README.md Documents bootstrap and subsequent deployment behavior. Moderate findings: clarify replacing root with the image’s bootstrap user and leaving explicit admin settings unset until after bootstrap. Nit: qualify later runs as occurring after a successful first converge.
ansible/​inventory/​hosts.yml.example Removes the default root user and adds usage guidance. Moderate finding: annotate the bootstrap command with the actual bootstrap user. Nit: mark the explicit admin setting as post-bootstrap.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ansible/README.md Outdated
Comment thread ansible/inventory/hosts.yml.example Outdated
…p user

Also note that a per-host ansible_user must be added only after bootstrap,
since it overrides -u on the first converge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@thiras
thiras merged commit dd64bd9 into main Sep 22, 2026
11 checks passed
@thiras
thiras deleted the docs/drop-default-ansible-user branch September 22, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants