Я создал следующий документ ssm, который работает, но когда я захожу на сервер, сценарии не выполняются. строка, где я пытаюсь добавить реестр. это не работа. следовательно, остальная часть кода не эффективна.
resource "aws_ssm_document" "InstallFC2" {
name = "Salmaan"
document_type = "Command"
content = <<DOC
{
"schemaVersion": "2.2",
"description": "Run a script to install Failover Clustering in Server",
"mainSteps": [
{
"action":"aws:runPowerShellScript",
"name": "Install_FailoverCluster",
"inputs":{
"runCommand":[
"Import-Module ServerManager",
"New-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" -Name 'LocalAccountTokenFilterPolicy' -Value '1' ",
"Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools",
"$getIndex = (get-netipinterface | where-object{($_.AddressFamily -match 'IPv4') -and ($_.InterfaceAlias -match 'Ethernet')} | (Select-object -expand ifIndex))\n",
"Set-DnsClientServerAddress -InterfaceIndex $getIndex -ServerAddresses 10.0.2.10,10.0.1.6",
"Add-WindowsFeature RSAT-AD-Tools,RSAT-ADCS",
"$domain = 'Voicevault.test.com'\n",
"$Password = (ConvertTo-SecureString -String 'R35tr1ct3d' -AsPlainText -Force)",
"$username = $domain/Admin \n",
"$credential = (New-Object System.Management.Automation.PSCredential($username,$Password))\n",
"Add-computer -DomainName $domain -Credential $credential",
"Rename-Computer -ComputerName $env:computername -NewName 'Damudi' -DomainCredential $credential"
]
}
}
]
}
DOC
}