-
-
Notifications
You must be signed in to change notification settings - Fork 633
Added name to Ansible provisioner in Vagrantfile #1589
Conversation
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| |
There was a problem hiding this comment.
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| |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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|There was a problem hiding this comment.
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_provisionerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
|
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? |
|
Running again to see if it works now. |
|
...and trying again, because my upstream change caused a rubocop fail. |
|
There we go! |
Vagrant >= 1.7 allows provisioners to be named meaning they can be targeted by name with
--provision-withrather than just by type (e.g.ansible).This PR allows Drupal VM's Ansible provisioner to be targeted specifically if desired:
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.