FAQ
In this case, you’ve got 2 issues.

1, most of that data would, ideally, be in Hiera. But, with a defined type, you can’t use the parameterized classes lookup.

2. That case statement means that the catalog for the system with “client" doesn’t even know anything about the “access" resources.

I’d suggest in this case: (but I’m not loving the code design, to be honest. Look under the example for more.



$vpn_server = ‘winterthur'

         case $::role {
                 'access': {
    <snip>
                          openvpn::server {“$vpn_server" :
                         country => 'CH',
                         province => 'ZH',
                         city => 'Winterthur',
                         organization => 'example.org',
                         email => 'root@example.org',
                         server => '10.200.200.0 255.255.255.0'}

                 }
                 'client': {
                         notify {"Applying client config" :}
                         openvpn::client { 'client1':
                                 server => “$vpn_server"
                         }

                 }
         }

This screams for a better separation, to me. Unless you only have 1 set of servers & clients…
— Maybe use a class, with the parameters pulling in the details from hiera, and using the variable parameters in the code.
— they would include city,province, server_ip, email, country.





Matthew Barr
mbarr@mbarr.net
c: (646) 727-0535
On Dec 9, 2013, at 5:32 PM, Derek Cole wrote:

Hello,

I am not exactly sure how to phrase this, but consider the following:

case $::role {
'access': {
notify {"Applying access packages" :}
include access_packages

freebsd::rc_conf { 'test' :
value => 'yes',
ensure => 'present'
}
openvpn::server {'winterthur' :
country => 'CH',
province => 'ZH',
city => 'Winterthur',
organization => 'example.org',
email => 'root@example.org',
server => '10.200.200.0 255.255.255.0'}

}
'client': {
notify {"Applying client config" :}
openvpn::client { 'client1':
server => "winterthur"
}

}
}


What I am trying to do in 'client' case is reference the server that was defined in the 'access' case. Is this possible? The openvpn module here; https://github.com/luxflux/puppet-openvpn

contains some examples and such that lead me to believe there should be a reference, but it seems like that only is applicable if they have the same scope. How would I go about storing off the 'winterthur' openvpn::server for use by the clients later? Puppet's class variable access and scoping in general are a little confusing to me at this point. I tried the obvious assigning a $variable but that didn't work either. Also, looking at the openvpn code, it seems like openvpn::server is "define"d instead of using the class keyword. does this make a difference?

Thanks

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/9de48764-707d-4529-a018-42a4782310f3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/57B1DC95-1CDD-4E70-AFF6-120AC2C75234%40mbarr.net.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 4 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedDec 9, '13 at 10:32p
activeDec 12, '13 at 12:49a
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase