Hi List, I have two questions. Firstly I want to be able to ensure a default package is installed across all hosts unless I specifically require them to be absent. To do this I have created a module(httpd) and class(php_mod) and definition(php_mod_add) which I want to declare at the default node or individual node level. node mel_default_preview inherits mel_default_web { class { httpd: version => "2.2.3-43.el5.centos.3" } class { php: version => "5.2.9-2" } include dev_httpd::php_dev_httpd include php_mod php_mod::php_mod_add { "php-pgsql": ensure => present, type => "rpm"; "channel://pear.php.net/OLE-1.0.0RC1": ensure => present, type => "pear"; "channel://pear.php.net/Spreadsheet_Excel_Writer-0.9.2": ensure => present, type => "pear"; } } node au-mel-preview-1 inherits mel_default_preview { php_mod::php_mod_add { "php-pgsql": ensure => absent, type => "rpm"; } } When I do this it obviously complains about being defined twice - how do I get around that? Here is the define I''m using: define php_mod_add ($ensure = absent, $type = "rpm") { # Get the module name from the name variable. $mod = $name if ($type == "rpm") { case $ensure { present: { notice("$mod present") package { $mod: ensure => installed } } absent: { notice("$mod absent") package { $mod: ensure => absent } } } } Also in the node definition, how do I make sure that "channel://pear.php.net/OLE-1.0.0RC1": runs before "channel://pear.php.net/Spreadsheet_Excel_Writer-0.9.2"? Could I do that in a require or something? I''m running 2.6.1-5. Thanks, DenMat -- 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.
On Sep 20, 2010, at 8:01 PM, denmat wrote:> Hi List, > > I have two questions. > > Firstly I want to be able to ensure a default package is installed > across all hosts unless I specifically require them to be absent. > > To do this I have created a module(httpd) and class(php_mod) and > definition(php_mod_add) which I want to declare at the default node or > individual node level.I believe you can do this by putting the "ensure => installed" resource in a parent and have the child override it. Then you include the child when you want to remove the package. Then include the parent in your global section. -- 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.
Thanks for the swift response Patrick, however it hasn''t worked. If I declare it in one place, it complains of a duplicate. I''m thinking what I''m trying to do is not possible. I''m now seeing if I can create class definitions and import them that way. node mel_default_preview inherits mel_default_web { class { httpd: version => "2.2.3-43.el5.centos.3" } class { php: version => "5.2.9-2" } include dev_httpd::dev_httpd_def_php_conf include dev_httpd::dev_httpd_def_php_pkgs } Unless there is another, simpler way I''m missing? On Sep 21, 1:14 pm, Patrick <kc7...@gmail.com> wrote:> On Sep 20, 2010, at 8:01 PM, denmat wrote: > > > Hi List, > > > I have two questions. > > > Firstly I want to be able to ensure a default package is installed > > across all hosts unless I specifically require them to be absent. > > > To do this I have created a module(httpd) and class(php_mod) and > > definition(php_mod_add) which I want to declare at the default node or > > individual node level. > > I believe you can do this by putting the "ensure => installed" resource in a parent and have the child override it. Then you include the child when you want to remove the package. Then include the parent in your global section.-- 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.
Patrick
2010-Sep-21 06:36 UTC
Re: [Puppet Users] Re: a little help with definitions in nodes
On Sep 20, 2010, at 10:57 PM, denmat wrote:> Thanks for the swift response Patrick, however it hasn''t worked. If I > declare it in one place, it complains of a duplicate. > > I''m thinking what I''m trying to do is not possible. >class base { package { "svn": ensure => installed, } } class remove_svn inherits base { #Look up overrides in #http://docs.reductivelabs.com/guides/language_tutorial.html#classes #This bit is the key Package["svn"] { ensure => absent, } } #Also important! include base node default { #Commenting and uncommenting this next line will install and uninstall the package. # include remove_svn }> > > On Sep 21, 1:14 pm, Patrick <kc7...@gmail.com> wrote: >> On Sep 20, 2010, at 8:01 PM, denmat wrote: >> >>> Hi List, >> >>> I have two questions. >> >>> Firstly I want to be able to ensure a default package is installed >>> across all hosts unless I specifically require them to be absent. >> >>> To do this I have created a module(httpd) and class(php_mod) and >>> definition(php_mod_add) which I want to declare at the default node or >>> individual node level. >> >> I believe you can do this by putting the "ensure => installed" resource in a parent and have the child override it. Then you include the child when you want to remove the package. Then include the parent in your global section. > > -- > 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.
Yep, thanks Patrick. I''ve figure it out this way: class dev_httpd { class dev_httpd_def_php_pkgs inherits php_mod { php_mod::php_mod_add { "php-pgsql": ensure => present, type => "rpm"; } class dev_httpd_preview_php_pkgs inherits dev_httpd_def_php_pkgs { Php_mod::Php_mod_add[''php-pgsql''] { ensure => absent } } } then I include that on the node def like so: node mel_default_preview inherits mel_default_web { class { httpd: version => "2.2.3-43.el5.centos.3" } class { php: version => "5.2.9-2" } include dev_httpd::dev_httpd_def_php_conf class { dev_httpd: } include dev_httpd::dev_httpd_def_php_pkgs } node au-mel-preview-1 inherits mel_default_preview { include dev_httpd::dev_httpd_preview_php_pkgs } That provides a bit of flexibility. Thanks again for all your help. Cheers DenMat On Sep 21, 4:36 pm, Patrick <kc7...@gmail.com> wrote:> On Sep 20, 2010, at 10:57 PM, denmat wrote: > > > Thanks for the swift response Patrick, however it hasn''t worked. If I > > declare it in one place, it complains of a duplicate. > > > I''m thinking what I''m trying to do is not possible. > > class base > { > package { "svn": > ensure => installed, > } > > } > > class remove_svn inherits base > { > #Look up overrides in > #http://docs.reductivelabs.com/guides/language_tutorial.html#classes > #This bit is the key > Package["svn"] { > ensure => absent, > } > > } > > #Also important! > include base > > node default > { > #Commenting and uncommenting this next line will install and uninstall the package. > # include remove_svn > > } > > > On Sep 21, 1:14 pm, Patrick <kc7...@gmail.com> wrote: > >> On Sep 20, 2010, at 8:01 PM, denmat wrote: > > >>> Hi List, > > >>> I have two questions. > > >>> Firstly I want to be able to ensure a default package is installed > >>> across all hosts unless I specifically require them to be absent. > > >>> To do this I have created a module(httpd) and class(php_mod) and > >>> definition(php_mod_add) which I want to declare at the default node or > >>> individual node level. > > >> I believe you can do this by putting the "ensure => installed" resource in a parent and have the child override it. Then you include the child when you want to remove the package. Then include the parent in your global section. > > > -- > > 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 athttp://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.