Module: VagrantBolt

Defined in:
lib/vagrant-bolt.rb,
lib/vagrant-bolt/version.rb

Defined Under Namespace

Modules: Config, ConfigBuilder, Util Classes: Command, Plugin, Provisioner, Runner

Constant Summary collapse

VERSION =
'0.4.1'

Class Method Summary collapse

Class Method Details

.command(command, env, machine, **args) ⇒ nil

Run a bolt command with the specified parameters

Examples:

VagrantBolt.command('/bin/echo "test"', env, machine, run_as: "root")

Parameters:

  • command (String)

    The command to run

  • env (Object)

    The environment

  • machine (Object)

    The machine

  • args (Hash)

    A optional hash of bolt config overrides. No merging will be done with these overrides.

Returns:

  • (nil)


45
46
47
48
# File 'lib/vagrant-bolt.rb', line 45

def self.command(command, env, machine, **args)
  runner = VagrantBolt::Runner.new(env, machine)
  runner.run(:command, command, **args)
end

.plan(plan, env, machine, **args) ⇒ nil

Run a bolt plan with the specified parameters

Examples:

VagrantBolt.plan('facts', env, machine, run_as: "root", params: {planparam: "value"})

Parameters:

  • plan (String)

    The name of the bolt plan to run

  • env (Object)

    The environment

  • machine (Object)

    The machine

  • args (Hash)

    A optional hash of bolt config overrides. No merging will be done with these overrides.

Returns:

  • (nil)


31
32
33
34
# File 'lib/vagrant-bolt.rb', line 31

def self.plan(plan, env, machine, **args)
  runner = VagrantBolt::Runner.new(env, machine)
  runner.run(:plan, plan, **args)
end

.source_rootString

Return the root directory of the source

Returns:

  • (String)

    the source root path



52
53
54
# File 'lib/vagrant-bolt.rb', line 52

def self.source_root
  @source_root ||= File.expand_path(__DIR__)
end

.task(task, env, machine, **args) ⇒ nil

Runs a bolt task with the specified parameters

Examples:

VagrantBolt.task('facts', env, machine, run_as: "root", params: {taskparam: "value"})

Parameters:

  • task (String)

    The name of the bolt task to run

  • env (Object)

    The environment

  • machine (Object)

    The machine

  • args (Hash)

    A optional hash of bolt config overrides. No merging will be done with these overrides.

Returns:

  • (nil)


17
18
19
20
# File 'lib/vagrant-bolt.rb', line 17

def self.task(task, env, machine, **args)
  runner = VagrantBolt::Runner.new(env, machine)
  runner.run(:task, task, **args)
end