Is any reliable method available for including a conditional in a Vagrantfile
, for use in Vagrant, 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
type
parameter, for all separate invocations ofsynced_folder
. - Apply also conditionally the value for
accessmode
, based on one of the tests given above.
Might anyone offer 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?