Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rgl/vagrant-execute
Vagrant plugin to execute commands inside a VM from the host machine
https://github.com/rgl/vagrant-execute
vagrant
Last synced: 30 days ago
JSON representation
Vagrant plugin to execute commands inside a VM from the host machine
- Host: GitHub
- URL: https://github.com/rgl/vagrant-execute
- Owner: rgl
- License: lgpl-3.0
- Created: 2017-04-26T10:07:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-14T11:08:25.000Z (over 6 years ago)
- Last Synced: 2024-11-14T13:42:52.242Z (about 1 month ago)
- Topics: vagrant
- Language: Ruby
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Vagrant Execute Command
[![Latest version released](https://img.shields.io/gem/v/vagrant-execute.svg)](https://rubygems.org/gems/vagrant-execute)
[![Package downloads count](https://img.shields.io/gem/dt/vagrant-execute.svg)](https://rubygems.org/gems/vagrant-execute)This is a Vagrant plugin to execute commands inside a VM from the host machine.
**NB** This was only tested with Vagrant 2.0.3 and Windows Server 2016.
# Installation
```bash
vagrant plugin install vagrant-execute
```# Usage
The general syntax is:
```plain
vagrant execute [vm-name] [--sudo] <-c|--command>
```To troubleshoot, set the `VAGRANT_LOG` environment variable to `debug`.
## Example
In this repo there's an example [Vagrantfile](Vagrantfile). Use it to launch
an example.Install the [Base Windows Box](https://github.com/rgl/windows-2016-vagrant).
Launch the VM:
```bash
vagrant up
```Execute a command without and with administrative privileges and compare the results:
```bash
vagrant execute -c 'whoami /all' >whoami.txt
vagrant execute -c 'whoami /all' --sudo >whoami-sudo.txt
meld whoami.txt whoami-sudo.txt # or diff -u whoami.txt whoami-sudo.txt
```# Development
To hack on this plugin you need to install [Bundler](http://bundler.io/)
and other dependencies. On Ubuntu:```bash
sudo apt install bundler libxml2-dev zlib1g-dev
```Then use it to install the dependencies:
```bash
bundle
```Build this plugin gem:
```bash
rake
```Then install it into your local vagrant installation:
```bash
vagrant plugin install pkg/vagrant-execute-*.gem
```You can later run everything in one go:
```bash
rake && vagrant plugin uninstall vagrant-execute && vagrant plugin install pkg/vagrant-execute-*.gem
```