No commit activity in last 3 years
No release in over 3 years
Custom commands for Vagrant local development environments
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 10
 Project Readme

Vagrant Commands

Vagrant plugin for custom console commands

Overview

Vagrant Commands allows you to define arbitrary subcommands for your Vagrant development environments, allowing you to execute scripts on your Vagrant guests using custom interfaces defined in YAML.

Installation

To install, run vagrant plugin install vagrant-commands

Usage

The plugin looks for a vagrant-commands.yml file in the same directory as your vagrantfile. An example vagrant-commands.yml file might be:

commands:
  - name: hello
    synopsis: say "Hello, World!"
    machine: default
    exec:
      command: echo "Hello, World!"
      
  - name: restart
    synopsis: restart Apache service
    machine: default
    exec:
      command: systemctl restart httpd.service

Commands defined in vagrant-commands.yml will be shown in the Vagrant help screen like all other commands.

Limitations

This plugin has only been confirmed working with environments that use a single virtual machine. Basic support for multi-machine environments has been implemented but has not been confirmed working.

Because this plugin currently relies on SSH to execute commands, it is not compatible with Windows guests.

Going Forward

I'd like to make additions and improvements to this plugin in the future. Some things I'd like to implement sometime soon, in no particular order:

  • Test and improve functionality for environments with multiple machines
  • Improve compatibility with Windows guests by using WinRM instead of SSH
  • Allow commands to be defined in vagrant-commands.yml that are executed locally instead of in the guest
  • Allow configuration file path (e.g. vagrant-commands.yml) to be changed in vagrantfile