mirror of
https://scm.tikali.ai/tikali/applications/monky/monky-deployd.git
synced 2026-09-18 04:36:15 +00:00
feat(install): read-only deploy token for the private package registry (v0.1.2)
The GitLab project is private (its parent groups are private, so it cannot be made public): the v0.1.1 one-liner answered 401 anonymously. install.sh gains --token / MONKY_DEPLOYD_TOKEN and sends `DEPLOY-TOKEN: <token>` (a GitLab deploy token, scope read_package_registry only, revocable) on every registry download, the script itself included; the token goes through a 0600 curl -K file (never the command line, the log or an xtrace). The grant is taken via --bootstrap-file when the script is piped (stdin IS the script). Ansible: monky_deployd_download_token (vaulted) -> DEPLOY-TOKEN header, no_log. Docs explain why, the token's scope and the --source gitea alternative (split-horizon Gitea, cbs/iac#102). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KLB7jieMNRkTsJ2epr4Ds1
This commit is contained in:
@@ -4,7 +4,9 @@ Installs and configures [monky-deployd](https://scm.tikali.ai/tikali/application
|
||||
(the Monky backend pull agent, MONKY-ADR-0028) on a docker host that already carries an enrolled
|
||||
host identity (`roles/ziti_tunneler`, run-host mode). Skeleton for **osg1-07**; copy it there.
|
||||
|
||||
What it does: pin + download the `.deb` from the scm.tikali.ai package registry (sha256 verified; `monky_deployd_base_url`/`_deb_url` switch to the Gitea release off-estate) → ACL
|
||||
What it does: pin + download the `.deb` from the scm.tikali.ai package registry (sha256 verified; the
|
||||
project is **private**, so the fetches send the read-only deploy token `monky_deployd_download_token`
|
||||
as `DEPLOY-TOKEN`, `no_log`; `monky_deployd_base_url`/`_deb_url` switch to the Gitea release off-estate) → ACL
|
||||
`u:monky-deployd:r` on the identity (`rx` on the dir) → `/etc/monky-deployd/config.yaml` from the
|
||||
template → optional openbao-ca PEM → optional `monky-deployd-proxy.service` (`transport: proxy`)
|
||||
→ the **one-time bootstrap deploy grant** from a vault var (0600, `no_log`) → `monky-deployd.timer`
|
||||
@@ -14,7 +16,8 @@ template → optional openbao-ca PEM → optional `monky-deployd-proxy.service`
|
||||
|
||||
| var | note |
|
||||
|---|---|
|
||||
| `monky_deployd_version` | pinned release, e.g. `0.1.1` |
|
||||
| `monky_deployd_version` | pinned release, e.g. `0.1.2` |
|
||||
| `monky_deployd_download_token` | **vaulted**: GitLab deploy token, scope `read_package_registry` only (revocable) — the registry is private; seeded in OpenBao at `monky/monky-tenancy/deployd-download` key `token` (path/key are the operator's choice). Empty = no header (only works with the Gitea `base_url`) |
|
||||
| `monky_deployd_env_id` / `_site` / `_transport` | per host (`env-dev-06`, `cbs`, `sdk`) |
|
||||
| `monky_deployd_bootstrap_grant` | tenancy-minted deploy grant (1 h) — `ansible-vault` or a lookup at play time; empty keeps the existing token |
|
||||
| `monky_deployd_bao_ca_pem` | the `openbao-ca` certificate (PEM) |
|
||||
@@ -30,6 +33,7 @@ template → optional openbao-ca PEM → optional `monky-deployd-proxy.service`
|
||||
- role: monky_deployd
|
||||
vars:
|
||||
monky_deployd_bootstrap_grant: "{{ lookup('pipe', 'tenancy-mint-grant ' ~ inventory_hostname) }}"
|
||||
monky_deployd_download_token: "{{ vault_monky_deployd_download_token }}" # ansible-vault / OpenBao lookup
|
||||
```
|
||||
|
||||
Rollout order (plan §E): pilot env-qa-02 → env-dev-06..09 → env-dev-01 last (after its live key moves into Bao).
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
---
|
||||
# monky_deployd — install and configure the Monky backend pull agent (MONKY-ADR-0028 §D).
|
||||
# Copy this role into osg1-07 (roles/monky_deployd) and roll to env-dev-06..09 after the pilot.
|
||||
monky_deployd_version: "0.1.1"
|
||||
monky_deployd_version: "0.1.2"
|
||||
monky_deployd_deb: "monky-deployd_{{ monky_deployd_version }}_amd64.deb"
|
||||
# PRIMARY download = the public GitLab project's generic package registry on scm.tikali.ai. Inside the
|
||||
# estate gitea.cbs.tikali.net is split-horizon to jump1's RED EIP (10.10.0.175, no HTTP ingress), so
|
||||
# backend boxes cannot fetch from the Gitea mirror (cbs/iac#102). Off-estate alternative (Gitea release):
|
||||
# PRIMARY download = the GitLab project's generic package registry on scm.tikali.ai. Inside the estate
|
||||
# gitea.cbs.tikali.net is split-horizon to jump1's RED EIP (10.10.0.175, no HTTP ingress), so backend
|
||||
# boxes cannot fetch from the Gitea mirror (cbs/iac#102). The project is PRIVATE (its parent groups are
|
||||
# private), so the registry needs a read-only GitLab deploy token (scope read_package_registry only,
|
||||
# revocable) sent as the `DEPLOY-TOKEN` header — `monky_deployd_download_token`, a VAULTED var
|
||||
# (ansible-vault or an OpenBao lookup: KV `monky/monky-tenancy/deployd-download`, key `token`).
|
||||
# Off-estate alternative (Gitea release, no token):
|
||||
# monky_deployd_base_url: "https://gitea.cbs.tikali.net/mdella/monky-deployd"
|
||||
# monky_deployd_deb_url: "{{ monky_deployd_base_url }}/releases/download/v{{ monky_deployd_version }}/{{ monky_deployd_deb }}"
|
||||
# monky_deployd_download_token: ""
|
||||
monky_deployd_base_url: "https://scm.tikali.ai/api/v4/projects/69/packages/generic/monky-deployd"
|
||||
monky_deployd_deb_url: "{{ monky_deployd_base_url }}/{{ monky_deployd_version }}/{{ monky_deployd_deb }}"
|
||||
monky_deployd_deb_sha256_url: "{{ monky_deployd_deb_url }}.sha256"
|
||||
monky_deployd_download_token: ""
|
||||
# the header the download tasks send (empty map when no token)
|
||||
monky_deployd_download_headers: "{{ {'DEPLOY-TOKEN': monky_deployd_download_token} if monky_deployd_download_token | length > 0 else {} }}"
|
||||
|
||||
# per host (inventory / host_vars)
|
||||
monky_deployd_env_id: "{{ inventory_hostname }}" # env-dev-06 ...
|
||||
|
||||
@@ -22,20 +22,26 @@
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
# The registry is PRIVATE: both fetches send `DEPLOY-TOKEN: {{ monky_deployd_download_token }}`
|
||||
# (read_package_registry only) and run no_log so the header never reaches the play output.
|
||||
- name: monky_deployd | download .deb + sha256 from the scm.tikali.ai package registry
|
||||
when: monky_deployd_installed.stdout != monky_deployd_version
|
||||
block:
|
||||
- name: monky_deployd | fetch sha256
|
||||
ansible.builtin.uri:
|
||||
url: "{{ monky_deployd_deb_sha256_url }}"
|
||||
headers: "{{ monky_deployd_download_headers }}"
|
||||
return_content: true
|
||||
register: monky_deployd_sha
|
||||
no_log: true
|
||||
- name: monky_deployd | fetch .deb (checksum verified)
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ monky_deployd_deb_url }}"
|
||||
headers: "{{ monky_deployd_download_headers }}"
|
||||
dest: "/var/cache/apt/archives/{{ monky_deployd_deb }}"
|
||||
checksum: "sha256:{{ monky_deployd_sha.content.split()[0] }}"
|
||||
mode: "0644"
|
||||
no_log: true
|
||||
- name: monky_deployd | install .deb
|
||||
ansible.builtin.apt:
|
||||
deb: "/var/cache/apt/archives/{{ monky_deployd_deb }}"
|
||||
|
||||
Reference in New Issue
Block a user