Rocky
2012-Apr-13 15:17 UTC
[Puppet Users] Puppet definitions and hashes/arrays syntax problem.
Hi, I have this definiton for keepalived. And i need to feed the template this array that i will loop trough. site.pp definition snippet:> keepalived::vrrp_virtual_server {real_servers = { realserver1 => { ip => ''192.168.33.10'',>port => ''80'', weight => ''100'' checktype => ''TCP_CHECK'', connect_timeout => ''5'', connect_port => ''80'' } realserver2 => { ip => ''192.168.33.20'', port => ''80'',>weight => ''100'' checktype => ''TCP_CHECK'', connect_timeout => ''5'', connect_port => ''80''>} } keepalived manifest snippet: define keepalived::vrrp_virtual_server(> $real_servers >Template snippet: <% real_servers.each do |key,value| -%>> real_server <%= value[''ip''] %> <%= value[''port''] %> > weight <%= value[''weight''] %> > <%= value[''checktype''] %> > connect_timeout <%= value[''connect_timeout''] %> > connect_port <%= value[''connect_port''] %>I keep getting: *Could not parse for environment production: Syntax error at ''=''; expected ''}'' at /etc/puppet/manifests/site.pp:53 * What is the right syntax for an array in a definition in site.pp? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/eDzTXglLGksJ. 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.
Walter Heck
2012-Apr-14 01:48 UTC
Re: [Puppet Users] Puppet definitions and hashes/arrays syntax problem.
Am I missing soemthing or is one of your two array declarations using a ''='' and the other an ''=>'' ? Seems simple to me if this is a real quote of your actual code.. On Fri, Apr 13, 2012 at 23:17, Rocky <roscokap@gmail.com> wrote:> Hi, I have this definiton for keepalived. And i need to feed the template > this array that i will loop trough. > > site.pp definition snippet: > >> >> keepalived::vrrp_virtual_server { >> >> >> >> real_servers = { realserver1 => { ip => ''192.168.33.10'', >> >> >> port => ''80'', >> >> weight => ''100'' >> >> checktype => ''TCP_CHECK'', >> >> connect_timeout => ''5'', >> >> connect_port => ''80'' >> >> } >> >> realserver2 => { ip => ''192.168.33.20'', >> >> port => ''80'', >> >> >> weight => ''100'' >> >> checktype => ''TCP_CHECK'', >> >> connect_timeout => ''5'', >> >> connect_port => ''80'' >> >> >> } >> >> } > > > keepalived manifest snippet: > >> define keepalived::vrrp_virtual_server( >> $real_servers > > > Template snippet: > >> <% real_servers.each do |key,value| -%> >> real_server <%= value[''ip''] %> <%= value[''port''] %> >> weight <%= value[''weight''] %> >> <%= value[''checktype''] %> >> connect_timeout <%= value[''connect_timeout''] %> >> connect_port <%= value[''connect_port''] %> > > > > I keep getting: > > Could not parse for environment production: Syntax error at ''=''; expected > ''}'' at /etc/puppet/manifests/site.pp:53 > > What is the right syntax for an array in a definition in site.pp? > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/eDzTXglLGksJ. > 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.-- Walter Heck -- follow @walterheck on twitter to see what I''m up to! -- Check out my new startup: Server Monitoring as a Service @ http://tribily.com Follow @tribily on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/tribily -- 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.
jcbollinger
2012-Apr-16 13:57 UTC
[Puppet Users] Re: Puppet definitions and hashes/arrays syntax problem.
On Apr 13, 10:17 am, Rocky <rosco...@gmail.com> wrote:> Hi, I have this definiton for keepalived. And i need to feed the template > this array that i will loop trough. > > site.pp definition snippet: > > > keepalived::vrrp_virtual_server { > > real_servers = { realserver1 => { ip => ''192.168.33.10'',Variables in Puppet manifests are designated by an initial ''$'' sigil: $real_servers = ... (The sigil is left off when you refer to local Puppet variables in templates, however.) John -- 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.
jcbollinger
2012-Apr-16 14:56 UTC
[Puppet Users] Re: Puppet definitions and hashes/arrays syntax problem.
On Apr 13, 10:17 am, Rocky <rosco...@gmail.com> wrote:> weight => ''100''Also, you''re missing a comma after each appearance of that entry. John -- 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.