I use Trellis for my WordPress development. It works great, except I'm finding it hard to change file (or directory) permission within the synced folder.
Generally I'm OK with the default permission setup. However, sometimes I need to give write permission to some of the sub-directories of the main (NFS) synced directory.
This is the Vagrantfile that uses Ansible playbook for the main configuration of the VM (I use VirtualBox). I'm not a Ruby programmer nor have I worked with Ansible, however, by the looks of it, the following is the part of the
Vagrantfile where file permissions are being set:
if Vagrant::Util::Platform.windows? and !Vagrant.has_plugin? 'vagrant-winnfsd' wordpress_sites.each_pair do |name, site| config.vm.synced_folder local_site_path(site), remote_site_path(name, site), owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775'] end config.vm.synced_folder ANSIBLE_PATH, ANSIBLE_PATH_ON_VM, mount_options: ['dmode=755', 'fmode=644'] config.vm.synced_folder File.join(ANSIBLE_PATH, 'bin'), bin_path, mount_options: ['dmode=755', 'fmode=755'] else if !Vagrant.has_plugin? 'vagrant-bindfs' fail_with_message "vagrant-bindfs missing, please install the plugin with this command:\nvagrant plugin install vagrant-bindfs" else wordpress_sites.each_pair do |name, site| config.vm.synced_folder local_site_path(site), nfs_path(name), type: 'nfs' config.bindfs.bind_folder nfs_path(name), remote_site_path(name, site), u: 'vagrant', g: 'www-data', o: 'nonempty' end config.vm.synced_folder ANSIBLE_PATH, '/ansible-nfs', type: 'nfs' config.bindfs.bind_folder '/ansible-nfs', ANSIBLE_PATH_ON_VM, o: 'nonempty', p: '0644,a+D' config.bindfs.bind_folder bin_path, bin_path, perms: '0755' end end
How can I make changes to this file in a way so that I can control permission to specific files and folders when I need. Since changing the permission within the vagrant synced folder on the host machine doesn't reflect on the Virtual Machine, I must at least be able to do it by changing the Vagrantfile and then re-provisioning.
How can I achieve this easily that will persist upon future re-provisioning?