The _Host Provisioner_ is a tool that runs an Anisble playbook to initially provision a new machine. It is intended to run as a Kubernetes Job, created by a webhook that is triggered when the machine boots up for the first time. The tool retrieves information about the new machine (its hostname and SSH host keys) from a message queue, published by the same webhook that launched the job. It then clones the configuration policy (optionally from the branch provided in the host info message) and applies the `site.yml` playbook.
31 lines
578 B
Docker
31 lines
578 B
Docker
FROM registry.fedoraproject.org/fedora-minimal AS build
|
|
|
|
RUN --mount=type=cache,target=/var/cache \
|
|
dnf install -y \
|
|
--setopt persistdir=/var/cache/dnf \
|
|
--setopt install_weak_deps=0 \
|
|
python3 \
|
|
uv \
|
|
&& :
|
|
|
|
WORKDIR /build
|
|
|
|
COPY . .
|
|
|
|
ENV UV_PROJECT_ENVIRONMENT=/app
|
|
ENV UV_CACHE_DIR=/var/cache/uv
|
|
ENV UV_LINK_MODE=copy
|
|
|
|
RUN --mount=type=cache,target=/var/cache \
|
|
uv sync --no-editable --no-dev
|
|
|
|
|
|
FROM git.pyrocufflink.net/containerimages/ansible
|
|
|
|
COPY --from=build /app /app
|
|
|
|
ENV PATH=/app/bin:/usr/bin
|
|
ENV ANSIBLE_STDOUT_CALLBACK=oneline
|
|
|
|
ENTRYPOINT ["hostprovision"]
|