Puppet Class: libvirt::config

Inherits:
libvirt
Defined in:
manifests/config.pp

Overview

libvirt::config

Parameters:

  • qemu_hook (String) (defaults to: $libvirt::qemu_hook)

    source name for qemu hook

  • qemu_conf (Hash) (defaults to: $libvirt::qemu_conf)

    configuration that goes into qemu.conf

  • uri_aliases (Array) (defaults to: $libvirt::uri_aliases)

    uri alias from libvirt.conf

  • uri_default (String) (defaults to: $libvirt::uri_default)

    uri default from libvirt.conf

  • default_conf (Hash) (defaults to: $libvirt::default_conf)

    defaults for libvirtd.conf

  • libvirtd_conf (Hash[Optional[String],Variant[String,Integer,Array]]) (defaults to: $libvirt::libvirtd_conf)

    libvirtd.conf configs

  • config_dir (String) (defaults to: $libvirt::config_dir)

    directory for configs



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'manifests/config.pp', line 22

class libvirt::config (
  String                                               $qemu_hook        = $libvirt::qemu_hook,
  Hash                                                 $qemu_conf        = $libvirt::qemu_conf,
  Array                                                $uri_aliases      = $libvirt::uri_aliases,
  String                                               $uri_default      = $libvirt::uri_default,
  Hash                                                 $default_conf     = $libvirt::default_conf,
  Hash[Optional[String],Variant[String,Integer,Array]] $libvirtd_conf    = $libvirt::libvirtd_conf,
  String                                               $config_dir       = $libvirt::config_dir,
) inherits libvirt {

  if ($qemu_hook != '') {
    file {"${config_dir}/hooks/qemu":
      owner  => 'root',
      group  => 'root',
      mode   => '0755',
      source => "puppet:///modules/libvirt/hooks/qemu/${libvirt::qemu_hook}",
    }
  }

  if ($qemu_conf != {}) {
    file {"${config_dir}/qemu.conf":
      owner   => 'root',
      group   => 'root',
      mode    => '0600',
      content => template('libvirt/qemu.conf.erb'),
    }
  }

  if ( $uri_default != '' ) or ( $uri_aliases != [] ) {
    file {"${config_dir}/libvirt.conf":
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template('libvirt/libvirt.conf.erb'),
    }
  }

  $default_conf.each | String $key, String $value | {
    libvirtd_default {
      $key: value => $value;
    }
  }

  $libvirtd_conf.each | String $key, Variant[String,Integer,Array] $value | {
    if $value =~ Array {
      libvirtd_conf { $key:
        value => join(['["', $value.join('","'), '"]']);
      }
    } else {
      libvirtd_conf { $key:
        value => $value,
      }
    }
  }
}