Files
config-public/ansible/playbooks/stackctl.yml
T
Lucas WintherandClaude Opus 5.5 ecf63a62a2
lint / yamllint + ansible-lint + syntax (push) Successful in 40s
lint / shellcheck (push) Successful in 8s
lint / secret scan (push) Successful in 3s
Write a README into /srv/stacks, and an adoption checklist
The README says what the directory is, links repo_url as the source of truth,
and covers deploying, stackctl and OpenBao. stackctl.yml refuses to run while
repo_url is a placeholder; AGENTS.md gains "Adopting this repository".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:59:47 +02:00

60 lines
2.3 KiB
YAML

---
# stackctl, each host's groups for it, and a README, into the stack root. Not a
# Compose stack: three files and no `docker compose up`, so plain tasks rather
# than the role, as with banner.yml.
#
# The script is one file shared by every host, under server/shared/components/.
# The groups are per host, at server/<host>/stack-groups, because each host runs
# different stacks; a host without one still gets the script, and "all" and
# stack names work there without any groups. See "On the host: stackctl" in the
# README.
#
# The README is for whoever logs in to the host: what the directory is, that the
# repository at repo_url is the source of truth, how to deploy, and stackctl.
# It is a template, which payloads never are, because it is not a payload: it
# names the host and the repository. Nothing in it changes between runs, so a
# second run still reports no changes.
- name: Install stackctl
hosts:
- edge
- app
gather_facts: false
tags: [stackctl]
vars:
stackctl_src: "{{ repo_root }}/server/shared/components/stackctl"
stackctl_groups_src: "{{ repo_root }}/server/{{ inventory_hostname }}/stack-groups"
tasks:
# A README sending people to git.example.com is worse than none: it names a
# source of truth that does not exist. Fail until repo_url is real.
- name: Verify repo_url points at your repository
ansible.builtin.assert:
that:
- "'example.com' not in repo_url"
fail_msg: >-
repo_url in inventory/group_vars/all.yml is still the placeholder
{{ repo_url }}. Set it to where your copy of this repository lives —
see "Adopting this repository" in AGENTS.md.
quiet: true
- name: Install the stackctl script
ansible.builtin.copy:
src: "{{ stackctl_src }}"
dest: "{{ stack_root }}/stackctl"
mode: "0755"
# `is file` is evaluated on the control node, where the repository is.
- name: Install this host's stack groups
ansible.builtin.copy:
src: "{{ stackctl_groups_src }}"
dest: "{{ stack_root }}/stack-groups"
mode: "0644"
when: stackctl_groups_src is file
- name: Install the README for the stack root
ansible.builtin.template:
src: stacks-README.md.j2
dest: "{{ stack_root }}/README.md"
mode: "0644"