From b6581a9e1f6a093700d5beb164780ca5356b4a7c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 4 May 2015 10:54:16 -0600 Subject: [PATCH] Add a snippet to write an /etc/rc.local The /etc/rc.local causes the post-install trigger to be run a second time, then touches a special file so it doesn't run on every reboot. Signed-off-by: Zack Cerza --- roles/cobbler/defaults/main.yml | 1 + .../templates/snippets/cephlab_rc_local | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 roles/cobbler/templates/snippets/cephlab_rc_local diff --git a/roles/cobbler/defaults/main.yml b/roles/cobbler/defaults/main.yml index d03871b..7fd8f55 100644 --- a/roles/cobbler/defaults/main.yml +++ b/roles/cobbler/defaults/main.yml @@ -8,6 +8,7 @@ snippets: - cephlab_hostname - cephlab_apt-mirror_hack - cephlab_packages_rhel + - cephlab_rc_local scripts: - cephlab_preseed_late diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local new file mode 100644 index 0000000..80e4d2e --- /dev/null +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -0,0 +1,24 @@ +## {{ ansible_managed }} +#set lockfile = '/.cephlab_rc_local' +#set script = '/etc/rc.local' + +cat > $script << EOF +#!/bin/bash +# First, redirect stderr and stdout to a logfile +exec 2> /tmp/rc.local.log +exec 1>&2 +set -ex + +# Only run once. +if [ -e $lockfile ]; then + exit 0 +fi + +# Wait just a bit for the network to come up +sleep 15 +# Run the post-install trigger a second time +wget -O /dev/null "http://$http_server:$http_port/cblr/svc/op/trig/mode/post/system/$system_name" +touch $lockfile +EOF + +chmod +x $script -- 2.39.5