No description
- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
ansible-role-nut
Deploys Network UPS Tools in a rootful Podman container.
The role builds a local UBI-based image by default because an official upstream
runtime image was not identified. The build is pinned with nut_image_tag and
can verify the upstream source archives when nut_source_sha256 and
nut_libusb_source_sha256 are set. The default image is
git.boxcar.sh/containers/nut.
- name: Setup nut
hosts: nut
become: true
roles:
- role: nut
nut_driver: usbhid-ups
nut_shutdown_enabled: false
nut_mattermost_alerts_enabled: true
nut_exporter_enabled: true
Mattermost alerts require these variables, preferably from Vault:
nut_mattermost_server: https://mattermost.example.com
nut_mattermost_channel: channel-id
nut_mattermost_token: token
nut_password: changeme
The exporter listens on nut_exporter_port and exposes /metrics.
Image Build
Manual build from the role template:
mkdir -p /tmp/nut-build
sed \
-e 's#{{ nut_image_base }}#registry.access.redhat.com/ubi9/ubi:latest#g' \
-e 's#{{ nut_image_tag }}#2.8.5#g' \
-e 's#{{ nut_libusb_source_url }}#https://github.com/libusb/libusb/archive/refs/tags/v1.0.27.tar.gz#g' \
-e 's#{{ nut_libusb_source_sha256 }}##g' \
-e 's#{{ nut_source_url }}#https://github.com/networkupstools/nut/archive/refs/tags/v2.8.5.tar.gz#g' \
-e 's#{{ nut_source_sha256 }}##g' \
roles/nut/templates/Containerfile.j2 > /tmp/nut-build/Containerfile
podman build --pull=missing -t git.boxcar.sh/containers/nut:2.8.5 /tmp/nut-build
Push credentials stay on the operator machine:
podman login git.boxcar.sh -u "$BOXCAR_GIT_USER" -p "$BOXCAR_GIT_REGISTRY"
podman push git.boxcar.sh/containers/nut:2.8.5
Role-managed image builds also run on the operator machine:
./run.sh deploy actual --tags=nut,image-build --limit=somehost
./run.sh deploy actual --tags=nut,image-push --limit=somehost -e nut_push_image=true