mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 04:06:42 +00:00
The base image postgis/postgis:17-3.5 is Debian 11, whose archive was decommissioned on 2026-08-31. The pgvector layer pulled 174 MB of build toolchain from deb.debian.org, and those pool files are now purged while the index still advertises them: linux-libc-dev 404'd on 44 of 44 attempts across four Fastly POPs. Since 2026-09-07 the suite's InRelease is also expired, so apt-get update itself exits 100. PGDG ships postgresql-17-pgvector prebuilt and its bullseye-pgdg suite is alive, so reading only the pgdg.list the image writes itself removes deb.debian.org from the build entirely. Verified on the exact mirrored base image: the package installs, vector.so lands, zero bytes fetched from deb.debian.org. Signature verification is untouched - no Acquire::Check-Valid-Until. Side effect worth naming: the old recipe cloned pgvector.git with no tag or ref, so every rebuild baked unpinned master into the central RDBMS. It is now pinned at 0.8.6-1.pgdg11+1. The base image is still EOL and its migration remains open. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
"""Resolve postgres-extension library install recipes.
|
|
|
|
Usage:
|
|
{{ lookup('postgres_libraries', ['vector', 'bloom']) }}
|
|
|
|
Takes a list of extension names and returns the subset that needs a
|
|
custom library install on top of the postgis/postgis base image
|
|
(bloom, postgis, pg_trgm, unaccent are already in the base — those are
|
|
filtered out). Each returned entry is a dict with:
|
|
- extension: the extension name (matches the SQL identifier)
|
|
- name: the library/source name (used in the Dockerfile context)
|
|
- apt_package: the PGDG package suffix, installed as
|
|
postgresql-<major>-<apt_package>
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
from ansible.errors import AnsibleError
|
|
from ansible.plugins.lookup import LookupBase
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Sequence
|
|
|
|
|
|
_REGISTRY: dict[str, dict[str, str]] = {
|
|
"vector": {
|
|
"name": "pgvector",
|
|
"apt_package": "pgvector",
|
|
},
|
|
}
|
|
|
|
|
|
class LookupModule(LookupBase):
|
|
def run(
|
|
self,
|
|
terms: Sequence[Any] | None,
|
|
variables: dict[str, Any] | None = None,
|
|
**kwargs: Any,
|
|
) -> list[Any]:
|
|
terms = list(terms or [])
|
|
if len(terms) != 1:
|
|
raise AnsibleError(
|
|
"postgres_libraries: expected exactly one term — a list "
|
|
"of extension names."
|
|
)
|
|
extensions = terms[0]
|
|
if not isinstance(extensions, (list, tuple)):
|
|
raise AnsibleError(
|
|
"postgres_libraries: first term must be a list of extension names."
|
|
)
|
|
|
|
recipes: list[dict[str, str]] = []
|
|
seen: set[str] = set()
|
|
for ext in extensions:
|
|
ext_name = str(ext).strip()
|
|
if not ext_name or ext_name in seen:
|
|
continue
|
|
seen.add(ext_name)
|
|
recipe = _REGISTRY.get(ext_name)
|
|
if recipe is not None:
|
|
recipes.append({"extension": ext_name, **recipe})
|
|
|
|
return [recipes]
|