[Unit]
Description=Ansipa CheckMK CE integration setup (one-time, after IPA + CMK are up)
# Wants to run after IPA is configured; however ipa-first-boot.service only runs
# once (ConditionPathExists=!/etc/ipa/default.conf) and takes up to 10 minutes.
# The script checks for /etc/ipa/default.conf itself and exits 1 when not ready,
# causing Restart=on-failure to retry until both IPA and CheckMK are available.
After=network.target docker-env.service
Wants=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/ansipa-checkmk-setup.sh
StandardOutput=journal
StandardError=journal
# Retry until IPA first-boot and CheckMK container are both ready.
Restart=on-failure
RestartSec=30s
# Stop retrying once the done-flag file appears (script exits 0).
# RemainAfterExit ensures the unit stays 'active' after successful exit.
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
