Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Conversation

@dixhuit
Copy link
Contributor

@dixhuit dixhuit commented Oct 21, 2017

Vagrant >= 1.7 allows provisioners to be named meaning they can be targeted by name with --provision-with rather than just by type (e.g. ansible).

This PR allows Drupal VM's Ansible provisioner to be targeted specifically if desired:

# Just provision with Drupal VM in isolation
vagrant provision --provision-with drupalvm

# Jump to my "otherprovisioner", don't provision with drupalvm
vagrant provision --provision-with otherprovisioner

I've been using Drupal VM with an additional Vagrantfile and multiple additional provisioners and being able to run a single provisioner in isolation has been very useful when debugging.

This is allows Drupal VM's Ansible provisioner to be targeted specifically if desired (i.e. you're debugging more than one Vagrantfile):

vagrant provision --provision-with drupalvm
Vagrantfile Outdated
end

config.vm.provision provisioner do |ansible|
config.vm.provision "drupalvm", type: "ansible" do |ansible|
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like rubocop is angry about this formatting:

1.32s$ rubocop ./Vagrantfile ./lib/drupalvm --except LineLength,Eval,MutableConstant,BlockLength,MethodLength,ConditionalAssignment,IndentArray,AlignParameters
Inspecting 2 files
C.
Offenses:
Vagrantfile:105:23: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  config.vm.provision "drupalvm", type: "ansible"  do |ansible|
                      ^^^^^^^^^^
Vagrantfile:105:41: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  config.vm.provision "drupalvm", type: "ansible"  do |ansible|
                                        ^^^^^^^^^
Vagrantfile:105:50: C: Unnecessary spacing detected.
  config.vm.provision "drupalvm", type: "ansible"  do |ansible|
                                                 ^
2 files inspected, 3 offenses detected
The command "rubocop ./Vagrantfile ./lib/drupalvm --except LineLength,Eval,MutableConstant,BlockLength,MethodLength,ConditionalAssignment,IndentArray,AlignParameters" exited with 1.

See build: https://travis-ci.org/geerlingguy/drupal-vm/jobs/290870836#L508-L527

Vagrantfile Outdated
end

config.vm.provision provisioner do |ansible|
config.vm.provision 'drupalvm', type: 'ansible' do |ansible|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep using the provisioner variable for type as it supports both ansible and ansible_local.

Copy link
Contributor Author

@dixhuit dixhuit Jan 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that! So like this?

config.vm.provision 'drupalvm', type: 'provisioner' do |ansible|

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.vm.provision 'drupalvm', type: provisioner do |ansible|

Earlier on in the Vagrantfile the variable is set (vagrant_provisioner is a function in lib/drupalvm/vagrant.rb):

provisioner = vconfig['force_ansible_local'] ? :ansible_local : vagrant_provisioner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

@dixhuit
Copy link
Contributor Author

dixhuit commented Mar 29, 2018

Needed this today and couldn't remember if ever got merged!

Looking into it, there's no info from Travis about why it failed some of the jobs in the last build. Was Travis just having a bad day and the build needs to be restarted?

@geerlingguy
Copy link
Owner

Running again to see if it works now.

@geerlingguy
Copy link
Owner

...and trying again, because my upstream change caused a rubocop fail.

@geerlingguy geerlingguy merged commit 90d5157 into geerlingguy:master Oct 10, 2018
@geerlingguy
Copy link
Owner

There we go!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants