feat: deploy with Ansible and infra roles #4

Open
aleksei wants to merge 3 commits from feat/ansible-deploy into main
Owner

Summary

Restructured the Ansible deployment around the conventions and shared roles from
zoo/infra.

  • playbooks/frame.yaml clones/updates zoo/infra on the controller and
    includes its shared docker role.
  • roles/frame_crack remains a local app role and only handles the single
    Compose application: source sync, compose.yaml, build/start and health check.
  • Host settings moved to inventory.ini and host_vars/frame.yaml, following
    the infra host layout.
  • The deployment remains idempotent via
    /opt/frame_crack/.source_checksum; unchanged runs do not sync, rebuild or
    restart the container.
  • requirements.yaml installs the ansible.posix collection used by
    synchronize.

Why the infra repo is cloned instead of installed as a role

ansible-galaxy can install a git role only when the role is at the repository
root. The infra roles are in the roles/ subdirectory of a monorepo, so a
normal requirements.yaml roles: entry cannot install them. The playbook
clones the repo with the built-in git module and ansible.cfg adds
vendor/infra/roles to roles_path. The shared role is then used exactly as if
it had been installed by Galaxy.

Layout

ansible/
  ansible.cfg
  inventory.ini
  host_vars/frame.yaml
  playbooks/frame.yaml
  requirements.yaml
  roles/frame_crack/
    defaults/main.yaml
    files/source_checksum.py
    tasks/main.yaml
    templates/compose.yaml.j2

Usage

cd ansible
ansible-galaxy collection install -r requirements.yaml
$EDITOR inventory.ini host_vars/frame.yaml
ansible-playbook playbooks/frame.yaml

Validation

  • ansible-playbook --syntax-check passes.
  • ansible-lint passes with the production profile.
  • End-to-end run against a local target: the infra docker role is included,
    the app is installed in /opt/frame_crack, the container responds with
    HTTP 200.
  • Second end-to-end run reports changed=0.
## Summary Restructured the Ansible deployment around the conventions and shared roles from [`zoo/infra`](https://git.kosyrev.name/zoo/infra). - `playbooks/frame.yaml` clones/updates `zoo/infra` on the controller and includes its shared `docker` role. - `roles/frame_crack` remains a local app role and only handles the single Compose application: source sync, `compose.yaml`, build/start and health check. - Host settings moved to `inventory.ini` and `host_vars/frame.yaml`, following the infra host layout. - The deployment remains idempotent via `/opt/frame_crack/.source_checksum`; unchanged runs do not sync, rebuild or restart the container. - `requirements.yaml` installs the `ansible.posix` collection used by `synchronize`. ## Why the infra repo is cloned instead of installed as a role `ansible-galaxy` can install a git role only when the role is at the repository root. The infra roles are in the `roles/` subdirectory of a monorepo, so a normal `requirements.yaml` `roles:` entry cannot install them. The playbook clones the repo with the built-in `git` module and `ansible.cfg` adds `vendor/infra/roles` to `roles_path`. The shared role is then used exactly as if it had been installed by Galaxy. ## Layout ```text ansible/ ansible.cfg inventory.ini host_vars/frame.yaml playbooks/frame.yaml requirements.yaml roles/frame_crack/ defaults/main.yaml files/source_checksum.py tasks/main.yaml templates/compose.yaml.j2 ``` ## Usage ```bash cd ansible ansible-galaxy collection install -r requirements.yaml $EDITOR inventory.ini host_vars/frame.yaml ansible-playbook playbooks/frame.yaml ``` ## Validation - `ansible-playbook --syntax-check` passes. - `ansible-lint` passes with the `production` profile. - End-to-end run against a local target: the infra `docker` role is included, the app is installed in `/opt/frame_crack`, the container responds with HTTP 200. - Second end-to-end run reports `changed=0`.
Add a dependency-light Ansible role that installs Docker on Debian/Ubuntu, syncs the app to /opt/frame_crack, renders a compose.yaml and runs the container. Include a Dockerfile, checksum-based idempotency, a health check and an English deployment guide.
Restructure the Ansible deployment around the zoo/infra conventions: clone the infra repo on the controller, use its docker role, add the frame_crack role only for the compose app, and move host settings to inventory.ini and host_vars/frame.yaml. Keep the checksum-based idempotent deploy and HTTP health check.
aleksei changed title from feat: add Ansible deployment to feat: deploy with Ansible and infra roles 2026-10-23 16:15:52 +00:00
Use the lowercase filename requested for the container build and update the Compose template, deploy checksum and Ansible README references.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/ansible-deploy:feat/ansible-deploy
git switch feat/ansible-deploy

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feat/ansible-deploy
git switch feat/ansible-deploy
git rebase main
git switch main
git merge --ff-only feat/ansible-deploy
git switch feat/ansible-deploy
git rebase main
git switch main
git merge --no-ff feat/ansible-deploy
git switch main
git merge --squash feat/ansible-deploy
git switch main
git merge --ff-only feat/ansible-deploy
git switch main
git merge feat/ansible-deploy
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/frame-crack!4
No description provided.