]> git.phdru.name Git - ansible.git/commitdiff
Feat(init-system.sh): Check if the host was added to inventory
authorOleg Broytman <phd@phdru.name>
Thu, 4 Jun 2026 16:27:11 +0000 (19:27 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 4 Jun 2026 16:27:11 +0000 (19:27 +0300)
playbooks/debian/init-system.sh

index 702c9f34e580a4ceedfe3e9bd184e7994bdaa826..48294ff9f0dfe053a033f480538e0a83a7687e0d 100755 (executable)
@@ -21,6 +21,11 @@ fi
 host="$1"
 shift
 
+if [ \! grep -Fqw "$host" ../hosts ]; then
+   echo "Host $host must be in the default inventory" >&2
+   exit 1
+fi
+
 ssh root@$host exec adduser phd  # Ignore error: may already be created
 # Passwordless access isn't configured yet; use `ssh` connection sharing.
 ssh phd@$host exit &&