PSD1 File Management Repository

Purpose

This repository is designed to manage the powershell scripts (.ps1) and configuration files (.psd1) used for setting up and maintaining servers using Desired State Configuration (DSC).

The goal is to reduce the Octopus Deploy DSC project "noise" by consolidating these scripts here.

It includes (or will include) the following

  • original legacy .psd1 files,
  • a cleaned variation of the original .psd1 files (reducing branch duplication and syntac errors)
  • simplified source .psd1 files where common configurations are extracted into a _common.psd1 files
  • DSC .ps1 scripts used in conjuection with the .psd1 files run on target servers
  • .mof files generated on servers for configuration validation

Directory Structure

/legacy

  • /original_psd1: Contains the original .psd1 files organized captured from TFS project "DSC"

    • Example:
      • /App Servers/App 1/main/App1.psd1
      • /App Servers/App 1/sprint/App1.psd1
      • /DB Servers/Internal Facing/App 2/development/App2.psd1
      • /DB Servers/Internal Facing/App 2/main/App2.psd1
  • /cleaned_psd1: Contains the cleaned-up .psd1 files, either collapsed if identical across branches or fixed if they had syntax errors.

    • Example:
      • /App Servers/App 1/App1.psd1
      • /DB Servers/Internal Facing/App 2/App2.psd1

/src

  • Contains a mixture of _common.psd1 files and app-specific .psd1 files. They can be used as partials to run with the DSC ps1 scripts, or reconstucted back into psd1 files to validate against the original files.
    • Example:
      • /App Servers/_common.psd1
      • /App Servers/App 1/App1.psd1
      • /DB Servers/_common.psd1
      • /DB Servers/Internal Facing/_common.psd1
      • /DB Servers/Internal Facing/App 2/App2.psd1

/output (not checked into git)

  • Contains the constructed .psd1 files to validate against the original files.
    • Example:
      • /App Servers/App 1/App1.psd1
      • /DB Servers/Internal Facing/App 2/App2.psd1

/mof_files

  • Contains .mof and .meta.mof files captured from the servers, organized by server names.
    • Example:
      • /DCYFDB20034/DCYFDB20034.mof
      • /DCYFDB20034/DCYFDB20034.meta.mof
      • /DCYFWEB10101/DCYFWEB10101.mof
      • /DCYFWEB10101/DCYFWEB10101.meta.mof

/scripts

  • Contains the PS1 scripts used for transforming the PSD1 files into DSC configurations, as well as other PS1 files used for data transformations.
    • Example:
      • extract_common_psd1.ps1
      • config_server_web.ps1
      • config_server_db.ps1

mapping.json

  • A JSON file showing mappings between original and final files, common files, and associated PS1 scripts.

Usage

  1. Original Files: Start with the PSD1 files in /legacy/original_psd1.
  2. Cleaned Files: Clean and collapse identical files into /legacy/cleaned_psd1.
  3. Source Files: Extract common configurations into _common.psd1 files and place them in /src along with the app-specific PSD1 files.
  4. Output Files: Use the scripts in /scripts to transform the files in /src to generate the final constructed PSD1 files in /output.
  5. MOF Files: Use the .mof files in /mof_files to validate configurations against the servers.
  6. Mapping: Refer to mapping.json for tracking the relationship between original, cleaned, common, and final PSD1 files.