Vagrant provision production servers

Use Vagrant to provision production stack in any Cloud VPS

Vagrant has been widely adopted by many and has the variety of usages to streamline development and production server environments. In this article, we show how to use Vagrant to provision production or development environment to our SSD Cloud VPS.

Before you begin, make sure you have

  1. the latest version of Vagrant installed
  2. running SSD Cloud VPS server
  3. working SSH access (username and password or SSH key available).

1. Setting up your local environment

Installing managed servers plugin for vagrant from

In the terminal, execute:

vagrant plugin install vagrant-managed-servers

2. Configure your preferred environment in puphpet

  1. Make note of your operating system and make sure you use the matching one via
  2. Select “local” for the deploy target
  3. Select the matching Linux OS.
  4. Make sure Vagrant is selected as the provider.
  5. Navigate through the rest of the pages and configure your web server, database server, search servers as required. The allows to configure SSL certificates, even rsync folders from your computer and import a database from the file stored in your folder.
  6. Download and extract the resulting archive to your local folder

3. Setting up Vagrantfile

In the Vagrantfile you can now use the managed provider and specify the managed server’s hostname and credentials:

Vagrant.configure("2") do |config| = "tknerr/managed-server-dummy"

  config.vm.provider :managed do |managed, override|

  managed.server = ""

  override.ssh.username = "bob"

  override.ssh.private_key_path = "/path/to/bobs_private_key"



Provision production server with Vagrant

Next run vagrant up --provider=managed in order to “link” the vagrant VM with the managed server:

$ vagrant up --provider=managed 
Bringing machine 'default' up with 'managed' provider... 
==> default: Box 'tknerr/managed-server-dummy' could not be found. Attempting to find and install... 
    default: Box Provider: managed 
    default: Box Version: >= 0 
==> default: Loading metadata for box 'tknerr/managed-server-dummy' 
    default: URL: 
==> default: Adding box 'tknerr/managed-server-dummy' (v1.0.0) for provider: managed 
    default: Downloading: 
    default: Progress: 100% (Rate: 122k/s, Estimated time remaining: --:--:--) 
==> default: Successfully added box 'tknerr/managed-server-dummy' (v1.0.0) for 'managed'! 
==> default: Linking vagrant with managed server 
==> default: -- Server:

Once linked, you can run vagrant ssh to ssh into the managed server or vagrant provision to provision that server with any of the available vagrant provisioners:

$ vagrant provision 
$ vagrant ssh 

To reboot the managed server from the local terminal, run vagrant reload

When you complete configuring your server, you can “unlink” vagrant from the managed server by running: vagrant destroy

$ vagrant destroy -f 
==> default: Unlinking vagrant from managed server 
==> default: -- Server:

For other configuration options, including folders rsync (Linux and Windows), refer to the github page.

Posted in How to and tagged .