Defined Type: vagrant::plugin

Defined in:
modules/vagrant/manifests/plugin.pp

Overview

Define: vagrant::plugin

Provision a Vagrant plugin

Parameters:

ensure

Whether the plugin should be installed. (default: present)

plugin

Plugin name. (default: $title)

Parameters:

  • ensure (Any) (defaults to: 'present')
  • plugin (Any) (defaults to: $title)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'modules/vagrant/manifests/plugin.pp', line 12

define vagrant::plugin (
    $ensure = 'present',
    $plugin = $title,
) {
    require ::vagrant

    Exec {
        user        => 'mwvagrant',
        cwd         => $::vagrant::vagrant_home,
        environment => "VAGRANT_HOME=${::vagrant::vagrant_home}"
    }

    if $ensure == 'present' {
        exec { "install_vagrant_plugin_${title}":
            command => "/usr/bin/vagrant plugin install ${plugin}",
            unless  => "/usr/bin/vagrant plugin list | /bin/grep -q ${plugin}",
        }
    } else {
        exec { "uninstall_vagrant_plugin_${title}":
            command => "/usr/bin/vagrant plugin uninstall ${plugin}",
            onlyif  => "/usr/bin/vagrant plugin list | /bin/grep -q ${plugin}",
        }
    }
}