<div dir="ltr"><div><div><div>Hi Alastair,<br><br></div>Great writeup. We do have a wiki where Cobbler users can share their solutions/experiences<br></div>It would be great if you would be willing to put this information up there: <a href="https://github.com/cobbler/cobbler/wiki">https://github.com/cobbler/cobbler/wiki</a><br>
<br></div>I hope other users will be inspired to do the same :)<br><br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 9, 2014 at 9:39 PM,  <span dir="ltr">&lt;<a href="mailto:alastair@alastair-munro.com" target="_blank">alastair@alastair-munro.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
Just wanted to share something with the list. When creating triggers to say run a &#39;cobbler replicate&#39; via ssh, etc, to remote cobbler servers, the web page waits for the ssh at the remote end to complete. This produced quite a delay if you are say updating a system and waiting for the webpage to refresh. The reason for this is it waits for the ssh to complete, even if you background it or nohup/at/etc it.<br>

<br>
I found a way to daemonize the remote command. Using daemon from here: <a href="http://libslack.org/daemon/" target="_blank">http://libslack.org/daemon/</a>. This daemonizes the ssh command, thus giving an instant response. On centos/rhel 6, just install the rpm.<br>

<br>
The other nice thing about daemon is the --name=something switch; daemon will only allow the command to run if there is not another daemon running with the same name. Thus you could put the same command in cron to run every so often on the slave, to ensure its kept up to date. This means the cron and trigger runs would never clash, or subsequent cron runs would not clash with an earlier run. For example if you add a new distro, the replicate command could take a while to run to rsync across the new distro and the next cron run may run into it.<br>

<br>
>From our setup we have one master and three slaves. In effect one cobbler server per site/data center. This means no installs across wan links and our server builds are always setup with their yum repos in the local site. However we have simple admin; only one cobbler web and a standard config across all servers. Only have to remember to set the server override for systems for the local site cobbler server. We do a mix of pxe and generated.iso builds (both are quite easy)<br>

<br>
# mkdir /usr/local/cobbler<br>
# cd /var/lib/cobbler/triggers/add/<u></u>system/post/<br>
# cat sync-slaves.sh<br>
#!/bin/bash<br>
<br>
# A Munro 6 Aug 2014: sync slaves<br>
# make sure you set up ssh keys for this...<br>
<br>
# space delimited list of slaves<br>
SLAVES=&quot;gb-wat-svv-0600 us-ham-svv-0600 us-lou-svv-0600&quot;<br>
MASTER=cobbler<br>
SSH=&quot;ssh -oConnectTimeout=2 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oBatchMode=yes -oLogLevel=quiet&quot;<br>
LOG=/var/log/cobbler/triggers.<u></u>log<br>
<br>
[ -f $LOG ] &amp;&amp; rm -f $LOG<br>
<br>
for h in $SLAVES<br>
do<br>
#   slow way:background so they are done in parallel<br>
#   however ssh still waits for all the commands to complete<br>
#    $SSH $h &quot;cobbler replicate --master=$MASTER --systems=* --profiles=* --prune&quot; 2&gt;&amp;1 &gt;&gt; $LOG  &amp;<br>
#   using daemon from <a href="http://libslack.org/daemon" target="_blank">http://libslack.org/daemon</a> is fast and instantaneous. The run gets daemonized remotely and returns instantly<br>
    $SSH $h &quot;daemon --name=cob /usr/local/cobbler/sync-<u></u>master.sh&quot; 2&gt;&amp;1 &gt;&gt; $LOG  &amp;<br>
done<br>
<br>
# chmod u+x sync-slaves.sh<br>
<br>
On the slave:<br>
<br>
# cat /usr/local/cobbler/sync-<u></u>master.sh<br>
cobbler replicate --master=cobbler --systems=* --profiles=* --prune<br>
<br>
# chmod u+x /usr/local/cobbler/sync-<u></u>master.sh<br>
<br>
______________________________<u></u>_________________<br>
cobbler mailing list<br>
<a href="mailto:cobbler@lists.fedorahosted.org" target="_blank">cobbler@lists.fedorahosted.org</a><br>
<a href="https://lists.fedorahosted.org/mailman/listinfo/cobbler" target="_blank">https://lists.fedorahosted.<u></u>org/mailman/listinfo/cobbler</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Grtz,<br>Jörgen Maas
</div>