LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-30-2013, 05:06 AM   #1
sparc86
Member
 
Registered: Jul 2006
Location: Joinville, Brazil
Distribution: Debian, CentOS
Posts: 301

Rep: Reputation: 31
migrating puppet patch configurations to chef


Hi LQ community,

I got a mission to migrate some Puppet configurations to Chef, but my main experience is with bcfg2, therefore I am struggling to achieve what the IT manager wants.

Basically they need to run the "patch" command in order to include a list of servers to a fresh installation of a Fedora server. Versions of Fedora may vary in our shop and therefore also the ntp package, that's the main reason for using patch instead of placing a brand new ntp configuration file; we don't want to take the risk of proving an incompatible configuration file to the ntp daemon.

Then "patch" would solve this problem, as we only add a list of servers and keep the rest of the original ntp configuration file.

At the moment we have it running in a puppet environment with the following configuration that I would like to convert to chef but I am not sure yet how to do it:

Code:
class ntp{

    file{'ntp.patch':
        ensure      => file,
        path        => '/tmp/ntp.patch',
        source      => 'puppet:///modules/ntp/ntp.patch',
        owner       => 'root',
        group       => 'root',
        mode        => '440',
    }

    exec{'ntp-patch':
        path        => '/bin:/usr/bin',
        command     => '/usr/bin/patch -d /etc/ -p0 < /tmp/ntp.patch',
        logoutput   => true,
        onlyif      => 'test "`cat /etc/ntp.conf | grep "^server\ 0.pool.ntp.org" -c`" -ne 1',
    }

    exec{'ntp-patch-delete':
        path        => '/bin',
        command     => 'rm /tmp/ntp.patch',
        logoutput   => true,
    }

    File['ntp.patch'] -> Exec['ntp-patch'] -> Exec['ntp-patch-delete']
Well, I think I have found a way to run system commands using chef, but still, I'm not sure how to pull a text file containing the list of ntp servers to be included in the running system. In Puppet we have it in "/etc/puppet/modules/ntp/files/ntp.patch" and then the manifest file will read the "ntp.patch" file and use it's content to write in the actual ntp.conf file in the running system. So that would be great if I could do the same with Chef or, perhaps, there are more elegant ways to solve this problem using Chef, but I don't know.

Thank you very much in advance for your help.
 
Old 11-01-2013, 06:40 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I'm confused .. you're using puppet to run the patch command? You seem to be ignoring a large portion of it's capabilities such as templating and conditional statements like 'case'. Basically I'm saying you don't want to use any configuration management system to patch files.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Experiences with puppet/chef/ansible/... in small/medium businesses Meson Linux - Virtualization and Cloud 2 09-15-2013 01:22 PM
LXer: Beyond Chef and Puppet: Ubuntu Juju LXer Syndicated Linux News 0 08-28-2013 01:10 AM
Distributing ssh keys with chef? szboardstretcher Linux - Software 1 07-16-2013 11:42 AM
LXer: Chef 11 adds a serving of Erlang LXer Syndicated Linux News 0 02-11-2013 03:00 PM
Parameter to execute shell script on puppet client through Puppet server niraj.kumar Linux - Server 3 02-08-2011 09:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration