2017 © Pedro Peláez
 

library the-vagrant

Install a Vagrant environment into a Drupal project.

image

palantirnet/the-vagrant

Install a Vagrant environment into a Drupal project.

  • Monday, July 30, 2018
  • by palantirnet
  • Repository
  • 31 Watchers
  • 1 Stars
  • 4,856 Installations
  • Ruby
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 7 Open issues
  • 26 Versions
  • 92 % Grown

The README.md

"The" Vagrant

Add a customizable vagrant environment into a Drupal project. This may be used in conjunction with the drupal-skeleton and the-build, or it may be used to retrofit an existing project with a VM-based development environment., (*1)

Note: If you are setting up a new project, you likely want to start with drupal-skeleton., (*2)

Why the-vagrant?

Dependencies

Installation

To use the-vagrant on a project, you will need to:, (*3)

  1. Use composer to add the package to your project:, (*4)

    composer require --dev palantirnet/the-vagrant
    
  2. Run the-vagrant's install script to add and configure the Vagrantfile:, (*5)

    vendor/bin/the-vagrant-installer
    
    • This will prompt you for project-specific configuration:
    • The project hostname
    • The project web root
    • Enable Solr
    • Enable HTTPS
    • Add a project-specific Ansible playbook to be run in addition to the default playbook
  3. Check in and commit the new Vagrantfile to git

If you need to change your configuration later, you can re-run the install script, or edit the Vagrantfile directly., (*6)

Updating

To update an existing installation of the-vagrant in a project, you will need to:, (*7)

  1. composer update palantirnet/the-vagrant
  2. Follow any steps from the release notes.

Note: If you need to update the underlying VM (the Vagrant box drupalbox, which includes PHP, Apache, MySQL, and Solr), you will need to run vagrant destroy then vagrant box update and vagrant up. Updating the VM doesn't always require updating the-vagrant, and vice versa., (*8)

Customizing your environment

Several things can be configured during the interactive installation:, (*9)

  • The project hostname
  • The project web root
  • Enable Solr
  • Enable HTTPS

A few more things can be customized directly in your Vagrantfile:, (*10)

  • Extra hostnames for this VM (use this for multisite)
  • Extra apt packages to install
  • The PHP timezone

By default, the-vagrant references ansible roles from the package at vendor/palantirnet/the-vagrant/conf/vagrant/provisioning. If your project needs configuration beyond what is provided via in the Vagrantfile, you can re-run the install script and update the provisioning., (*11)

Run a custom playbook in addition to the defaults

  1. Re-run the install script: vendor/bin/the-vagrant-installer
  2. When you are prompted to copy the Ansible roles, reply n
  3. When you are prompted to add an additional Ansible playbook to your project, reply Y, (*12)

    Copy Ansible roles into your project for customization (Y,n) [n]? n, (*13)

    OR add an additional Ansible playbook to your project (Y,n) [n]? Y, (*14)

  4. This will create a new provisioning directory in your project that contains a simple Ansible playbook and example role. Your Vagrantfile will refer to this playbook in addition to the one in the vendor directory.
  5. Check in and commit this new provisioning directory and updated Vagrantfile to git
  6. Add or update the roles and playbook as necessary.

Tips for developing Ansible playbooks and roles

  • The Ansible documentation has an Intro to Playbooks
  • Check the syntax of a playbook:, (*15)

    ansible-playbook --syntax-check provisioning/my_playbook.yml
    
  • Run a playbook against a Vagrant box without re-provisioning the box:, (*16)

    ansible-playbook -u vagrant -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory provisioning/my_playbook.yml
    
  • Debug step outputs and variables within a role using the debug module:, (*17)

    - name: Some command
      command: ls
      register: my_command_output
    - name: Some debugging
      debug:
        var: my_command_output
    
  • Add third-party roles from Ansible Galaxy:, (*18)

    1. Create a requirements.yml file at provisioning/requirements.yml
    2. Configure the ansible.galaxy_role_file and ansible.galaxy_roles_path properties for the custom playbook in your Vagrantfile:
    if (defined?(ansible_custom_playbook) && !ansible_custom_playbook.empty?)
        config.vm.provision "myproject-provision", type: "ansible" do |ansible|
            ansible.playbook = ansible_custom_playbook
            ansible.galaxy_role_file = "provisioning/requirements.yml"
            ansible.galaxy_roles_path = "provisioning/roles/"
        end
    end
    
  • In the Vagrantfile, pass additional configuration through to the Ansible provisioners. A great use case for this is setting the php_ini_memory_limit when using the default palantirnet/the-vagrant provisioning:, (*19)

    ansible.extra_vars = {
      "project" => project,
      "hostname" => hostname,
      "extra_hostnames" => extra_hostnames,
      "solr_enabled" => ansible_solr_enabled,
      "https_enabled" => ansible_https_enabled,
      "project_web_root" => ansible_project_web_root,
      "timezone" => ansible_timezone,
      "system_packages" => ansible_system_packages,
      "php_ini_memory_limit" => "512M",
    }
    

Default Software

the-vagrant uses Vagrant boxes built with palantirnet/devkit. Releases of this Vagrant base box are on Vagrant Cloud. You can find more information about the specifics of accessing default software like MySQL, Solr, and Mailhog in the Drupalbox README., (*20)

Compatibility between the-vagrant and base boxes

Some versions of the-vagrant are coordinated with releases of the palantir/drupalbox Vagrant box:, (*21)

the-vagrant version palantir/drupalbox version Vagrant provider Vagrant version
2.2.0 >= 1.2.0, < 2.0 virtualbox >= 2.1.0
2.1.0 >= 1.2.0, < 2.0 virtualbox
2.0.1 1.1.1, 1.2.0 virtualbox
2.0.0 1.1.0, 1.1.1 virtualbox, vmware_desktop (drupalbox v1.1.0 only)
0.6.0 - 1.1.1 >= 0.2.4, < 1.0 virtualbox, vmware_desktop

* Note that version 1.2.0 of the palantir/drupalbox VM requires updating to version 2.0.1 of palantirnet/the-vagrant., (*22)


Copyright 2016 - 2020 Palantir.net, Inc., (*23)

The Versions

30/07 2018

dev-develop

dev-develop

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

30/07 2018

2.2.0-alpha

2.2.0.0-alpha

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

28/07 2018

dev-update-triggers

dev-update-triggers

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

28/06 2018

dev-release

dev-release

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

28/06 2018

2.1.0

2.1.0.0

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

09/05 2018

dev-deprecate-vmware

dev-deprecate-vmware

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

09/05 2018

dev-fix-solr-flag

dev-fix-solr-flag

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

02/05 2018

dev-drushrc-location

dev-drushrc-location

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

06/04 2018

2.0.1

2.0.1.0

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

15/12 2017

dev-zshrc-fix

dev-zshrc-fix

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

11/11 2017

2.0.0

2.0.0.0

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

26/09 2017

1.1.1

1.1.1.0

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

26/09 2017

dev-release-1.x

dev-release-1.x

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

13/09 2017

dev-drupal-vm

dev-drupal-vm

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

07/07 2017

1.1.0

1.1.0.0

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

26/05 2017

dev-additional-playbook

dev-additional-playbook

Install a Vagrant environment into a Drupal project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

23/02 2017

dev-drupal-vm-provisioning

dev-drupal-vm-provisioning

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

16/02 2017

1.0.0

1.0.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

27/01 2017

0.7.1

0.7.1.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

25/01 2017

0.7.0

0.7.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

13/01 2017

dev-master

9999999-dev

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

13/01 2017

0.6.0

0.6.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

01/12 2016

0.5.1

0.5.1.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

18/11 2016

0.5.0

0.5.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

29/09 2016

0.4.0

0.4.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net

15/04 2016

0.3.0

0.3.0.0

Install a vagrant environment into a project.

  Sources   Download

proprietary

The Requires

 

by Palantir.net