diff --git a/app/services/foreman/template_snapshot_service.rb b/app/services/foreman/template_snapshot_service.rb index 01ac0e9b3a5..f05008dceec 100644 --- a/app/services/foreman/template_snapshot_service.rb +++ b/app/services/foreman/template_snapshot_service.rb @@ -83,6 +83,9 @@ def define_host_params(host) "syspurpose_usage" => "Development/Test", "syspurpose_sla" => "Self-Support", "syspurpose_addons" => "first addon, second addon, third addon", + "ansible_user" => "win_ansible_user", + "create_ansible_user" => "true", + "ansible_ssh_pass" => "win_ansible_user_ssh_pass", } host_params.each_pair do |name, value| FactoryBot.build(:host_parameter, host: host, name: name, value: value) diff --git a/app/views/unattended/provisioning_templates/provision/windows_default_provisioning.erb b/app/views/unattended/provisioning_templates/provision/windows_default_provisioning.erb index e84d6428854..e8fb9c13afe 100644 --- a/app/views/unattended/provisioning_templates/provision/windows_default_provisioning.erb +++ b/app/views/unattended/provisioning_templates/provision/windows_default_provisioning.erb @@ -81,7 +81,7 @@ description: | - ![CDATA[<%= host_param('ansible_ssh_pass') %>]] + ]]> true</PlainText> </Password> <Description>Ansible login service user</Description> diff --git a/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Windows_default_finish.windows10_dhcp.snap.txt b/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Windows_default_finish.windows10_dhcp.snap.txt index fee6e46538d..80763cc712e 100644 --- a/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Windows_default_finish.windows10_dhcp.snap.txt +++ b/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Windows_default_finish.windows10_dhcp.snap.txt @@ -45,6 +45,12 @@ w32tm /resync powershell /c "Get-NetConnectionProfile -InterfaceAlias \"Ethernet0\" | Set-NetConnectionProfile -NetworkCategory Private" +powershell /c "set-localuser -name win_ansible_user -passwordneverexpires 1" +powershell /c "Enable-PSRemoting" +cmd /c "netsh advfirewall firewall add rule name="WinRM-HTTP" dir=in localport=5985 protocol=TCP action=allow" +cmd /c winrm set winrm/config/service @{AllowUnencrypted="true"} +cmd /c winrm set winrm/config/client/auth @{Basic="true"} +cmd /c winrm set winrm/config/service/auth @{Basic="true"} diff --git a/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Windows_default_provision.windows10_dhcp.snap.txt b/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Windows_default_provision.windows10_dhcp.snap.txt index 0d0a6ddc492..dd38376a4af 100644 --- a/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Windows_default_provision.windows10_dhcp.snap.txt +++ b/test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Windows_default_provision.windows10_dhcp.snap.txt @@ -51,7 +51,19 @@ <Value>$1$rtd8Ub7R$5Ohzuy8WXlkaK9cA2T1wb0</Value> <PlainText>false</PlainText> </AdministratorPassword> - </UserAccounts> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value><![CDATA[win_ansible_user_ssh_pass]]></Value> + <PlainText>true</PlainText> + </Password> + <Description>Ansible login service user</Description> + <DisplayName>win_ansible_user</DisplayName> + <Group>Administrators</Group> + <Name>win_ansible_user</Name> + </LocalAccount> + </LocalAccounts> + </UserAccounts> <TimeZone>GMT Standard Time</TimeZone> <OOBE> <HideEULAPage>true</HideEULAPage>