{"id":16323578,"url":"https://github.com/mefellows/packer-dsc","last_synced_at":"2026-03-09T11:33:30.621Z","repository":{"id":22748360,"uuid":"26093664","full_name":"mefellows/packer-dsc","owner":"mefellows","description":"DSC Provisioner for Packer.io","archived":false,"fork":false,"pushed_at":"2021-06-09T12:31:42.000Z","size":4813,"stargazers_count":29,"open_issues_count":3,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T22:55:16.136Z","etag":null,"topics":["automation","configuration-management","dsc","go","packer","windows"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/mefellows.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-11-02T21:24:36.000Z","updated_at":"2024-09-22T06:47:18.000Z","dependencies_parsed_at":"2022-08-21T01:10:34.086Z","dependency_job_id":null,"html_url":"https://github.com/mefellows/packer-dsc","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mefellows/packer-dsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mefellows%2Fpacker-dsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mefellows%2Fpacker-dsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mefellows%2Fpacker-dsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mefellows%2Fpacker-dsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mefellows","download_url":"https://codeload.github.com/mefellows/packer-dsc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mefellows%2Fpacker-dsc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30292479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T11:12:22.024Z","status":"ssl_error","status_checked_at":"2026-03-09T11:10:54.577Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["automation","configuration-management","dsc","go","packer","windows"],"created_at":"2024-10-10T22:55:11.185Z","updated_at":"2026-03-09T11:33:30.583Z","avatar_url":"https://github.com/mefellows.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Packer DSC Provisioner\n\nA [Desired State Configuration](http://technet.microsoft.com/en-au/library/dn249912.aspx) provisioner for [Packer.io](http://packer.io), the machine image automation tool, allowing you to automate the generation of your Windows machine images in a repeatable, reliable way.\n\nWorks nicely when combined with a Vagrant development workflow, possibly leveraging the [Vagrant DSC](https://github.com/mefellows/vagrant-dsc) plugin.\n\nFeatures:\n* Automatically run DSC on a remote machine, from local DSC Configurations.\n* Automatically configure PowerShell Package Management (specify `install_package_management` as `true`)\n* Install DSC Resources from local or remote sources, including the PowerShell Gallery (see `resource_paths` and `install_modules`)\n* Ability to use pre-generated MOF files, if required\n\n[![Coverage Status](https://coveralls.io/repos/github/mefellows/packer-dsc/badge.svg?branch=HEAD)](https://coveralls.io/github/mefellows/packer-dsc?branch=HEAD)\n[![wercker status](https://app.wercker.com/status/ef7336f65a3636531141a653e775d58f/s \"wercker status\")](https://app.wercker.com/project/bykey/ef7336f65a3636531141a653e775d58f)\n\n### Getting Started\n\nThe plugin can be used by downloading the pre-built binary, or by building the project locally and ensuring the binary is installed in the correct location.\n\n### On Mac OSX using Homebrew\n\nIf you are using [Homebrew](http://brew.sh) you can follow these steps to install the plugins:\n\n```\nbrew install https://raw.githubusercontent.com/mefellows/packer-dsc/master/scripts/packer-provisioner-dsc.rb\n```\n\n### Using pre-built binaries\n\n1. Install Packer\n1. Download the latest [release](https://github.com/mefellows/packer-dsc/releases) for your host environment\n1. Unzip the plugin binaries to [a location where Packer will detect them at run-time](https://packer.io/docs/extend/plugins.html), such as any of the following:\n  - The directory where the packer binary is.\n  - `~/.packer.d/plugins` on Unix systems or `%APPDATA%/packer.d/plugins` on Windows.\n  - The current working directory.\n1. Change to a directory where you have packer templates, and run as usual.\n\n### Using a local build\n\nWith [Go 1.2+](http://golang.org) installed, follow these steps to use these community plugins for Windows:\n\n1. Install packer\n1. Clone this repo\n1. Run `make dev`\n1. Copy the plugin binaries located in `./bin` to [a location where Packer will detect them at run-time](https://packer.io/docs/extend/plugins.html), such as any of the following:\n  - The directory where the packer binary is. If you've built Packer locally, then Packer and the new plugins are already in `$GOPATH/bin` together.\n  - `~/.packer.d/plugins` on Unix systems or `%APPDATA%/packer.d/plugins` on Windows.\n  - The current working directory.\n1. Change to a directory where you have packer templates, and run as usual.\n\n# Introduction\n\nType: `dsc`\n\nDSC Packer provisioner configures DSC to run on the\nmachines by Packer from local modules and manifest files. Modules and manifests\ncan be uploaded from your local machine to the remote machine.\n\n-\u0026gt; **Note:** DSC will *not* be installed automatically by this\nprovisioner. This provisioner expects that DSC is already [installed](https://www.penflip.com/powershellorg/the-dsc-book/blob/master/dsc-overview-and-requirements.txt) on the\nmachine. It is common practice to use the [powershell\nprovisioner](/docs/provisioners/powershell.html) before the DSC provisioner to install WMF4.0+, any\nrequired DSC Resources or connection to a DSC Pull server.\n\n## Basic Example\n\nThe example below is fully functional and expects the configured manifest file\nto exist relative to your working directory:\n\n``` {.javascript}\n{\n  \"type\": \"dsc\",\n  \"manifest_file\": \"manifests/Beanstalk.ps1\",\n  \"configuration_file\": \"manifests/BeanstalkConfig.psd1\",\n  \"configuration_params\": {\n    \"-WebAppPath\": \"c:\\\\tmp\",\n    \"-MachineName\": \"localhost\"\n  }\n}\n```\n\n## Configuration Reference\n\nThe reference of available configuration options is listed below.\n\nRequired parameters:\n\n-   `manifest_file` (string) -  The main DSC manifest file to apply to kick off the entire thing.\n\nOptional parameters:\n\n-   `configuration_name` (string) -  The name of the Configuration module. Defaults to the base\n    name of the `manifest_file`. e.g. `Default.ps1` would result in `Default`.\n\n-   `mof_path` (string) -  Relative path to a folder, containing the pre-generated MOF file.\n\n-   `configuration_file` (string) -  Relative path to the DSC Configuration Data file.\n    Configuration data is used to parameterise the configuration_file.\n\n-   `configuration_params` (object of key/value strings) - Set of Parameters to pass to the DSC\n     Configuration.\n\n-   `module_paths` (array of strings) -  Set of relative module paths.\n     These paths are added to the DSC Configuration running environment to enable _local_ modules to be addressed.\n\n-   `resource_paths` (array of strings) -  Set of DSC Resources to upload for system-wide use.\n    These paths are uploaded into `${env:programfiles}\\WindowsPowershell\\Modules` to be used system-wide, unlike\n    `module_paths` which is scoped to the current Configuration.\n\n-   `install_modules` (array of strings) - Set of PowerShell modules to be installed\n    with the `Install-Module` command. See `install_package_management` if you would\n    like the DSC Provisioner to install this command for you.\n\n-   `install_package_management` (bool) - Automatically installs the\n    [Package Management](https://github.com/OneGet/oneget) package manager\n    (formerly OneGet) on the server.    \n\n-   `staging_dir` (string) - The directory where files will be uploaded.\n    Packer requires write  permissions in this directory.\n\n-   `clean_staging_dir` (bool) - If true, staging directory is removed after executing DSC.\n\n-   `working_dir` (string) - The directory from which the command will be executed.\n    Packer requires the directory to exist when running DSC.\n\n-   `ignore_exit_codes` (boolean) - If true, Packer will never consider the\n     DSC provisioning process a failure.\n\n-   `execute_command` (string) -  The command used to execute DSC. This has\n    various [configuration template\n    variables](/docs/templates/configuration-templates.html) available. See\n    below for more information.\n\n## Execute Command\n\nBy default, Packer uses the following command to execute DSC:\n\n```\n{{if ne .ModulePath \"\"}}\n$absoluteModulePaths = [string]::Join(\";\", (\"{{.ModulePath}}\".Split(\";\") | ForEach-Object { $_ | Resolve-Path }))\necho \"Adding to path: $absoluteModulePaths\"\n$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"\n(\"{{.ModulePath}}\".Split(\";\") | ForEach-Object { gci -Recurse  $_ | ForEach-Object { Unblock-File  $_.FullName} })\n{{end}}\n\n$script = $(\"{{.ManifestFile}}\" | Resolve-Path)\necho \"PSModulePath Configured: ${env:PSModulePath}\"\necho \"Running Configuration file: ${script}\"\n\n{{if eq .MofPath \"\"}}\n# Generate the MOF file, only if a MOF path not already provided.\n# Import the Manifest\n. $script\n\ncd \"{{.WorkingDir}}\"\n$StagingPath = $(Join-Path \"{{.WorkingDir}}\" \"staging\")\n{{if ne .ConfigurationFilePath \"\"}}\n$Config = $(iex (Get-Content (\"{{.WorkingDir}}\" \"{{.ConfigurationFilePath}}\" | Resolve-Path) | Out-String))\n{{end}}\n{{.ConfigurationName}} -OutputPath $StagingPath {{.ConfigurationParams}}{{if ne .ConfigurationFilePath \"\"}} -ConfigurationData $Config{{end}}\n{{else}}\n$StagingPath = \"{{.MofPath}}\"\n{{end}}\n\n# Start a DSC Configuration run\nStart-DscConfiguration -Force -Wait -Verbose -Path $StagingPath`\n```\n\nThis command can be customized using the `execute_command` configuration. As you\ncan see from the default value above, the value of this configuration can\ncontain various template variables, defined below:\n\n-   `WorkingDir` - The path from which DSC will be executed.\n-   `ConfigurationParams` - Arguments to the DSC Configuration in k/v pairs.\n-   `ConfigurationFilePath` - The path to a DSC Configuration File, if any.\n-   `ConfigurationName` - The name of the DSC Configuration to run.\n-   `ManifestFile` - The path on the remote machine to the manifest file for\n    DSC to use.\n-   `ModulePath` - The path to a directory on the remote machine containing the manifest files.\n-   `MofPath` - The path to a directory containing any existing MOF file(s) to use.\n\n## Examples\n\nSee the [Examples](examples) directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmefellows%2Fpacker-dsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmefellows%2Fpacker-dsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmefellows%2Fpacker-dsc/lists"}