Hello,

Unfortunately I had already seen that page, but it's not very helpful for my specific case. I helps, indeed, to understand how to use snippets in preseed files, but doesn't answer my most specific questions.

Searching in the code is the second thing I did (mainly to understand how the URLs work). Unfortunately, that led me to a controller file that parses the request to something called "services", which in turn forwards the requests to something called "XmlRpcServer". The controller file is at /var/www/cobbler/svc/services.py, and the "services.py" library is at /usr/lib/python2.6/site-packages/cobbler/services.py (in CentOS). After the first services.py code parses the request, it calls the appropriate method in the second services.py, which creates an instance of xmlrpclib.Server connected to 127.0.0.1 and a certain port. The XMLRPC server code is at /usr/lib64/python2.6/xmlrpclib.py, but it does not contain any of the methods that are called by (the second) services.py, so I'm guessing they are generated on the fly, according to some schema that I couldn't find.

I have found a reference to the template/config files in the (first) services.py code, but nothing about fetchable-files. Is it possible that it's still not implemented?

Regards and thanks for your valuable input

On 05/02/15 15:33, Leonid Flaks wrote:
Hi!
First of all I don't expect using this process on the unprotected public network as Michael noted earlier today, that is another task. Files are fetched with http protocol and the address could be crafted.

That being said, I am using cobbler to get some custom made bash script that needs to be run on the target system. ssh keys are taken care much later by puppet outside of the scope of this part - I am not using ansible (yet!)

Now to your questions.
I would point you first of all to an excellent wiki page from a few months ago:
https://github.com/cobbler/cobbler/wiki/Using%20template%20scripts%20for%20Debian%20and%20Ubuntu%20seeds
The other source of information is the archive of this mail list. I had similar questions myself for rpm-based OS a few years back that were answered here.
Following that advice, I made a directory on cobbler server:
/srv/cobbler/root and created a tree there - if I want to have a file that will end-up in /etc on target system (say, ntp.conf as an example) the file is saved as /srv/cobbler/root/etc/ntp.conf

I specify template_files using WebUI - found it a lot less error-prone.
In the Template Files Field in profile or system page I would put this:
/srv/cobbler/root/etc/ntp.conf=/etc/ntp.conf
If I need more then 1 pair, they are separated by space.
Source and destination files don't have to be the same - You might have ntp1.conf as a source for one profile and ntp2.conf for another.

I have no information about fetchable files field - never used it, but it looks interesting. Hopfuly, somebody can shed a light on that. Looking at the code might give some hints too.

Another advice - when you try things it is very useful to look at the rendered preseed file first - either in WebUI or getting it with wget from cobbler. It can eliminate mistakes early and also allows you to see if the rendered file looks the way you intended it to look.

Leon
On 02/05/2015 04:36 AM, Rubén Pérez wrote:
Hello Leon,

Thanks for your answer. It's very helpful, but I still have some doubts
about it. I'm sorry if what I'm going to ask is too obvious.

 From reading the snippet you suggest, I see that it depends on a
variable called "template_files". Reading the f* (:P) manual, I've seen
that there is a config parameter called "template_files", that you can
define for profiles and systems. I'm unsure of the syntax, however --it
seems I need to use a key=value format, but after a short "research" I
am not sure about what should be the key and what should be the value.
The manual refers to the section "Managing TFTP", which currently is a
helpful blank page.

So, to be specific:

  * What is the correct format to specify the files in "template_files"?
  * Where should those files live in the Cobbler server? Or can they be
    anywhere in the system? If so, is there any recommended / standard
    directory to use?
  * I see there is a similar field called "fetchable_files". Should I
    understand that those are just like "template_files", but are not
    rendered by Cheetah? If so, what is the URL to reach those
    "fetchable files"?


Thanks in advance for your help.

Best regards


On 04/02/15 17:40, Leonid Flaks wrote:
Hi!
I suggest using snippet download_config_files for that purpose. It is
provided with cobbler distribution. It makes use of template files.
The important thing to know is that files are rendered by Cheetah, so
you might need to escape special characters to preserve them.
This snippet is referred by preseed_late_default script, which in turn
is called from sample.seed.
I noticed that the snippet has been modified lately "for rpm-based"
systems by switching to curl from wget. I did not test it on debian,
and suspect it might break debian/ubuntu. The similar snippet
download_config_files_deb is using wget, but should be included in
preseed file directly and is somewhat obsolete.
You might have to modify scripts mentioned above to make things work -
not too many people are using debian/ubuntu with cobbler.

Hope that helps,

Leon

On 02/04/2015 09:32 AM, Rubén Pérez wrote:
Hello!

I hope someone can help me with a problem that I cannot see how to fix.
I'm using cobbler to install Ubuntu boxes, and I'd like to manage their
configuration with Ansible. My problem is that I would like Cobbler to
install my SSH public id into the boxes, so that Ansible can connect
without providing a password.

According to what I've found in [1], I could do something like this:

d-i preseed/late_command string in-target wget
http://$http_server/cblr/svc/op/script/$what/$name/ script=my_public_key
-O /tmp/thekey; \
     in-target cat /tmp/thekey >> /home/user/.ssh/authorized_keys \

My question is, how can I provide the public key file in a more standard
location? I.e. how can I make the file available for download, just like
the scripts, but in a "files" directory, or anything similar?

Thanks in advance for your help!

Best regards
--


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

--
Rubén Pérez Vázquez

Universität zu Köln
Regionales Rechenzentrum (RRZK)
Weyertal 121, Raum 4.07
D-50931 Köln
✆: +49-221-470-89603