From: Kristof Provost Date: Wed, 12 Jul 2023 11:06:24 +0000 (+0200) Subject: image: improve ansibleprep run X-Git-Url: https://git.sigsegv.be/?a=commitdiff_plain;h=cdf66d507d77ac1deabe960c1b7a3326a508df1e;p=pennestraat-domotica image: improve ansibleprep run Make it more likely we'll call ansible-poll at first boot. If there's no internet connectivity on first boot we woudln't ansible- poll until the crontab called it. Instead we now run ansibleprep every time and exit if our hostname isn't poudriere-image (i.e. if we've actually run the first ansible- poll call). --- diff --git a/image/overlay/domotica/etc/rc.d/ansibleprep b/image/overlay/domotica/etc/rc.d/ansibleprep index 9d557b2..e778aba 100755 --- a/image/overlay/domotica/etc/rc.d/ansibleprep +++ b/image/overlay/domotica/etc/rc.d/ansibleprep @@ -4,7 +4,6 @@ # PROVIDE: ansibleprep # REQUIRE: DAEMON # BEFORE: LOGIN -# KEYWORD: firstboot . /etc/rc.subr @@ -13,6 +12,14 @@ start_cmd="ansibleprep_start" ansibleprep_start() { + # Only do this until we've set the hostname, which we use as a proxy for + # 'initial config done, reverse ssh tunnel ready' + # We do do a daily poll, so worst case it'll eventually work out. + if [ $(hostname) != "poudriere-image" ]; + then + exit 0 + fi + export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin # Just enough so kp can log in