Releases: microsoft/PowerShell-DSC-for-Linux
PowerShell DSC for Linux v1.0.0-320
/**
PowerShell Desired State Configuration for Linux
Copyright (c) Microsoft Corporation ver. 1.0.0
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
Windows PowerShell Desired State Configuration for Linux - v1.0.0-320
Building the Desired State Configuration (DSC) Local Configuration Manager and Linux Resource Providers
Prerequisites
- At least one modern Linux system with:
a. root login capability
b. These build tools:
i. GNU Make
ii. g++
iii. Python version 2.5 or later, the package python-devel
c. Open Management Infrastructure (OMI) 1.0.8. http://theopengroup.org/software/omi
i. pam-devel
ii. openssl-devel
Building and installing the Local Configuration Manager and Linux Resource Providers
-
Extract PSDSC.tar into a directory that you will build it from.
-
Download and extract OMI 1.0.8 into a directory named "omi-1.0.8" in a directory parallel to the LCM and Providers directory. The directory tree should look something like:
./configure
./LCM
./license.txt
./omi-1.0.8
./omi-1.0.8/agent
./omi-1.0.8/base
... -
Building
A. Configuring OMI and building
i. Configure OMI with desired options (refer to OMI documentation for this step).
a. The default configuration installs to /opt/omi-1.0.8
b. To use the default configuration, run: (cd omi-1.0.8 && ./configure)
ii. Run: make
B. Installing OMI:
i. Run: (cd omi-1.0.8 && sudo ./output/install)
C. Registering the LCM + nxProviders with OMI:
i. Run: sudo make reg -
Running OMI
A. On the Linux system, run omiserver with environment variable OMI_HOME set to OMI's installed directory
i. Run as root: OMI_HOME=PATH_TO_INSTALLED_OMI_DIR PATH_TO_INSTALLED_OMI_DIR/bin/omiserver
ii. The default installation for OMI 1.0.8 is "/opt/omi-1.0.8". Thus, for default installations, part 4Ai above becomes:
OMI_HOME=/opt/omi-1.0.8 /opt/omi-1.0.8/bin/omiserver
B. Note: In order to run following reboots, it is recommended to configure OMI as a System-V, Upstart, or SystemD daemon
To author DSC MOF configuration for Linux on a Windows computer:
Prerequisites
-
A Windows computer with:
A. Adminstrative privileges
B. Windows PowerShell (>=4.0) -
Install the Linux Resource Provider MOF module:
A. Extract the nx.zip file into %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ such that the directory tree looks like:
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\nx.psd1
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\Readme.txt
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\DSCResources
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\DSCResources\MSFT_nxFileResource
...B. In order to compile a Configuration MOF that uses the DSC for Linux resources, use "Import-DscResource -Module nx" inside a DSC Configuration block.
C. Example DSC Configuration blocks provided in the "Example DSCs" directory. -
Managing a Linux system with DSC
A. You need a compiled configuration MOF to apply a new configuration to a system. Please refer to part 1 of this section, as well as the DSC for Windows documentation, for instructions on how to generate a configuration MOF.
B. Once you have a MOF, you can apply it by running:
Start-DscConfiguration -CimSession:$myCimSession -Path:"C:\path_to_compiled_mof_directory" -Wait -Verbose
C. You can get the current configuration of the system by running:
Get-DscConfiguration -CimSession:$myCimSession
D. You can test the current configuration of the system by running:
Test-DscConfiguration -CimSession:$myCimSession
E. For more information on creating a CimSession for use with the -CimSession parameter, see: http://technet.microsoft.com/en-us/library/jj590760.aspx -
Notes
A. The DSC Local Configuration Manager log can be found at $OMI_HOME/var/log/dsc.log
PowerShell DSC for Linux v1.0.0-ctp
/**
- Copyright (c) Microsoft Corporation
* - Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0.
- THIS CODE IS PROVIDED AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
* - See the Apache Version 2.0 License for specific language governing
- permissions and limitations under the License.
*/
Windows PowerShell Desired State Configuration for Linux - v1.0.0-CTP
Building the Desired State Configuration (DSC) Local Configuration Manager and Linux Resource Providers
Prerequisites
- At least one modern Linux system with:
a. root login capability
b. These build tools:
i. GNU Make
ii. g++
iii. Python version 2.5 or later, the package python-devel
c. Open Management Infrastructure (OMI) 1.0.8. http://theopengroup.org/software/omi
i. pam-devel
ii. openssl-devel
Building and installing the Local Configuration Manager and Linux Resource Providers
-
Extract PSDSCLinux.tar into a directory that you will build it from.
-
Download and extract OMI 1.0.8 into a directory named "omi-1.0.8" in a directory parallel to the LCM and Providers directory. The directory tree should look something like:
./configure
./LCM
./license.txt
./omi-1.0.8
./omi-1.0.8/agent
./omi-1.0.8/base
... -
Building
A. Configuring OMI and building
i. Configure OMI with desired options (refer to OMI documentation for this step).
a. The default configuration installs to /opt/omi-1.0.8
b. To use the default configuration, run: (cd omi-1.0.8 && ./configure)
ii. Run: make
B. Installing OMI:
i. Run: (cd omi-1.0.8 && sudo ./output/install)
C. Registering the LCM + nxProviders with OMI:
i. Run: sudo make reg -
Running OMI
A. On the Linux system, run omiserver with environment variable OMI_HOME set to OMI's installed directory
i. Run as root: OMI_HOME=PATH_TO_INSTALLED_OMI_DIR PATH_TO_INSTALLED_OMI_DIR/bin/omiserver
ii. The default installation for OMI 1.0.8 is "/opt/omi-1.0.8". Thus, for default installations, part 4Ai above becomes:
OMI_HOME=/opt/omi-1.0.8 /opt/omi-1.0.8/bin/omiserver
B. Note: In order to run following reboots, it is recommended to configure OMI as a System-V, Upstart, or SystemD daemon
To author DSC MOF configuration for Linux on a Windows computer:
Prerequisites
-
A Windows computer with:
A. Adminstrative privileges
B. Windows PowerShell (>=4.0) -
Install the Linux Resource Provider MOF module (nx-PSModule.zip):
A. Extract the nx.zip file into %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ such that the directory tree looks like:
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\nx.psd1
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\Readme.txt
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\DSCResources
%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\nx\DSCResources\MSFT_nxFileResource
...B. In order to compile a Configuration MOF that uses the DSC for Linux resources, use "Import-DscResource -Module nx" inside a DSC Configuration block.
C. Example DSC Configuration blocks provided in the "Example DSCs" directory. -
Managing a Linux system with DSC
A. You need a compiled configuration MOF to apply a new configuration to a system. Please refer to part 1 of this section, as well as the DSC for Windows documentation, for instructions on how to generate a configuration MOF.
B. Once you have a MOF, you can apply it by running:
Start-DscConfiguration -CimSession:$myCimSession -Path:"C:\path_to_compiled_mof_directory" -Wait -Verbose
C. You can get the current configuration of the system by running:
Get-DscConfiguration -CimSession:$myCimSession
D. You can test the current configuration of the system by running:
Test-DscConfiguration -CimSession:$myCimSession
E. For more information on creating a CimSession for use with the -CimSession paramter, see: http://technet.microsoft.com/en-us/library/jj590760.aspx -
Notes
A. More detail on errors can be found in the stderr/stdout of omiserver on the Linux system. For diagnostic purposes, omiserver can be run in a tty so that stderr/stdout are visible.
B. The DSC Local Configuration Manager log can be found at $OMI_HOME/var/log/dsc.log