Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
110 stars 61 forks source link

Multiple WA settings #529

Open jhevenor opened 4 months ago

jhevenor commented 4 months ago

Community Note

Module Version

Affected Resource(s)

Configuration Files

{
    "AllNodes": [
        {
            "NodeName": "10.155.1.200",
            "Role": [
                "Server",
                "WebAdaptor"
            ],
            "WebAdaptorConfig":[
                {
                    "Role": "Server",
                    "ServerContext":"maps",
                    "AdminAccessEnabled": false
                },
                {
                    "Role": "Server",
                    "ServerContext":"maps-admin",
                    "AdminAccessEnabled": true
                }
            ]
        },
        {
            "NodeName": "10.155.1.201",
            "Role": [
                "Server",
                "WebAdaptor"
            ],
            "WebAdaptorConfig":[
                {
                    "Role": "Server",
                    "ServerContext":"maps",
                    "AdminAccessEnabled": false
                },
                {
                    "Role": "Server",
                    "ServerContext":"maps-admin",
                    "AdminAccessEnabled": true
                }
            ]
        }
    ],
    "ConfigData": {
        "Version": "11.1",
        "ServerRole": "GeneralPurposeServer",
        "ServerContext": "maps",
        "DownloadPatches": false,
        "ForceLicenseUpdate": false,
        "Credentials": {
            "ServiceAccount": {
                "Password": "xxx",
                "UserName": "svcusr",
                "IsDomainAccount": false,
                "IsMSAAccount": false
            }
        },
        "Server": {
            "LicenseFilePath": "C:\\prep\\licenses\\generated.prvc",
            "Installer": {
                "IsSelfExtracting": false,
                "Path": "C:\\prep\\preextractedInstalls\\ArcGIS 11.1\\ArcGISServer\\Setup.exe",
                "InstallDir": "C:\\Software\\ArcGIS\\Server",
                "InstallDirPython": "C:\\Python27",
                "PatchesDir": "C:\\Software\\PatchDownloads",
                "PatchInstallOrder": [

                ]
            },
            "ServerDirectoriesRootLocation": "\\\\10.155.1.222\\gis-server\\arcgisserver\\directories",
            "ConfigStoreLocation": "\\\\10.155.1.222\\gis-server\\arcgisserver\\config-store",
            "PrimarySiteAdmin": {
                "UserName": "theadmin",
                "Password": "xxx"
            }
        },
        "WebAdaptor": {
            "AdminAccessEnabled": true,
            "Installer": {
                "Path": "C:\\prep\\preextractedInstalls\\ArcGIS 11.1\\WebAdaptorIIS\\Setup.exe",
                "IsSelfExtracting": false,
                "DotnetHostingBundlePath": "C:\\prep\\installs\\11.1\\dotnet-hosting-6.0.27-win.exe",
                "WebDeployPath": "C:\\prep\\installs\\11.1\\WebDeploy_amd64_en-US.msi"
            }
        }
    }
}

Expected Behavior

I would expect that two contexts are configured, one with admin enabled, and one without.

Actual Behavior

Dot Sourcing the Configuration:- ArcGISInstall
ArcGIS\ArcGIS_Install : A duplicate resource identifier '[ArcGIS_Install]WebAdaptorIIS-Server-mapsInstall' was found while processing the specification for
node '10.155.1.200'. Change the name of this resource so that it is unique within the node specification.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.2.0\Configurations-OnPrem\ArcGISInstall.ps1:480 char:29
+                             ArcGIS_Install "$($WAName)Install"
+                             ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DuplicateResourceIdInNodeStatement,ArcGIS\ArcGIS_Install

ArcGIS\ArcGIS_Install : A duplicate resource identifier '[ArcGIS_Install]WebAdaptorIIS-Server-mapsInstall' was found while processing the specification for
node '10.155.1.201'. Change the name of this resource so that it is unique within the node specification.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.2.0\Configurations-OnPrem\ArcGISInstall.ps1:480 char:29
+                             ArcGIS_Install "$($WAName)Install"
+                             ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DuplicateResourceIdInNodeStatement,ArcGIS\ArcGIS_Install

Compilation errors occurred while processing configuration 'ArcGISInstall'. Please review the errors reported in error stream and modify your configuration code
appropriately.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5
+     throw $ErrorRecord
+     ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (ArcGISInstall:String) [], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessConfiguration

Steps to Reproduce

Deploy as defined

Important Factoids

I don't see any documentation precluding this approach, although the related code sample doesn't run multiple WAs on one machine.

The idea is that I can allow the admin URL internally to my org, but block it from the public. I have a second site on the same subdomain so I can't just use /arcgis/ for that purpose. I'm really just exploring as the WebAdaptorConfig is pretty new.

References

cameronkroeker commented 4 months ago

Hi @jhevenor,

This a valid use case that should work. The error is indicating that both Node.Name entries in the json config were set to the same ip 10.155.1.200. However, in the json example provided above, each Node.Name is unique and looks correct.

Perhaps at some point both node names were set to 10.155.1.200 then one was updated to 10.155.1.201 but the file was not saved before the DSC run?

Let's verify the json config is up to date with each NodeName value being unique and re-run.

Thanks, Cameron K.

jhevenor commented 4 months ago

Hello again @cameronkroeker. You were right, I had a copy/paste that had svr1 listed twice. I adjusted the original posts error message to show what I'm getting. It's still a dup config. Even when I changed the contexts to something else (foo, fooadmin) I still see the [ArcGIS_Install]WebAdaptorIIS-Server-mapsInstall message given. I'm running these in succession and I'm wondering if there's something cached that I need to clear?

cameronkroeker commented 4 months ago

Hello again @cameronkroeker. You were right, I had a copy/paste that had svr1 listed twice. I adjusted the original posts error message to show what I'm getting. It's still a dup config. Even when I changed the contexts to something else (foo, fooadmin) I still see the [ArcGIS_Install]WebAdaptorIIS-Server-mapsInstall message given. I'm running these in succession and I'm wondering if there's something cached that I need to clear?

Perhaps the LCM is using a cached MOF from it being stuck in a pending state. Let's try the following:

jhevenor commented 4 months ago

I tried this with a fresh deployment and had the same errors. Config:

{
    "AllNodes": [
        {
            "NodeName": "10.155.1.201",
            "Role": [
                "Server",
                "WebAdaptor"
            ],
            "WebAdaptorConfig":[
                {
                    "Role": "Server",
                    "ServerContext": "maps-cartes",
                    "AdminAccessEnabled": false
                },
                {
                    "Role": "Server",
                    "ServerContext": "maps-cartes-admin",
                    "AdminAccessEnabled": true
                }
            ]
        },
        {
            "NodeName": "10.155.1.202",
            "Role": [
                "WebAdaptor"
            ],
            "WebAdaptorConfig":[
                {
                    "Role": "Server",
                    "ServerContext": "maps-cartes",
                    "AdminAccessEnabled": false
                },
                {
                    "Role": "Server",
                    "ServerContext": "maps-cartes-admin",
                    "AdminAccessEnabled": true
                }
            ]
        }
    ],
    "ConfigData": {
   ...

Resulting in the same error:

Dot Sourcing the Configuration:- ArcGISInstall
ArcGIS\ArcGIS_Install : A duplicate resource identifier '[ArcGIS_Install]WebAdaptorIIS-Server-maps-cartesInstall' was 
found while processing the specification for node '10.155.1.201'. Change the name of this resource so that it is 
unique within the node specification.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.2.0\Configurations-OnPrem\ArcGISInstall.ps1:480 char:29
+                             ArcGIS_Install "$($WAName)Install"
+                             ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DuplicateResourceIdInNodeStatement,ArcGIS\ArcGIS_Install
...
# error repeats for other server

I'm going to drop this for time being but will hopefully get a chance to dig in again in a couple weeks when I finish some other things.