Jeff Falgout
2011-Sep-30 18:33 UTC
[Puppet Users] What''s the best way to deal with multiple OS''s
We''re in the situation of dealing with multiple operating systems (and will likely add another) and I''m quickly realizing that building logic in the manifest to deal with the differences in Red Hat i386 vs Red Hat x86_64 vs SuSE i586 vs SuSE x86_64 vs Mac is getting tedious. For instance, in the sshd_config: SLES i586 has the sftp-server binary in a different path than the x86_64 version and it''s different than RHEL - so I end up with logic as such: # Set the SFTP Path if $lsbdistid == ''SUSE LINUX'' { if $architecture == ''x86_64'' { $sftppath = ''/usr/lib64/ssh/sftp-server'' } else { $sftppath = ''/usr/lib/ssh/sftp-server'' } } else { $sftppath = "/usr/libexec/openssh/sftp-server" } Is there a better way to deal with different OS''s or is the long and winding road of config mgmt? Do people do something like: include ssh::server::$operatingsystem class ssh::server::RedHat { blah } class ssh::server::SLES { blah } Different modulepath? Different puppet servers based on OS? Cheers, Jeff -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Aaron Grewell
2011-Sep-30 19:46 UTC
Re: [Puppet Users] What''s the best way to deal with multiple OS''s
We use different manifests per OS. It makes the underlying logic much simpler, and is easily called by using either the ''kernel'' fact or the ''operatingsystem'' fact depending. For things that are the same across supported Linuxes but different on Solaris: include module::$kernel Where moduledir/manifests contains linux.pp and sunos.pp. For things that differ between Linuxes as well: include module::$operatingsystem Where moduledir/manifests contains redhat.pp, oel.pp, solaris.pp On Fri, Sep 30, 2011 at 11:33 AM, Jeff Falgout <jtfalgout@gmail.com> wrote:> We''re in the situation of dealing with multiple operating systems (and will > likely add another) and I''m quickly realizing that building logic in the > manifest to deal with the differences in Red Hat i386 vs Red Hat x86_64 vs > SuSE i586 vs SuSE x86_64 vs Mac is getting tedious. For instance, in the > sshd_config: > > SLES i586 has the sftp-server binary in a different path than the x86_64 > version and it''s different than RHEL - so I end up with logic as such: > > # Set the SFTP Path > if $lsbdistid == ''SUSE LINUX'' { > if $architecture == ''x86_64'' { > $sftppath = ''/usr/lib64/ssh/sftp-server'' > } else { > $sftppath = ''/usr/lib/ssh/sftp-server'' > } > } else { > $sftppath = "/usr/libexec/openssh/sftp-server" > } > > > Is there a better way to deal with different OS''s or is the long and > winding road of config mgmt? > > Do people do something like: > > include ssh::server::$operatingsystem > > class ssh::server::RedHat { > blah > } > > class ssh::server::SLES { > blah > } > > > Different modulepath? Different puppet servers based on OS? > > Cheers, > > Jeff > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2011-Sep-30 19:57 UTC
Re: [Puppet Users] What''s the best way to deal with multiple OS''s
On Fri, Sep 30, 2011 at 11:33 AM, Jeff Falgout <jtfalgout@gmail.com> wrote:> We''re in the situation of dealing with multiple operating systems (and will > likely add another) and I''m quickly realizing that building logic in the > manifest to deal with the differences in Red Hat i386 vs Red Hat x86_64 vs > SuSE i586 vs SuSE x86_64 vs Mac is getting tedious. For instance, in the > sshd_config: > > SLES i586 has the sftp-server binary in a different path than the x86_64 > version and it''s different than RHEL - so I end up with logic as such: > > # Set the SFTP Path > if $lsbdistid == ''SUSE LINUX'' { > if $architecture == ''x86_64'' { > $sftppath = ''/usr/lib64/ssh/sftp-server'' > } else { > $sftppath = ''/usr/lib/ssh/sftp-server'' > } > } else { > $sftppath = "/usr/libexec/openssh/sftp-server" > } > > > Is there a better way to deal with different OS''s or is the long and > winding road of config mgmt?I tend to follow these paths, depending upon how much actual difference there is between the platforms. 1) Use in-line selectors: http://docs.puppetlabs.com/guides/language_guide.html#selectors file { ''/etc/config'': owner => $operatingsystem ? { ''sunos'' => ''adm'', ''redhat'' => ''bin'', default => undef, }, } 2) Have a separate ::params style subclass where all the logic about the differences exists, and use those variables elsewhere. For some cases like "root_owner" "root_group" I''ve done top-level global variables instead of within the modules. 3) Have completely separate manifests. I really think the right answer depends on how much difference you have to cope with across platforms, and how large the conditional parts end up being. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.