[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cobbler
Subject:    Re: [cobbler] Download a file from the Cobbler server to be processed during the Ubuntu installation
From:       Leonid Flaks <flaks () bnl ! gov>
Date:       2015-02-07 3:08:30
Message-ID: 54D581AE.5000505 () bnl ! gov
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Looking at the source on git hub I found a following commit: 
https://github.com/cobbler/cobbler/commit/253f7a966285797ce2cb535ac65102ac5d845b53
that introduced the fetchable_file attribute.
It has comments explaining the use case. I doubt that this is what you 
want, but you'd better look at it closer yourself.

Leon

Leon
On 02/06/2015 07:14 AM, Rubén Pérez wrote:
> 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
> > > > > -- 


[Attachment #5 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Looking at the source on git hub I
      found a following commit:
<a class="moz-txt-link-freetext" \
href="https://github.com/cobbler/cobbler/commit/253f7a966285797ce2cb535ac65102ac5d845b \
53">https://github.com/cobbler/cobbler/commit/253f7a966285797ce2cb535ac65102ac5d845b53</a><br>
  that introduced the fetchable_file attribute.<br>
      It has comments explaining the use case. I doubt that this is what
      you want, but you'd better look at it closer yourself.<br>
      <br>
      Leon<br>
      <br>
      Leon<br>
      On 02/06/2015 07:14 AM, Rubén Pérez wrote:<br>
    </div>
    <blockquote cite="mid:54D4B042.9080201@uni-koeln.de" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      Hello,<br>
      <br>
      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. <br>
      <br>
      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. <br>
      <br>
      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?<br>
      <br>
      Regards and thanks for your valuable input<br>
      <br>
      <div class="moz-cite-prefix">On 05/02/15 15:33, Leonid Flaks
        wrote:<br>
      </div>
      <blockquote cite="mid:54D37F3F.2020907@bnl.gov" type="cite">Hi! <br>
        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. <br>
        <br>
        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!) <br>
        <br>
        Now to your questions. <br>
        I would point you first of all to an excellent wiki page from a
        few months ago: <br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/cobbler/cobbler/wiki/Using%20template%20scripts%20for%20Debia \
n%20and%20Ubuntu%20seeds">https://github.com/cobbler/cobbler/wiki/Using%20template%20scripts%20for%20Debian%20and%20Ubuntu%20seeds</a>
  <br>
        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. <br>
        Following that advice, I made a directory on cobbler server: <br>
        /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
        <br>
        <br>
        I specify template_files using WebUI - found it a lot less
        error-prone. <br>
        In the Template Files Field in profile or system page I would
        put this: <br>
        /srv/cobbler/root/etc/ntp.conf=/etc/ntp.conf <br>
        If I need more then 1 pair, they are separated by space. <br>
        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. <br>
        <br>
        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. <br>
        <br>
        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. <br>
        <br>
        Leon <br>
        On 02/05/2015 04:36 AM, Rubén Pérez wrote: <br>
        <blockquote type="cite">Hello Leon, <br>
          <br>
          Thanks for your answer. It's very helpful, but I still have
          some doubts <br>
          about it. I'm sorry if what I'm going to ask is too obvious. <br>
          <br>
           From reading the snippet you suggest, I see that it depends
          on a <br>
          variable called "template_files". Reading the f* (:P) manual,
          I've seen <br>
          that there is a config parameter called "template_files", that
          you can <br>
          define for profiles and systems. I'm unsure of the syntax,
          however --it <br>
          seems I need to use a key=value format, but after a short
          "research" I <br>
          am not sure about what should be the key and what should be
          the value. <br>
          The manual refers to the section "Managing TFTP", which
          currently is a <br>
          helpful blank page. <br>
          <br>
          So, to be specific: <br>
          <br>
            * What is the correct format to specify the files in
          "template_files"? <br>
            * Where should those files live in the Cobbler server? Or
          can they be <br>
              anywhere in the system? If so, is there any recommended /
          standard <br>
              directory to use? <br>
            * I see there is a similar field called "fetchable_files".
          Should I <br>
              understand that those are just like "template_files", but
          are not <br>
              rendered by Cheetah? If so, what is the URL to reach those
          <br>
              "fetchable files"? <br>
          <br>
          <br>
          Thanks in advance for your help. <br>
          <br>
          Best regards <br>
          <br>
          <br>
          On 04/02/15 17:40, Leonid Flaks wrote: <br>
          <blockquote type="cite">Hi! <br>
            I suggest using snippet download_config_files for that
            purpose. It is <br>
            provided with cobbler distribution. It makes use of template
            files. <br>
            The important thing to know is that files are rendered by
            Cheetah, so <br>
            you might need to escape special characters to preserve
            them. <br>
            This snippet is referred by preseed_late_default script,
            which in turn <br>
            is called from sample.seed. <br>
            I noticed that the snippet has been modified lately "for
            rpm-based" <br>
            systems by switching to curl from wget. I did not test it on
            debian, <br>
            and suspect it might break debian/ubuntu. The similar
            snippet <br>
            download_config_files_deb is using wget, but should be
            included in <br>
            preseed file directly and is somewhat obsolete. <br>
            You might have to modify scripts mentioned above to make
            things work - <br>
            not too many people are using debian/ubuntu with cobbler. <br>
            <br>
            Hope that helps, <br>
            <br>
            Leon <br>
            <br>
            On 02/04/2015 09:32 AM, Rubén Pérez wrote: <br>
            <blockquote type="cite">Hello! <br>
              <br>
              I hope someone can help me with a problem that I cannot
              see how to fix. <br>
              I'm using cobbler to install Ubuntu boxes, and I'd like to
              manage their <br>
              configuration with Ansible. My problem is that I would
              like Cobbler to <br>
              install my SSH public id into the boxes, so that Ansible
              can connect <br>
              without providing a password. <br>
              <br>
              According to what I've found in [1], I could do something
              like this: <br>
              <br>
              d-i preseed/late_command string in-target wget <br>
              <a moz-do-not-send="true" class="moz-txt-link-freetext"
                href="http://$http_server/cblr/svc/op/script/$what/$name/">http://$http_server/cblr/svc/op/script/$what/$name/</a>
  script=my_public_key <br>
              -O /tmp/thekey; \ <br>
                   in-target cat /tmp/thekey &gt;&gt;
              /home/user/.ssh/authorized_keys \ <br>
              <br>
              My question is, how can I provide the public key file in a
              more standard <br>
              location? I.e. how can I make the file available for
              download, just like <br>
              the scripts, but in a "files" directory, or anything
              similar? <br>
              <br>
              Thanks in advance for your help! <br>
              <br>
              Best regards <br>
              -- <br>
            </blockquote>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>


[Attachment #6 (text/plain)]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic