I revisited the issue a few weeks later and worked on it a couple hours.

1. I managed to write the scripts and manifest files that install and 
upgrade python2.7 into the alternate /usr/local/bin location. So this was a 
WIN!

2. I am still battling with pip. I tried to install pip2.7 using the script 
method and while that works, there is a serious roadblock: puppet does not 
pick up the pip installed this way. Even though /usr/local/bin is in the 
PATH for root, puppet says it cannot find pip. I even tried putting in a 
simlink from /usr/bin/pip to /usr/local/bin/pip, but strangely enough that 
does not make a difference.

3. While the script method works for python2.7, my solution cannot be 
called elegant or efficient. The install files are created every time 
unconditionally, even when the scripts do not get to be executed. I could 
not see an easy way to resolve this problem.

For reference I have:

class ... {
    file { 'install_python-2.7.8':
        path    => '/tmp/install_python-2.7.8.sh',
        ensure  => file,
        source  => "puppet:///modules/.../scripts/install_python-2.7.8.sh",
        mode    => 0755,
    }

    # No python2.7 exists:
    exec { 'install_python-2.7.8':
        command => '/tmp/install_python-2.7.8.sh',
        require => [File['/tmp/install_python-2.7.8.sh'],
                    Package['gcc-c++']],
        creates => '/usr/local/bin/python2.7',
        timeout => 1200,
    }
}

The exec only runs when /usr/local/bin/python2.7 does not exist, but the 
installation script gets created on the nodes unconditionally.

I posted the above in case someone finds this useful. I also welcome 
comments and suggestions.

Best,
-Matyas

On Wednesday, November 5, 2014 4:36:36 PM UTC-8, Felix.Frank wrote:
>
>  On 10/21/2014 02:07 AM, Matyas A. Sustik wrote:
>  
> I follow up to my own post in case someone else encounters the same 
> questions.
>
> On Friday, October 10, 2014 8:50:34 PM UTC-7, Matyas A. Sustik wrote: 
>>
>> I am new to Puppet. I hoped someone in this group could get me on the 
>> right track with some questions I have.
>>
>> 1. I would appreciate an example demonstrating how to tell puppet to 
>> install a specific package in a specific location? For example, how to 
>> write that python2.7 should be installed in /usr/local/bin?
>>
>>  
> Puppet is not the right tool for this task according to our local 
> puppetmaster.
>  
>
> Oh you have deployed a talking puppet master? ;-)
>
>  Though he also said it can be done when I pressed him. But consider that 
> if an expert says it is too hard and you get 0 responses on google groups 
> you should think twice before embarking on this project: you will probably 
> put a lot of effort in and get stuck at some stage with no help in sight.
>
>   
> Yeah, this would most likely require
> a) creating a package that installs to that location or
> b) making Puppet build from source, but read below
>
>   2. How to install a python module, for example pandas? From the command 
>> line one could use pip. Does puppet know about pip?
>>
>>  
> You can specify pip to be used for the install. However, if you use 
> python2.7 then you want pip2.7 as well and so you are back to problem 1.
>  
>
> Yes. You might be able to coax the puppet agent into using a pip wrapper 
> that maps to pip2.7, but not in a flexible fashion.
>
>   
>
>> 3. How to install a package from the tarballs and specify some parameters 
>> to the install process?
>>
>>  
> Ultimately you can write a script that will be executed by puppet and do 
> anything you want. However the benefits puppet brings in this case compared 
> to the rest of the effort will not justify its use.
>  
>
> Indeed. Writing a script that compiles a software or does whatever, then 
> deploying and running it through Puppet, does not stricly qualify as 
> "solving something with Puppet".
>
> So, fair assessments all.
>
> Cheers,
> Felix
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/cbe71bcb-39fd-4072-9206-6be282a2a2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to