Files
todo-hetzner/ansible/playbooks/deploy-app.yml
T
cole-maxwell1 1382c42803 feat: add Hetzner-hosted todo application stack
Implement the server-rendered Go todo application with PostgreSQL persistence, Tailwind styling, health checks, and test coverage.

Provision production and staging infrastructure with OpenTofu, including private networking, static IPs, Object Storage backups, and load balancing.

Configure Rocky Linux hosts with Ansible, rootless Podman, PostgreSQL, WAL-G backup automation, staging restores, and generated inventory.
2026-08-06 21:34:56 -05:00

44 lines
1.2 KiB
YAML

---
- name: Deploy todo application
hosts: all
become: true
roles:
- app
tasks:
- name: Pull application image
ansible.builtin.command:
argv:
- podman
- pull
- "{{ app_image }}"
become_user: "{{ app_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
register: app_pull
changed_when: "'Copying blob' in app_pull.stdout or 'Writing manifest' in app_pull.stdout"
- name: Reload application user services
ansible.builtin.command:
argv: [systemctl, --user, daemon-reload]
become_user: "{{ app_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
changed_when: false
- name: Restart application
ansible.builtin.command:
argv: [systemctl, --user, restart, app-todo.service]
become_user: "{{ app_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
changed_when: true
- name: Wait for application health endpoint
ansible.builtin.uri:
url: "http://127.0.0.1:{{ app_port }}/healthz"
status_code: 200
register: app_health
retries: 12
delay: 2
until: app_health.status == 200