Made changes to get server part to run on CentOS:
authorJohn Kinsella <jlkinsel@gmail.com>
Wed, 22 Feb 2012 18:55:07 +0000 (10:55 -0800)
committerJohn Kinsella <jlkinsel@gmail.com>
Wed, 22 Feb 2012 18:55:07 +0000 (10:55 -0800)
  * Added logic to define path to easyrsa files based on OS type
  * Added exec resource to ensure copied easyrsa files are executable

manifests/server.pp

index aa0c32d..771ca1c 100644 (file)
@@ -3,6 +3,11 @@
 define openvpn::server($country, $province, $city, $organization, $email) {
     include openvpn
 
+    $easyrsa_source = $operatingsystem ? {
+      'centos' => '/usr/share/doc/openvpn-2.2.0/easy-rsa/2.0',
+      default => '/usr/share/doc/openvpn/examples/easy-rsa/2.0'
+    }
+
     file {
         "/etc/openvpn/${name}":
             ensure => directory,
@@ -19,10 +24,16 @@ define openvpn::server($country, $province, $city, $organization, $email) {
 
     exec {
         "copy easy-rsa to openvpn config folder ${name}":
-            command => "/bin/cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/${name}/easy-rsa",
+            command => "/bin/cp -r ${easyrsa_source} /etc/openvpn/${name}/easy-rsa",
             creates => "/etc/openvpn/${name}/easy-rsa",
+            notify => Exec["fix_easyrsa_file_permissions"],
             require => File["/etc/openvpn/${name}"];
     }
+    exec {
+        "fix_easyrsa_file_permissions":
+            refreshonly => "true",
+            command => "/bin/chmod 755 /etc/openvpn/${name}/easy-rsa/*";
+    }
     file {
         "/etc/openvpn/${name}/easy-rsa/vars":
             ensure  => present,