{"id":13492425,"url":"https://github.com/joefitzgerald/packer-windows","last_synced_at":"2025-09-27T07:31:41.157Z","repository":{"id":9772064,"uuid":"11742728","full_name":"joefitzgerald/packer-windows","owner":"joefitzgerald","description":"Windows Packer Templates","archived":true,"fork":false,"pushed_at":"2019-08-05T14:35:46.000Z","size":445,"stargazers_count":1634,"open_issues_count":40,"forks_count":1122,"subscribers_count":99,"default_branch":"master","last_synced_at":"2025-01-11T06:45:36.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joefitzgerald.png","metadata":{"files":{"readme":"README-rsync.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-29T15:21:35.000Z","updated_at":"2025-01-05T01:05:15.000Z","dependencies_parsed_at":"2022-08-07T05:01:18.111Z","dependency_job_id":null,"html_url":"https://github.com/joefitzgerald/packer-windows","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fpacker-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fpacker-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fpacker-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fpacker-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joefitzgerald","download_url":"https://codeload.github.com/joefitzgerald/packer-windows/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234410231,"owners_count":18828160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:05.919Z","updated_at":"2025-09-27T07:31:40.545Z","avatar_url":"https://github.com/joefitzgerald.png","language":"PowerShell","funding_links":[],"categories":["PowerShell","Repositories","\u003ca id=\"b478e9a9a324c963da11437d18f04998\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"6d2fe834b7662ecdd48c17163f732daf\"\u003e\u003c/a\u003eEnvironment\u0026\u0026环境\u0026\u0026配置"],"readme":"# How to enable RSync for Windows Templates\n\n## Introduction\n\nThis document explains how to install RSync into the Windows boxes to be able to use Vagrant's synced folder type `rsync`. Read the [Vagrant Docs](https://docs.vagrantup.com/v2/synced-folders/rsync.html) for more details and the additional vagrant commands.\n\n## Prerequisites\n\n### SSH\n\nTo use `rsync` in the Windows boxes you also will need that SSH is installed and enabled. At the time of writing OpenSSH will always be installed to make the packer build work. This is part of the `Autounattend.xml` answer files.\n\nIn the future SSH might disappear from default installation as packer will be able to communicate through WinRM with the Windows box. For rsync you then have to add the `scripts/openssh.ps1` again to have OpenSSH up and running.\n\n## Installation\n\nTo install `rsync` in the Windows boxes you have to add the `./scripts/rsync.bat` script to the packer template's shell provisioner scripts as shown in this example:\n\n```json\n  \"provisioners\": [\n    {\n      \"type\": \"shell\",\n      \"remote_path\": \"/tmp/script.bat\",\n      \"execute_command\": \"{{.Vars}} cmd /c C:/Windows/Temp/script.bat\",\n      \"scripts\": [\n        \"./scripts/vm-guest-tools.bat\",\n        \"./scripts/chef.bat\",\n        \"./scripts/vagrant-ssh.bat\",\n        \"./scripts/compile-dotnet-assemblies.bat\",\n        \"./scripts/rsync.bat\",\n        \"./scripts/compact.bat\"\n      ]\n    },\n```\n\nThe script also creates a symlink so that the folder `/vagrant` could be used in the Vagrantfile to sync files to `C:\\vagrant`. So the example from the Vagrant documentation works without any changes.\n\n## Enable RSync in a Vagrantfile\n\nThe following is an example of using RSync to sync a folder into a Windows box. Please notice that we have to forward the SSH port as it will not be forwarded automatically at the moment.\n```ruby\n# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\nVAGRANTFILE_API_VERSION = \"2\"\n\nVagrant.configure(VAGRANTFILE_API_VERSION) do |config|\n  config.vm.box = \"windows_2012_r2\"\n\n  config.vm.synced_folder \".\", \"/vagrant\", type: \"rsync\", rsync__exclude: \".git/\"\n\n  config.vm.network :forwarded_port, guest: 22, host: 2222, id: \"ssh\", auto_correct: true\n\n  config.vm.provider \"virtualbox\" do |vb|\n    vb.gui = true\n  end\nend\n```\n\nIf you want to sync into another directory of the Windows box, use the Cygwin path prefix `/cygdrive/c` as shown in this example:\n\n```ruby\n  config.vm.synced_folder '.', \"/cygdrive/c/vagrant-rsync\",\n    type: \"rsync\",\n    rsync__auto: \"true\",\n    rsync__exclude: [\".git/\",\".vagrant/\"],\n    id: \"vagrant\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoefitzgerald%2Fpacker-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoefitzgerald%2Fpacker-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoefitzgerald%2Fpacker-windows/lists"}