[Puppet Users] Re: Variable not working in a define
Oh man, I found the mistake. It is in the template: TOMCAT_VER="<%= scope.lookupvar('tcserver::params::instance_version') %>" should be: TOMCAT_VER="<%= scope.lookupvar('version')%>" Because it is called out of tcserver::instance. Kind regards On 10 Nov., 09:24, imase wrote: > Hello together, > > I have a define which was written by someone else and I am trying to > extend it by the $version variable. My Module is called tcserver and > it's a type of an apache tomcat. The package of tcserver will be > deployed by an rpm via the module. After the installation there are > two version of Tomcat which I would like to use. So I would like, that > Application 1 is using Tomcat 6 and the other one 7. Here is the > config of an example application: > > tcserver::instance { 'jira': > httpport => '8080', > contextfile => 'jira_context.xml', > serverfile => 'jira_server.xml', > setenvfile => 'jira_setenv.sh', > service_enable => false, > version => '6.0.33.A.RELEASE', > } > > The define tcserver::instance looks like this: > > define tcserver::instance( > $httpport="${tcserver::params::instance_httpport}", > $contextfile="${tcserver::params::instance_contextfile}", > $setenvfile="${tcserver::params::instance_setenvfile}", > $serverfile="${tcserver::params::instance_serverfile}", > $version="${tcserver::params::instance_version}", > $service_enable=true, > $service_ensure='running' > ... (some more) > ) > > { > > include jdk16 > include tcserver > include tcserver::params > > $instance_service_enable = "$service_enable" > $instance_service_ensure = "$service_ensure" > $instance_httpport = "$httpport" > $instance_serverfile = "$serverfile" > $instance_setenvfile = "$setenvfile" > $instance_version = "$version" > ... (some more) > > file { "/etc/init.d/${instance_name}": > path => "/etc/init.d/${instance_name}", > mode => "755", > owner => "root", > group => "root", > ensure => present, > require => Package["${tcserver::params::packagename}"], > content => template("tcserver/tcserver.erb"), > } > > } > > tcserver::params looks like this: > > ... (some more) > $instance_version = $tcserver_instance_version ? { > '' => "6.0.32.B.RELEASE", > default => "${tcserver_instance_version}", > } > ... (some more) > > After the whole declaration I write it in an template and try to > replace it: > > TOMCAT_VER="<%= scope.lookupvar('tcserver::params::instance_version') > %>" > > After running puppet on the client I get the following in the > templated file: > > TOMCAT_VER="6.0.32.B.RELEASE" > > Olthough this should be: > > TOMCAT_VER="6.0.33.A.RELEASE" > > What am I do wrong? Could you help me? > > Kind regards -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Variable not working in a define
Hello together, I have a define which was written by someone else and I am trying to extend it by the $version variable. My Module is called tcserver and it's a type of an apache tomcat. The package of tcserver will be deployed by an rpm via the module. After the installation there are two version of Tomcat which I would like to use. So I would like, that Application 1 is using Tomcat 6 and the other one 7. Here is the config of an example application: tcserver::instance { 'jira': httpport => '8080', contextfile => 'jira_context.xml', serverfile => 'jira_server.xml', setenvfile => 'jira_setenv.sh', service_enable => false, version => '6.0.33.A.RELEASE', } The define tcserver::instance looks like this: define tcserver::instance( $httpport="${tcserver::params::instance_httpport}", $contextfile="${tcserver::params::instance_contextfile}", $setenvfile="${tcserver::params::instance_setenvfile}", $serverfile="${tcserver::params::instance_serverfile}", $version="${tcserver::params::instance_version}", $service_enable=true, $service_ensure='running' ... (some more) ) { include jdk16 include tcserver include tcserver::params $instance_service_enable = "$service_enable" $instance_service_ensure = "$service_ensure" $instance_httpport = "$httpport" $instance_serverfile = "$serverfile" $instance_setenvfile = "$setenvfile" $instance_version = "$version" ... (some more) file { "/etc/init.d/${instance_name}": path=> "/etc/init.d/${instance_name}", mode=> "755", owner => "root", group => "root", ensure => present, require => Package["${tcserver::params::packagename}"], content => template("tcserver/tcserver.erb"), } } tcserver::params looks like this: ... (some more) $instance_version = $tcserver_instance_version ? { '' => "6.0.32.B.RELEASE", default => "${tcserver_instance_version}", } ... (some more) After the whole declaration I write it in an template and try to replace it: TOMCAT_VER="<%= scope.lookupvar('tcserver::params::instance_version') %>" After running puppet on the client I get the following in the templated file: TOMCAT_VER="6.0.32.B.RELEASE" Olthough this should be: TOMCAT_VER="6.0.33.A.RELEASE" What am I do wrong? Could you help me? Kind regards -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Puppet Module Confusions
Hey Luke, thank you for your reply. The module tcserver is almost default from example42. The module RAD is fully new written by me. I confirmed that the module tcserver does not include the module rad. Also the general does not include rad. I checked the classes.txt File when the confusions happend again and found on the puppet master (also troubles, see above) some rad classes. After I change something and deployed again with capistrano, the classes rad in the .txt-file were away. But after the next time deploying it they were back again. Here my nodes: # Management servers node 'v00401' inherits basenode { $puppet_server_local = true $puppet_allow = [ "" ] $puppet_nodetool = "dashboard" $puppet_externalnodes = "no" $dashboard_db = "mysql" $puppet_storeconfigs = "yes" $puppet_storeconfigs_thin = "yes" $puppet_db = "" $puppet_db_server = "" $puppet_db_user = "" $puppet_db_password = "" $puppet_passenger = "no" $dashboard_monitor_port = "3000" $dashboard_monitor_url_pattern = "success" $rsyslog_use_loganalyzer = "yes" $rsyslog_loganalyzer_url = "http://download.adiscon.com/ loganalyzer/loganalyzer-3.0.4.tar.gz" $rsyslog_loganalyzer_dirname = "loganalyzer-3.0.4" $rsyslog_db = "mysql" $rsyslog_db_name = "Syslog" $rsyslog_db_server = "" $rsyslog_db_user = "" $rsyslog_db_password = "" $syslog_server_local = true $nagios_check_external_commands = "no" $documentroot_real = "/var/www/html" $puppi_server_local = true include dashboard include general } node 'v00404' inherits basenode { import "webapps.pp" include mysql::client tcserver::instance { 'crowd': httpport => '8080', service_enable => true, } include crowd apache::vhost { 'v00404': priority => '20', port => '80', docroot => '/var/www/html', template => 'puppet4set/virtualhosts/crowd.conf.erb', } include general } # WAS-Nodes node 'v00408' inherits basenode { include rad $puppet_environment = "production" $installtype = "admin" include general } node 'v00407' inherits basenode { include rad $puppet_environment = "integration" $installtype = "admin" include general } and my site.pp # Example42 common module has to be explicitely imported # (contains defines used by other modules that won't autoload) import "common" # Baselines classes include modules that have to be applied to all nodes. # import "baselines/*.pp" # The layout of your Infrastructure may be defined here import "infrastructures/*.pp" # On a medium/big sized infrastructure it makes sense to provide a role for each node. import "role/*.pp" # Nodes definitions are here import "nodes/*.pp" # Training Nodes definitions are here import "training/*.pp" # General settings for standard types Exec { path => "/bin:/sbin:/usr/bin:/usr/sbin" } Best regards imase On Jul 4, 5:10 pm, Luke Bigum wrote: > On Jul 4, 3:48 pm, imase wrote: > > > > > > > Hello together, > > > I have problems with my Puppet installation. I use example42 Modules > > as the base of my own Modules for automated deployment of Rational > > Application Developer. > > One of my Nodes is an tomcat server with the following includes > > > include mysql::client > > include tcserver > > include general > > > An other Node is a client for Rational Application developer with > > following Includes > > > include rad > > include general > > > Now, if i run puppet on the puppet master and tomcat server I get some > > overlaps with the rad class. It looks like this: > > > PuppetMaster: > > > rad::reqdir/File[/opt/software]/ensure: created > > ... > > These are Directories only for rad class, but not for the others. > > Looks like your Tomcat v00404.sbb.ch node is somehow getting a > "include rad", which is causing the duplicate Package clash in the > "tcserver" module, confirm this by running the following on the > v00404.sbb.ch node: > > grep rad /var/lib/puppet/classes.txt > > Is the "rad" module something you wrote yourself? Does "general" > include "rad"? Can you post your node definitions (site.pp / node.pp). > > It's not a bug, basically you're going to hav
[Puppet Users] Puppet Module Confusions
Hello together, I have problems with my Puppet installation. I use example42 Modules as the base of my own Modules for automated deployment of Rational Application Developer. Now I have overlaps between the modules. As example. I run Puppet on the Puppetmaster. He has included the following classes as the node configuration: include dashboard include general One of my Nodes is an tomcat server with the following includes include mysql::client include tcserver include general An other Node is a client for Rational Application developer with following Includes include rad include general Now, if i run puppet on the puppet master and tomcat server I get some overlaps with the rad class. It looks like this: PuppetMaster: rad::reqdir/File[/opt/software]/ensure: created ... These are Directories only for rad class, but not for the others. TomcatServer: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Package[redhat-lsb] is already defined in file /var/data/puppet/environments/production/puppet4set/modules/ rad/manifests/reqpkg.pp at line 44; cannot redefine at /var/data/ puppet/environments/production/puppet4set/modules/tcserver/manifests/ init.pp:33 on node v00404.sbb.ch Is there maybe a bug in version 2.6.9? Thanks imase -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.