Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 使用Ansible自动配置章鱼触手_Powershell_Ansible_Ansible Playbook_Octopus Deploy - Fatal编程技术网

Powershell 使用Ansible自动配置章鱼触手

Powershell 使用Ansible自动配置章鱼触手,powershell,ansible,ansible-playbook,octopus-deploy,Powershell,Ansible,Ansible Playbook,Octopus Deploy,我有一个运行PowerShell脚本来配置章鱼部署触手的剧本 如果我在服务器上运行这个PowerShell脚本,它会工作得很好。如果我使用PowerShell脚本运行playbook,它将在服务器上失败 这可能是什么原因造成的?权限?超时 Playbook: --- - name: Configure Octopus Deploy Tentecle hosts: all tasks: - name: Configure Octopus Deploy Tentecle

我有一个运行PowerShell脚本来配置章鱼部署触手的剧本

如果我在服务器上运行这个PowerShell脚本,它会工作得很好。如果我使用PowerShell脚本运行playbook,它将在服务器上失败

这可能是什么原因造成的?权限?超时

Playbook:
---
- name: Configure Octopus Deploy Tentecle
  hosts: all
  tasks:
    - name: Configure Octopus Deploy Tentecle
      script: files/octo_autoconfig.ps1
PowerShell脚本:

& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config" --console;
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" new-certificate --instance "Tentacle" --if-blank --console;
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --reset-trust --console;
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --home "C:\Octopus" --app "C:\Octopus\Applications" --port "10933" --noListen "False" --console;
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --trust "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" --console;
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --install --start --console;
运行playbook配置Octopus后尝试打开Octopus触角时出错:

System.NullReferenceException:对象引用未设置为对象的实例。
在y:\work\refs\heads\master\source\Octopus.Tools\TentacleConfiguration.TentacleManager.TentacleManagerModel.Reload(ApplicationInstanceRecord applicationInstance)的y:\work\refs\heads\master\source\Octopus.Tools\TentacleConfiguration\TentacleManagerModel.cs:第131行
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调、对象参数、Int32 numArgs)
位于System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源、委托回调、对象参数、Int32 numArgs、委托catchHandler)
请注意,如果我直接在服务器上运行PowerShell脚本,它可以完美地工作并配置触手。如果我移除触手,然后运行剧本,它就会工作。因此,在Ansible playbook开始工作之前,似乎需要先在服务器上直接配置触手。哪种方式不符合要点

我查看了服务器的事件查看器,发现有一些拒绝访问的错误,如下所示

有没有一种方法可以让特定的管理员用户运行此脚本,这样就不会出现拒绝访问的错误

2016-02-24 15:53:12.2675 1致命系统。未经授权的访问异常:访问被拒绝。(HRESULT异常:0x80070005(E_访问被拒绝))
在System.Runtime.InteropServices.Marshal.ThroweExceptionForhr内部(Int32 errorCode,IntPtr errorInfo)
在y:\work\refs\heads\master\source\Octopus.Shared\Internals.CertificateGeneration\Win32ErrorHelper.cs中的Octopus.Shared.Internals.CertificateGeneration.Win32ErrorHelper.ThroweExceptionIfGetLastErrorIsNotzero()处:第13行
在y:\work\refs\heads\master\source\Octopus.Shared\Internals\CertificateGeneration\CryptContext.cs中的Octopus.Shared.Internals.CertificateGeneration.CryptContext.Open()处:第38行
在y:\work\refs\heads\master\source\Octopus.Shared\Security.CertificateGenerator.generator中的Octopus.Shared.Security.CertificateGenerator.generator(字符串全名,布尔可导出)处:第27行
在y:\work\refs\heads\master\source\Octopus.Shared\Configuration\TentacleConfiguration.cs中的Octopus.Shared.Configuration.TentacleConfiguration.GenerateNewCertificate()处
在y:\work\refs\heads\master\source\Octopus.attracle\Commands\NewCertificateCommand.Start()中的Octopus.attracle.Commands.NewCertificateCommand.Start()处:第58行
在y:\work\refs\heads\master\source\Octopus.Shared.Startup.ICommand.Start(字符串[]commandLineArguments,ICommandRuntime commandRuntime,OptionSet commonOptions)的y:\work\refs\heads\master\source\Octopus.Shared\Startup\AbstractCommand.cs:第58行
在y:\work\refs\heads\master\source\Octopus.Shared\Startup.ConsoleHost.Run中运行(操作'1 start,操作shutdown):第36行

我认为您在新的证书步骤中遇到了此错误

您需要生成证书并将其上载到目标以使用触手导入