Is any reliable method available for including a conditional in a
Vagrantfile to select method of folder syncing based on provider?
Presently, I have included the following line:
config.vm.synced_folder "proj", "/srv", type: "9p", accessmode: "mapped"
However, the following represent a few possible improvements:
- Use type “9p” only if the provider is libvirt, otherwise use some other, particular method.
- As above, but use whatever method is default for the provider, if the provider is not libvirt.
- As above, but test not whether the provider is libvirt, but simply whether support is available for the type “9p”.
- Select a method globally, rather than as the
typeparameter, for all separate invocations of
- Apply also conditionally the value for
accessmode, based on one of the tests given above.
I am interested in recipes for making the
Vagrantfile more robust and portable, through any of the above suggestions that may be feasible, given the capabilities of the tools. Of course, it is no small obstacle that I have no experience in Ruby.