Ansible win_dsc assistance

71 views
Skip to first unread message

bjnob...@gmail.com

unread,
Sep 1, 2017, 7:30:06 AM9/1/17
to Ansible Project
Hello,

Can anyone help me with using the win_dsc module now available in Ansible 2.4/devel?

My target machine is Windows Server 2016 with PowerShell v5.1

Currently on the Windows server I have installed the following PowerShell DSC modules, created a .ps1, compiled it into the .mof file which I can run successfully using Start-DscConfiguration, but I am unsure on how to replicate this into Ansible.

Install-Module AuditPolicyDsc

Install-Module SecurityPolicyDsc

Install-Module BaselineManagement



DSC_test_config.ps1

Configuration DSC_test_config
{

Import-DSCResource -ModuleName 'PSDesiredStateConfiguration'
Import-DSCResource -ModuleName 'AuditPolicyDSC'
Import-DSCResource -ModuleName 'SecurityPolicyDSC'
Import-DSCResource -ModuleName 'BaselineManagement'
Node localhost

{

SecuritySetting 'SecuritySetting(INF): PasswordHistorySize'
{
PasswordHistorySize = 24
Name = 'PasswordHistorySize'

}

UserRightsAssignment 'UserRightsAssignment(INF): Access_this_computer_from_the_network'
{
Policy = 'Access_this_computer_from_the_network'
Identity = @('*S-1-5-32-544', '*S-1-5-11'
)

}

}
}
DSC_test_config -OutputPath 'C:\Temp\DSC'


localhost.mof

/*
@TargetNode='localhost'
@GeneratedBy=Administrator
@GenerationDate=09/01/2017 12:00:35
@GenerationHost=WIN-ANXXXXXXXXX
*/

instance of MSFT_SecuritySetting as $MSFT_SecuritySetting1ref
{
ResourceID = "[SecuritySetting]SecuritySetting(INF): PasswordHistorySize";
 SourceInfo = "C:\\temp\\DSC_test_config.ps1::13::4::SecuritySetting";
 Name = "PasswordHistorySize";
 ModuleName = "SecurityPolicyDsc";
 PasswordHistorySize = 24;
 ModuleVersion = "1.5.0.0";

 ConfigurationName = "DSC_test_config";

};
instance of MSFT_UserRightsAssignment as $MSFT_UserRightsAssignment1ref
{
ResourceID = "[UserRightsAssignment]UserRightsAssignment(INF): Access_this_computer_from_the_network";
 Policy = "Access_this_computer_from_the_network";
 SourceInfo = "C:\\temp\\DSC_test_config.ps1::20::3::UserRightsAssignment";
 Identity = {
    "*S-1-5-32-544",
    "*S-1-5-11"
};
 ModuleName = "SecurityPolicyDsc";
 ModuleVersion = "1.5.0.0";

 ConfigurationName = "DSC_test_config";

};
instance of OMI_ConfigurationDocument


                    {
 Version="2.0.0";
 

                        MinimumCompatibleVersion = "1.0.0";
 

                        CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"};
 

                        Author="Administrator";
 

                        GenerationDate="09/01/2017 12:00:35";
 

                        GenerationHost="WIN-ANXXXXXXXXX";
 

                        Name="DSC_test_config";


                    };


Reply all
Reply to author
Forward
0 new messages