Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37903 - Parse Ansible password in Windows default provisioning… #10348

Open
wants to merge 1 commit into
base: 3.12-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/services/foreman/template_snapshot_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ description: |
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>![CDATA[<%= host_param('ansible_ssh_pass') %>]]</Value>
<Value><![CDATA[<%= host_param('ansible_ssh_pass') %>]]></Value>
<PlainText>true</PlainText>
</Password>
<Description>Ansible login service user</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading