Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Sync hosts dir with proper permissions #460

Merged
merged 1 commit into from
Jan 17, 2016

Conversation

fullyint
Copy link
Contributor

To run Ansible commands directly, Windows users have had to adjust permissions for files in the synced hosts directory. This PR implements @QWp6t's approach of syncing hosts with the proper permissions.

I bumped the Vagrant requirement to 1.8 to take advantage of the shell provisioner's new env option which enables us to pass the ANSIBLE_PATH_ON_VM to windows.sh.

Could a Windows user test and confirm that this works?

@fullyint fullyint force-pushed the hosts-sync branch 3 times, most recently from 21417f0 to 810e080 Compare January 12, 2016 09:20
@fullyint
Copy link
Contributor Author

This PR simplifies the command at the end of windows.sh:

- ansible-playbook ${ANSIBLE_PATH}/dev.yml -i ${TEMP_HOSTS}/development --sudo --user=vagrant --connection=local
+ ansible-playbook dev.yml
  • can use relative path to dev.yml because script already changed to that directory
  • -i - can use default hosts file now that hosts are synced into place with the right permissions
  • --sudo - already indicated as play parameter in dev.yml
  • --user=vagrant - already indicated as play parameter in dev.yml
  • --connection=local - I moved this to hosts/development which is only used for Windows anyway

@fullyint fullyint force-pushed the hosts-sync branch 2 times, most recently from 5239366 to ecc0bda Compare January 13, 2016 11:21
@fullyint
Copy link
Contributor Author

This PR originally synced the hosts directory over the top of the vm's hosts directory, just so it would have specific mount_options (i.e., no execute bit set for hosts files). The latest commit removes that sync folder and instead applies these mount_options to the primary vagrant sync folder that is already there.

@@ -51,6 +51,7 @@ Vagrant.configure('2') do |config|
end

if Vagrant::Util::Platform.windows?
config.vm.synced_folder '.', '/vagrant', mount_options: ['dmode=776', 'fmode=664']
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this mean that deploy.sh won't execute now?

@fullyint
Copy link
Contributor Author

@QWp6t correctly pointed out that mount_options: ['dmode=776', 'fmode=664'] on the primary vagrant sync folder would cause deploy.sh to not execute. I added a commit switching back to the approach of syncing the hosts directory with the needed permissions.

@QWp6t
Copy link
Member

QWp6t commented Jan 16, 2016

Just tested this. It works. 👍

fullyint added a commit that referenced this pull request Jan 17, 2016
Windows: Sync hosts dir with proper permissions
@fullyint fullyint merged commit c76089d into roots:master Jan 17, 2016
@fullyint fullyint deleted the hosts-sync branch January 17, 2016 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants