首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Ansible自动配置Octopus Tentacle

使用Ansible自动配置Octopus Tentacle
EN

Stack Overflow用户
提问于 2016-03-23 19:15:59
回答 1查看 1.8K关注 0票数 0

我有一个运行PowerShell脚本来配置八达通部署Tentacle的剧本。

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

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

代码语言:javascript
复制
Playbook:
---
- name: Configure Octopus Deploy Tentecle
  hosts: all
  tasks:
    - name: Configure Octopus Deploy Tentecle
      script: files/octo_autoconfig.ps1

PowerShell脚本:

代码语言:javascript
复制
& "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 Tentacle时出现错误:

代码语言:javascript
复制
System.NullReferenceException: Object reference not set to an instance of an object.
   at Octopus.Tools.TentacleConfiguration.TentacleManager.TentacleManagerModel.Reload(ApplicationInstanceRecord applicationInstance) in y:\work\refs\heads\master\source\Octopus.Tools\TentacleConfiguration\TentacleManager\TentacleManagerModel.cs:line 131
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

请注意,如果我直接在服务器上运行PowerShell脚本,它可以很好地工作并配置触角。如果我移除触手,然后运行playbook,它就可以工作了。因此,在Ansible playbook可以工作之前,似乎需要首先在服务器上直接配置触手。这有点不合常理。

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

有没有办法用特定的管理员用户运行这个脚本,这样就不会出现访问被拒绝的错误?

代码语言:javascript
复制
2016-02-24 15:53:12.2675      1 FATAL  System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Octopus.Shared.Internals.CertificateGeneration.Win32ErrorHelper.ThrowExceptionIfGetLastErrorIsNotZero() in y:\work\refs\heads\master\source\Octopus.Shared\Internals\CertificateGeneration\Win32ErrorHelper.cs:line 13
   at Octopus.Shared.Internals.CertificateGeneration.CryptContext.Open() in y:\work\refs\heads\master\source\Octopus.Shared\Internals\CertificateGeneration\CryptContext.cs:line 38
   at Octopus.Shared.Security.CertificateGenerator.Generate(String fullName, Boolean exportable) in y:\work\refs\heads\master\source\Octopus.Shared\Security\CertificateGenerator.cs:line 27
   at Octopus.Shared.Configuration.TentacleConfiguration.GenerateNewCertificate() in y:\work\refs\heads\master\source\Octopus.Shared\Configuration\TentacleConfiguration.cs:line 188
   at Octopus.Tentacle.Commands.NewCertificateCommand.Start() in y:\work\refs\heads\master\source\Octopus.Tentacle\Commands\NewCertificateCommand.cs:line 58
   at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in y:\work\refs\heads\master\source\Octopus.Shared\Startup\AbstractCommand.cs:line 58
   at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in y:\work\refs\heads\master\source\Octopus.Shared\Startup\ConsoleHost.cs:line 36
EN

回答 1

Stack Overflow用户

发布于 2016-06-08 07:28:29

我认为您在新证书步骤中遇到了这个错误。

http://docs.octopusdeploy.com/display/OD2/Export+and+import+Tentacle+certificates+without+a+profile

您需要生成证书并将其上传到目标,以便使用Tentacle导入。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36176669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档