Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
74694b2b
Commit
74694b2b
authored
Aug 31, 2015
by
nitzmahone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved WinRM setup script test after config
parent
9d193d8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
examples/scripts/ConfigureRemotingForAnsible.ps1
+22
-25
No files found.
examples/scripts/ConfigureRemotingForAnsible.ps1
View file @
74694b2b
...
@@ -105,31 +105,6 @@ Else
...
@@ -105,31 +105,6 @@ Else
Write-Verbose
"PS Remoting is already enabled."
Write-Verbose
"PS Remoting is already enabled."
}
}
# Test a remoting connection to localhost, which should work.
$httpResult
=
Invoke-Command -ComputerName
"localhost"
-ScriptBlock
{
$env
:COMPUTERNAME
}
-ErrorVariable httpError -ErrorAction SilentlyContinue
$httpsOptions
=
New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
$httpsResult
=
New-PSSession -UseSSL -ComputerName
"localhost"
-SessionOption
$httpsOptions
-ErrorVariable httpsError -ErrorAction SilentlyContinue
If
(
$httpResult
-and
$httpsResult
)
{
Write-Verbose
"HTTP and HTTPS sessions are enabled."
}
ElseIf
(
$httpsResult
-and
!
$httpResult
)
{
Write-Verbose
"HTTP sessions are disabled, HTTPS session are enabled."
}
ElseIf
(
$httpResult
-and
!
$httpsResult
)
{
Write-Verbose
"HTTPS sessions are disabled, HTTP session are enabled."
}
Else
{
Throw
"Unable to establish an HTTP or HTTPS remoting session."
}
# Make sure there is a SSL listener.
# Make sure there is a SSL listener.
$listeners
=
Get-ChildItem
WSMan:\localhost\Listener
$listeners
=
Get-ChildItem
WSMan:\localhost\Listener
If
(!(
$listeners
|
Where
{
$_
.Keys -like
"TRANSPORT=HTTPS"
}))
If
(!(
$listeners
|
Where
{
$_
.Keys -like
"TRANSPORT=HTTPS"
}))
...
@@ -194,5 +169,27 @@ Else
...
@@ -194,5 +169,27 @@ Else
Write-Verbose
"Firewall rule already exists to allow WinRM HTTPS."
Write-Verbose
"Firewall rule already exists to allow WinRM HTTPS."
}
}
# Test a remoting connection to localhost, which should work.
$httpResult
=
Invoke-Command -ComputerName
"localhost"
-ScriptBlock
{
$env
:COMPUTERNAME
}
-ErrorVariable httpError -ErrorAction SilentlyContinue
$httpsOptions
=
New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
$httpsResult
=
New-PSSession -UseSSL -ComputerName
"localhost"
-SessionOption
$httpsOptions
-ErrorVariable httpsError -ErrorAction SilentlyContinue
If
(
$httpResult
-and
$httpsResult
)
{
Write-Verbose
"HTTP and HTTPS sessions are enabled."
}
ElseIf
(
$httpsResult
-and
!
$httpResult
)
{
Write-Verbose
"HTTP sessions are disabled, HTTPS session are enabled."
}
ElseIf
(
$httpResult
-and
!
$httpsResult
)
{
Write-Verbose
"HTTPS sessions are disabled, HTTP session are enabled."
}
Else
{
Throw
"Unable to establish an HTTP or HTTPS remoting session."
}
Write-Verbose
"PS Remoting has been successfully configured for Ansible."
Write-Verbose
"PS Remoting has been successfully configured for Ansible."
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment