pmyjavec / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies

Home Page:http://tmatilai.github.io/vagrant-proxyconf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxy Configuration Plugin for Vagrant

[![Gem Version](https://badge.fury.io/rb/vagrant-proxyconf.png)][gem] [![Build Status](https://travis-ci.org/tmatilai/vagrant-proxyconf.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/tmatilai/vagrant-proxyconf.png)][gemnasium] [![Code Climate](https://codeclimate.com/github/tmatilai/vagrant-proxyconf.png)][codeclimate]

A Vagrant plugin that configures the virtual machine to use specified proxies for package managers etc.

At this state we support:

  • APT proxy/cacher

Support is planned for other package managers (at least yum).

Compatibility

This plugin requires Vagrant 1.2 or newer (downloads).

The plugin is supposed to be compatible with all Vagrant providers. Please file an issue if this is not the case. The following providers are confirmed to work: AWS, Digital Ocean, VirtualBox, VMware Fusion.

Installation

Install using standard Vagrant plugin installation method:

vagrant plugin install vagrant-proxyconf

Usage

The plugin hooks itself to all Vagrant commands triggering provisioning (e.g. vagrant up, vagrant provision, etc.). The proxy configurations are written just before provisioners are run.

Proxy settings can be configured in Vagrantfile. In the common case that you want to use the same configuration in all Vagrant machines, you can use $HOME/.vagrant.d/Vagrantfile or environment variables. Package manager specific settings are only used on supporting platforms (i.e. Apt configuration on Debian based systems), so there is no harm using global configuration.

Project specific Vagrantfile overrides global settings. Environment variables override both.

Apt

Configures Apt to use the specified proxy settings. The configuration will be written to /etc/apt/apt.conf.d/01proxy on the guest.

Example Vagrantfile

Vagrant.configure("2") do |config|
  config.apt_proxy.http  = "192.168.33.1:3142"
  config.apt_proxy.https = "DIRECT"
  # ... other stuff
end

Configuration keys

  • config.apt_proxy.http - The proxy for HTTP URIs
  • config.apt_proxy.https - The proxy for HTTPS URIs
  • config.apt_proxy.ftp - The proxy for FTP URIs

Possible values

  • If all keys are unset or nil, no configuration is written.
  • A proxy can be specified in the form of [http://][user:pass@]host[:port]. So all but the host part are optional. The default port is 3142 and protocol is the same as the key.
  • Empty string ("") or false in any protocol also force the configuration file to be written, but without configuration for that protocol. Can be used to clear the old configuration and/or override a global setting.
  • "DIRECT" can be used to specify that no proxy should be used. This is mostly useful for disabling proxy for HTTPS URIs when HTTP proxy is set (as Apt defaults to the latter).
  • Please refer to apt.conf(5) manual for more information.

Environment variables

  • APT_PROXY_HTTP
  • APT_PROXY_HTTPS
  • APT_PROXY_FTP

These also override the Vagrantfile configuration. To disable or remove the proxy use "DIRECT" or an empty value.

For example to spin up a VM, run:

APT_PROXY_HTTP="proxy.example.com:8080" vagrant up

Running apt-cacher-ng on a Vagrant box

Here is an example for setting up apt-cacher proxy server in a Vagrant VM.

Related plugins and projects

  • apt-cacher-box
    a Vagrant setup for apt-cacher-ng.
  • vagrant-cachier
    An excellent Vagrant plugin that shares various cache directories among similar VM instances. Should work fine together with vagrant-proxyconf.
  • vagrant-httpproxy
    A Chef cookbook for configuring Chef resources to use the specified proxy (while offline).
  • vagrant-proxy
    A Vagrant plugin that uses iptables rules to force the VM to use a proxy.

About

Vagrant plugin that configures the virtual machine to use proxies

http://tmatilai.github.io/vagrant-proxyconf/

License:MIT License