7.1 KiB
AGENTS.md
Guidance for agentic coding tools working in this repository. Project type: Ansible-based infrastructure and user dotfiles.
Repository snapshot
- Entry playbook:
ansible/site.yml - Inventory:
ansible/inventory/hosts.yml - Group vars:
ansible/inventory/group_vars/*.yml - Host vars:
ansible/inventory/host_vars/*.yml - Templates:
ansible/templates/**/*.j2 - Dotfiles source of truth:
dotfiles/ - Utility scripts:
scripts/ - Sensitive material/examples:
secrets/
Active orchestration
ansible/site.yml currently applies:
all -> dotfiles_commonvoid -> packages_void, services_runit, profile_desktop_i3ubuntu_workstation -> packages_ubuntu, services_systemd, profile_workstation_gnomeubuntu_server -> packages_ubuntu, services_systemd, profile_server
Active roles:
dotfiles_common,packages_void,services_runit,profile_desktop_i3,packages_ubuntu,services_systemd,profile_workstation_gnome,profile_server
Roles present but not wired into ansible/site.yml:
basedotfiles
Local instruction files
Checked in this repository when this file was written:
.cursorrules: not present.cursor/rules/: not present.github/copilot-instructions.md: not present If any of these appear later, treat them as higher-priority local instructions.
Working assumptions
- Favor idempotent, host-safe changes over cleverness.
- Preserve the layering:
all -> OS -> profile -> host. - Validate on one host before broad rollout.
- Prefer minimal, targeted edits over cleanup refactors.
- Treat
secrets/as sensitive and avoid exposing values. dotfiles/common/.tmux/plugins/contains vendored upstream code.
Build, lint, and test commands
There is no compile/build step. Validation is based on syntax checks, inventory inspection, dry-runs, and linting.
Install tooling if needed:
python3 -m pip install ansible
ansible-galaxy collection install community.general
Linting and static checks if available locally:
ansible-lint ansible/site.yml
ansible-lint ansible/roles
yamllint ansible/
sh -n scripts/bootstrap_mail.sh
shellcheck scripts/bootstrap_mail.sh
Single-test equivalents
There is no Molecule, pytest, or dedicated unit-test suite. Use the narrowest validation that matches the change.
Fastest confidence check:
ansible-playbook ansible/site.yml --syntax-check
Best default dry-runs:
ansible-playbook ansible/site.yml --limit ikaros --check --diff
ansible-playbook ansible/site.yml --limit deadalus --check --diff
ansible-playbook ansible/site.yml --limit prometheus --check --diff
Testing notes:
- Prefer
--limitaggressively to avoid accidental multi-host rollout. - Prefer
--check --diffbefore package, service, PAM, bootloader, firewall, or session changes. - Keep task names stable and unique enough for
--start-at-task. - If you change only vars, inventory inspection may be the quickest useful check.
Code style guidelines
General principles
- Keep orchestration in playbooks and implementation details in roles.
- Prefer declarative modules over imperative commands.
- Avoid unrelated refactors while solving a targeted task.
- Preserve idempotency and make state transitions explicit.
Ansible modules and task structure
- Use FQCN module names such as
ansible.builtin.copyandcommunity.general.ufw. - Prefer purpose-built modules over
ansible.builtin.commandoransible.builtin.shell. - Use
commandonly when no good module exists; useshellonly when shell features are required. - When using
commandorshell, setchanged_whenandfailed_whenwhen defaults are misleading. - Keep task names imperative, outcome-based, and unique enough for
--start-at-task. - Tag every task consistently with its execution flow, typically
packages,services,dotfiles,gnome,nvidia, ordotfiles:*. - Prefer
loopwith clearloop_control.labelfor user-facing collections.
YAML formatting
- Start YAML files with
---. - Use 2-space indentation and never tabs.
- Keep keys, lists, and maps in stable order.
- Quote file modes as strings:
"0644","0755","0600","0700". - Avoid formatting-only churn in untouched sections.
Variables, types, and naming
- Use
snake_caseconsistently for variables and facts. - Follow existing families such as
common_packages,profile_packages,host_packages,common_dotfiles,workstation_dotfiles,server_dotfiles, andhost_dotfiles. - Keep booleans as booleans, not quoted strings.
- Keep structured data as YAML collections, not comma-separated strings.
- Guard optional collections/maps with
default([])anddefault({}). - Guard optional strings with
default(''). - Build user paths from
{{ user_home }}instead of hardcoding home directories. - Host-specific overrides belong in
host_vars, not shared group files.
Error handling and safety
- Guard OS-specific or profile-specific behavior with
whenclauses. - Prefer explicit inputs over assumptions about host state.
- Use
failed_when: falseonly for intentional probes or best-effort detection. - Use
no_log: truefor secrets, passwords, and sensitive command results. - Keep tasks non-interactive and automation-safe.
- Avoid destructive operations in user homes unless clearly required.
- Fail early with
ansible.builtin.failwhen prerequisites such as architecture, release metadata, or session bus data are missing. - For firewall changes, allow required access before enabling the firewall.
Shell, scripts, and external code
- Prefer POSIX
shfor simple scripts; use Bash only when Bash features are required. - Quote variable expansions unless intentional word splitting is required.
- Preserve executable bits for deployed scripts where appropriate.
- If you add Python later, follow standard-library, third-party, local import grouping.
- Treat vendored tmux plugins as upstream code unless the task explicitly targets them.
Editing guidance by area
ansible/site.yml: keep it small and orchestration-focused.ansible/inventory/group_vars/*.yml: shared defaults by layer.ansible/inventory/host_vars/*.yml: host-specific overrides only.ansible/roles/*/tasks/main.yml: role implementation details.ansible/templates/**/*.j2: keep secrets and host-specific values parameterized.dotfiles/: user-facing config and session scripts deployed by roles.scripts/: standalone local utilities; keep them safe to run manually.
Validation expectations before finishing
Run the narrowest useful checks for the area you changed.
Default minimum:
ansible-playbook ansible/site.yml --syntax-check
Preferred for role, template, or vars changes:
ansible-playbook ansible/site.yml --limit <host> --check --diff
Agent workflow expectations
- Read the relevant inventory, vars, role tasks, templates, and deployed dotfiles before editing.
- Do not change unrelated files to "clean things up".
- Keep
README.mdandAGENTS.mdaligned when workflows materially change. - If you add a new operational area, also add the validation command agents should run.
- Prefer host-limited validation before broad apply.
- Call out any verification you could not run.