diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-10-15 15:24:24 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-10-15 15:24:24 -0300 |
commit | 5cbcdb956b0bacb02229ca2085aa1245e7308dcc (patch) | |
tree | 636506f32a8c1d56a9abe47638603d495a535df6 | |
parent | bb027aa4e2946d9875aa1499f22cddde3d41fea3 (diff) | |
download | puppet-virtual-5cbcdb956b0bacb02229ca2085aa1245e7308dcc.tar.gz puppet-virtual-5cbcdb956b0bacb02229ca2085aa1245e7308dcc.tar.bz2 |
Adds udev param into virtual::kvm::manager
-rw-r--r-- | manifests/kvm/manager/instance.pp | 11 | ||||
-rw-r--r-- | templates/kvm_creator.rules.erb | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/manifests/kvm/manager/instance.pp b/manifests/kvm/manager/instance.pp index 4f52310..4957645 100644 --- a/manifests/kvm/manager/instance.pp +++ b/manifests/kvm/manager/instance.pp @@ -2,6 +2,7 @@ define virtual::kvm::manager::instance( $vg, $size, $ram, + $udev = false, ) { exec { "kvm-creator-${name}": command => "/usr/local/sbin/kvm-creator create $name $vg $size $ram", @@ -22,4 +23,14 @@ define virtual::kvm::manager::instance( creates => "/etc/service/${name}", require => [ Exec["kvm-creator-${name}"], User["${name}"] ], } + + if $udev == true { + file { "/etc/udev/rules.d/92-kvm_creator-${name}.rules": + ensure => present, + owner => root, + group => root, + mode => 0644, + content => template('virtual/kvm_creator.rules.erb'), + } + } } diff --git a/templates/kvm_creator.rules.erb b/templates/kvm_creator.rules.erb new file mode 100644 index 0000000..8267d90 --- /dev/null +++ b/templates/kvm_creator.rules.erb @@ -0,0 +1,3 @@ +ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= scope.lookupvar('::hostname') %>-<%= @name %>", GROUP="<%= @name %>" +ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= @name %>", GROUP="<%= @name %>" +ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= @name %>1", GROUP="<%= @name %>" |