[cobbler] How to speed up triggers

2014-08-09 Thread alastair

Hi

Just wanted to share something with the list. When creating triggers to 
say run a 'cobbler replicate' 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.


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


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.


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)


# mkdir /usr/local/cobbler
# cd /var/lib/cobbler/triggers/add/system/post/
# cat sync-slaves.sh
#!/bin/bash

# A Munro 6 Aug 2014: sync slaves
# make sure you set up ssh keys for this...

# space delimited list of slaves
SLAVES=gb-wat-svv-0600 us-ham-svv-0600 us-lou-svv-0600
MASTER=cobbler
SSH=ssh -oConnectTimeout=2 -oStrictHostKeyChecking=no 
-oUserKnownHostsFile=/dev/null -oBatchMode=yes -oLogLevel=quiet

LOG=/var/log/cobbler/triggers.log

[ -f $LOG ]  rm -f $LOG

for h in $SLAVES
do
#   slow way:background so they are done in parallel
#   however ssh still waits for all the commands to complete
#$SSH $h cobbler replicate --master=$MASTER --systems=* 
--profiles=* --prune 21  $LOG  
#   using daemon from http://libslack.org/daemon is fast and 
instantaneous. The run gets daemonized remotely and returns instantly
$SSH $h daemon --name=cob /usr/local/cobbler/sync-master.sh 21 
 $LOG  

done

# chmod u+x sync-slaves.sh

On the slave:

# cat /usr/local/cobbler/sync-master.sh
cobbler replicate --master=cobbler --systems=* --profiles=* --prune

# chmod u+x /usr/local/cobbler/sync-master.sh

___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


[cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread Dhanasekaran Anbalagan
Hi Guys,

Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

It's says *ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api
http://127.0.0.1:80/cobbler_api: 404 Not Found*

I verified /var/www/cobbler_api I don't see any folder

I tested same version with ubuntu 14.04 also not working

root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
Selecting previously unselected package cobbler.
(Reading database ... 229802 files and directories currently installed.)
Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
Setting up cobbler (2.6.4-1) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
root@dhana:~# /etc/init.d/cobblerd start
Starting cobbler daemon: already started
root@dhana:~# cobbler --version
httpd does not appear to be running and proxying cobbler, or SELinux is in
the way. Original traceback:
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
check_setup
s.ping()
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
return self.single_request(host, handler, request_body, verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
response.msg,
ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not Found
root@dhana:~#

Please guide me, How to fix this.

-Dhanasekaran

Did I learn something today? If not, I wasted it.
___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Re: [cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread Alastair Munro
Is apache started? Suggest you see whether you can connect to the url?

--
Alastair Munro

-Original Message-
From: Dhanasekaran Anbalagan bugcy...@gmail.com
To: cobbler@lists.fedorahosted.org
Sent: Sun, 10 Aug 2014 0:51
Subject: [cobbler] Issue with 2.6.4-1 cobbler

Hi Guys,

Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

It's says *ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api
http://127.0.0.1:80/cobbler_api: 404 Not Found*

I verified /var/www/cobbler_api I don't see any folder

I tested same version with ubuntu 14.04 also not working

root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
Selecting previously unselected package cobbler.
(Reading database ... 229802 files and directories currently installed.)
Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
Setting up cobbler (2.6.4-1) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
root@dhana:~# /etc/init.d/cobblerd start
Starting cobbler daemon: already started
root@dhana:~# cobbler --version
httpd does not appear to be running and proxying cobbler, or SELinux is in
the way. Original traceback:
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
check_setup
s.ping()
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
return self.single_request(host, handler, request_body, verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
response.msg,
ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not Found
root@dhana:~#

Please guide me, How to fix this.

-Dhanasekaran

Did I learn something today? If not, I wasted it.
___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Re: [cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread Dhanasekaran Anbalagan
Hi,

apache already running, I able to telnet 80 port,

root@dhana:~# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
^]
telnet quit
Connection closed.
root@dhana:~# /etc/init.d/apache2 status
Apache2 is running (pid 11322).
root@dhana:~#


Note :: cobbler_api folder not there in /var/www location



Did I learn something today? If not, I wasted it.


On Sun, Aug 10, 2014 at 5:41 AM, Alastair Munro alast...@alastair-munro.com
 wrote:

 Is apache started? Suggest you see whether you can connect to the url?

 --
 Alastair Munro


 -Original Message-
 From: Dhanasekaran Anbalagan bugcy...@gmail.com
 To: cobbler@lists.fedorahosted.org
 Sent: Sun, 10 Aug 2014 0:51
 Subject: [cobbler] Issue with 2.6.4-1 cobbler

 Hi Guys,

 Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

 It's says *ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api
 http://127.0.0.1:80/cobbler_api: 404 Not Found*

 I verified /var/www/cobbler_api I don't see any folder

 I tested same version with ubuntu 14.04 also not working

 root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
 Selecting previously unselected package cobbler.
 (Reading database ... 229802 files and directories currently installed.)
 Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
 Setting up cobbler (2.6.4-1) ...
 Processing triggers for man-db ...
 Processing triggers for ureadahead ...
 root@dhana:~# /etc/init.d/cobblerd start
 Starting cobbler daemon: already started
 root@dhana:~# cobbler --version
 httpd does not appear to be running and proxying cobbler, or SELinux is in
 the way. Original traceback:
 Traceback (most recent call last):
   File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
 check_setup
 s.ping()
   File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
 return self.__send(self.__name, args)
   File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
 verbose=self.__verbose
   File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
 return self.single_request(host, handler, request_body, verbose)
   File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
 response.msg,
 ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not Found
 root@dhana:~#

 Please guide me, How to fix this.

 -Dhanasekaran

 Did I learn something today? If not, I wasted it.

 ___
 cobbler mailing list
 cobbler@lists.fedorahosted.org
 https://lists.fedorahosted.org/mailman/listinfo/cobbler


___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Re: [cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread Alastair Munro
Doesn't 'cobbler check' tell you to set server and next_server to something 
other than 127.0.0.1?

--
Alastair Munro

-Original Message-
From: Dhanasekaran Anbalagan bugcy...@gmail.com
To: cobbler mailing list cobbler@lists.fedorahosted.org
Sent: Sun, 10 Aug 2014 1:24
Subject: Re: [cobbler] Issue with 2.6.4-1 cobbler

Hi,

apache already running, I able to telnet 80 port,

root@dhana:~# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
^]
telnet quit
Connection closed.
root@dhana:~# /etc/init.d/apache2 status
Apache2 is running (pid 11322).
root@dhana:~#


Note :: cobbler_api folder not there in /var/www location



Did I learn something today? If not, I wasted it.


On Sun, Aug 10, 2014 at 5:41 AM, Alastair Munro alast...@alastair-munro.com
 wrote:

 Is apache started? Suggest you see whether you can connect to the url?

 --
 Alastair Munro


 -Original Message-
 From: Dhanasekaran Anbalagan bugcy...@gmail.com
 To: cobbler@lists.fedorahosted.org
 Sent: Sun, 10 Aug 2014 0:51
 Subject: [cobbler] Issue with 2.6.4-1 cobbler

 Hi Guys,

 Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

 It's says *ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api
 http://127.0.0.1:80/cobbler_api: 404 Not Found*

 I verified /var/www/cobbler_api I don't see any folder

 I tested same version with ubuntu 14.04 also not working

 root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
 Selecting previously unselected package cobbler.
 (Reading database ... 229802 files and directories currently installed.)
 Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
 Setting up cobbler (2.6.4-1) ...
 Processing triggers for man-db ...
 Processing triggers for ureadahead ...
 root@dhana:~# /etc/init.d/cobblerd start
 Starting cobbler daemon: already started
 root@dhana:~# cobbler --version
 httpd does not appear to be running and proxying cobbler, or SELinux is in
 the way. Original traceback:
 Traceback (most recent call last):
   File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
 check_setup
 s.ping()
   File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
 return self.__send(self.__name, args)
   File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
 verbose=self.__verbose
   File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
 return self.single_request(host, handler, request_body, verbose)
   File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
 response.msg,
 ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not Found
 root@dhana:~#

 Please guide me, How to fix this.

 -Dhanasekaran

 Did I learn something today? If not, I wasted it.

 ___
 cobbler mailing list
 cobbler@lists.fedorahosted.org
 https://lists.fedorahosted.org/mailman/listinfo/cobbler


___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Re: [cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread Dhanasekaran Anbalagan
Hi Alastair,

I am getting same Error, when I try to execute cobbler check,

root@dhana:~# cat /etc/cobbler/settings|grep next_server
next_server: 127.0.0.1
root@dhana:~#  cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux is in
the way. Original traceback:
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
check_setup
s.ping()
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
return self.single_request(host, handler, request_body, verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
response.msg,
ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not Found
root@dhana:~#

:~# cat /etc/hosts
127.0.0.1 localhost



Did I learn something today? If not, I wasted it.


On Sun, Aug 10, 2014 at 5:58 AM, Alastair Munro alast...@alastair-munro.com
 wrote:

 Doesn't 'cobbler check' tell you to set server and next_server to
 something other than 127.0.0.1?


 --
 Alastair Munro

 -Original Message-
 From: Dhanasekaran Anbalagan bugcy...@gmail.com
 To: cobbler mailing list cobbler@lists.fedorahosted.org
 Sent: Sun, 10 Aug 2014 1:24
 Subject: Re: [cobbler] Issue with 2.6.4-1 cobbler

 Hi,

 apache already running, I able to telnet 80 port,

 root@dhana:~# telnet 127.0.0.1 80
 Trying 127.0.0.1...
 Connected to localhost (127.0.0.1).
 Escape character is '^]'.
 ^]
 telnet quit
 Connection closed.
 root@dhana:~# /etc/init.d/apache2 status
 Apache2 is running (pid 11322).
 root@dhana:~#


 Note :: cobbler_api folder not there in /var/www location



 Did I learn something today? If not, I wasted it.


 On Sun, Aug 10, 2014 at 5:41 AM, Alastair Munro 
 alast...@alastair-munro.com wrote:

 Is apache started? Suggest you see whether you can connect to the url?

 --
 Alastair Munro


 -Original Message-
 From: Dhanasekaran Anbalagan bugcy...@gmail.com
 To: cobbler@lists.fedorahosted.org
 Sent: Sun, 10 Aug 2014 0:51
 Subject: [cobbler] Issue with 2.6.4-1 cobbler

 Hi Guys,

 Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

 It's says *ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api
 http://127.0.0.1:80/cobbler_api: 404 Not Found*

 I verified /var/www/cobbler_api I don't see any folder

 I tested same version with ubuntu 14.04 also not working

 root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
 Selecting previously unselected package cobbler.
 (Reading database ... 229802 files and directories currently installed.)
 Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
 Setting up cobbler (2.6.4-1) ...
 Processing triggers for man-db ...
 Processing triggers for ureadahead ...
 root@dhana:~# /etc/init.d/cobblerd start
 Starting cobbler daemon: already started
 root@dhana:~# cobbler --version
 httpd does not appear to be running and proxying cobbler, or SELinux is
 in the way. Original traceback:
 Traceback (most recent call last):
   File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252, in
 check_setup
 s.ping()
   File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
 return self.__send(self.__name, args)
   File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
 verbose=self.__verbose
   File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
 return self.single_request(host, handler, request_body, verbose)
   File /usr/lib/python2.7/xmlrpclib.py, line 1312, in single_request
 response.msg,
 ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api: 404 Not
 Found
 root@dhana:~#

 Please guide me, How to fix this.

 -Dhanasekaran

 Did I learn something today? If not, I wasted it.

 ___
 cobbler mailing list
 cobbler@lists.fedorahosted.org
 https://lists.fedorahosted.org/mailman/listinfo/cobbler



 ___
 cobbler mailing list
 cobbler@lists.fedorahosted.org
 https://lists.fedorahosted.org/mailman/listinfo/cobbler


___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Re: [cobbler] Issue with 2.6.4-1 cobbler

2014-08-09 Thread alastair
You need to follow the installation instructions: 
http://www.cobblerd.org/manuals/2.4.0/2_-_Cobbler_Quickstart_Guide.html


You should at least follow this before contacting the mailing list. Also 
google.


Think about it, a 127.0.0.1 address would not work? You need to put the 
ip of your server in there for clients across the network to connect to 
your cobbler server...


google isolinux and pxe boot so you understand the basics of what you 
are trying to do.


On 2014-08-10 01:39, Dhanasekaran Anbalagan wrote:

Hi Alastair,

I am getting same Error, when I try to execute cobbler check, 

root@dhana:~# cat /etc/cobbler/settings|grep next_server
next_server: 127.0.0.1
root@dhana:~#  cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux
is in the way. Original traceback:
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line 252,
in check_setup
    s.ping()
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
    return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
    verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1312, in
single_request
    response.msg,
ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api [1]: 404
Not Found
root@dhana:~# 

 :~# cat /etc/hosts
127.0.0.1 localhost

Did I learn something today? If not, I wasted it.

On Sun, Aug 10, 2014 at 5:58 AM, Alastair Munro
alast...@alastair-munro.com wrote:


Doesn't 'cobbler check' tell you to set server and next_server to
something other than 127.0.0.1 [3]?

--
Alastair Munro

-Original Message-
From: Dhanasekaran Anbalagan bugcy...@gmail.com

To: cobbler mailing list cobbler@lists.fedorahosted.org
Sent: Sun, 10 Aug 2014 1:24
Subject: Re: [cobbler] Issue with 2.6.4-1 cobbler

Hi,

apache already running, I able to telnet 80 port,

root@dhana:~# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
^]
telnet quit
Connection closed.
root@dhana:~# /etc/init.d/apache2 status
Apache2 is running (pid 11322).
root@dhana:~# 

Note :: cobbler_api folder not there in /var/www location

Did I learn something today? If not, I wasted it.

On Sun, Aug 10, 2014 at 5:41 AM, Alastair Munro
alast...@alastair-munro.com wrote:


Is apache started? Suggest you see whether you can connect to the
url?

--
Alastair Munro

-Original Message-
From: Dhanasekaran Anbalagan bugcy...@gmail.com
To: cobbler@lists.fedorahosted.org
Sent: Sun, 10 Aug 2014 0:51
Subject: [cobbler] Issue with 2.6.4-1 cobbler

Hi Guys,

Today I tested with cobbler_2.6.4-1 with my ubuntu 12.04 server.

It's says PROTOCOLERROR: PROTOCOLERROR FOR
127.0.0.1:80/COBBLER_API [1]: 404 NOT FOUND

I verified /var/www/cobbler_api I don't see any folder

I tested same version with ubuntu 14.04 also not working

root@dhana:~# dpkg -i cobbler_2.6.4-1_all.deb
Selecting previously unselected package cobbler.
(Reading database ... 229802 files and directories currently
installed.)
Unpacking cobbler (from cobbler_2.6.4-1_all.deb) ...
Setting up cobbler (2.6.4-1) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
root@dhana:~# /etc/init.d/cobblerd start
Starting cobbler daemon: already started
root@dhana:~# cobbler --version
httpd does not appear to be running and proxying cobbler, or
SELinux is in the way. Original traceback:
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/cobbler/cli.py, line
252, in check_setup
    s.ping()
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
    return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request

    verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
    return self.single_request(host, handler, request_body,
verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1312, in
single_request
    response.msg,
ProtocolError: ProtocolError for 127.0.0.1:80/cobbler_api [1]:
404 Not Found
root@dhana:~# 

Please guide me, How to fix this.

-Dhanasekaran

Did I learn something today? If not, I wasted it.
___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler [2]


___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler [2]




Links:
--
[1] http://127.0.0.1:80/cobbler_api
[2] https://lists.fedorahosted.org/mailman/listinfo/cobbler
[3] http://127.0.0.1

___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler

___
cobbler mailing list

Re: [cobbler] How to speed up triggers

2014-08-09 Thread Jörgen Maas
Hi Alastair,

Great writeup. We do have a wiki where Cobbler users can share their
solutions/experiences
It would be great if you would be willing to put this information up there:
https://github.com/cobbler/cobbler/wiki

I hope other users will be inspired to do the same :)




On Sat, Aug 9, 2014 at 9:39 PM, alast...@alastair-munro.com wrote:

 Hi

 Just wanted to share something with the list. When creating triggers to
 say run a 'cobbler replicate' 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.

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

 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.

 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)

 # mkdir /usr/local/cobbler
 # cd /var/lib/cobbler/triggers/add/system/post/
 # cat sync-slaves.sh
 #!/bin/bash

 # A Munro 6 Aug 2014: sync slaves
 # make sure you set up ssh keys for this...

 # space delimited list of slaves
 SLAVES=gb-wat-svv-0600 us-ham-svv-0600 us-lou-svv-0600
 MASTER=cobbler
 SSH=ssh -oConnectTimeout=2 -oStrictHostKeyChecking=no
 -oUserKnownHostsFile=/dev/null -oBatchMode=yes -oLogLevel=quiet
 LOG=/var/log/cobbler/triggers.log

 [ -f $LOG ]  rm -f $LOG

 for h in $SLAVES
 do
 #   slow way:background so they are done in parallel
 #   however ssh still waits for all the commands to complete
 #$SSH $h cobbler replicate --master=$MASTER --systems=* --profiles=*
 --prune 21  $LOG  
 #   using daemon from http://libslack.org/daemon is fast and
 instantaneous. The run gets daemonized remotely and returns instantly
 $SSH $h daemon --name=cob /usr/local/cobbler/sync-master.sh 21 
 $LOG  
 done

 # chmod u+x sync-slaves.sh

 On the slave:

 # cat /usr/local/cobbler/sync-master.sh
 cobbler replicate --master=cobbler --systems=* --profiles=* --prune

 # chmod u+x /usr/local/cobbler/sync-master.sh

 ___
 cobbler mailing list
 cobbler@lists.fedorahosted.org
 https://lists.fedorahosted.org/mailman/listinfo/cobbler




-- 
Grtz,
Jörgen Maas
___
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler