AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[packer](server)

Martin Hope
rumplesmyboy
Asked: 2022-04-09 08:42:44 +0800 CST

将计算机添加到域失败并出现内部错误

  • 1

我已启用 winrm,禁用防火墙,启用远程处理,winrm 的 GPO,启用 SMBv1 并首先完成更新作为故障排除,但我仍然收到错误。我也可以ping DC。

我得到的错误是:

Add-Computer: Computer "server2019' failed to join domain 'dev.domain.com' from its current workgroup 'WORKGROUP' with following error message: An internal error occurred.
At line:1 char:1
Add-Computer -DomainName dev.domain.com -OUPath "OU=$OU,dc=dev,dc=domain,dc=com" ...

CategorvInfo :Operation5topped: (server2019:5tring) [Add-Computer]
. InvalidoperationException
+ FullvOualifiedErrorId:FailToJoinDomainFromworkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

这是我的脚本中执行连接的部分:

     [String]$OU,
     [PSCredential]$Credential
     )
    
 $ErrorActionPreference="SilentlyContinue"
 Stop-Transcript | out-null
 $ErrorActionPreference = "Continue"
    
    
 if ([Environment]::UserInteractive) {
     if (!$OU) { $OU = Read-Host "Enter Resource Pool Name (exactly as appears in vCenter inventory)" }
     if (!$Credential) { $Credential = Get-Credential -Message "Enter dev domain credentials" }
 }
    
 # Add Computer to Dev domain
    
 try {
     Add-Computer -DomainName dev.domain.com -OUPath "OU=$OU,dc=dev,dc=domain,dc=com" -ErrorAction stop -Credential $Credential
     }
 catch {
     Write-Warning "Failed to join to domain."
         Read-Host -Prompt "Press Enter to exit"
     Throw $_
     }
PS C:\Windows\ system32> nltest.exe/dsgetdc:dev.domain.com
DC: \\devad02.dev.domain.com
Address: \\10.1.214.29
Do Guid: ae3bef55-dd18-4598-b809-2058516e6abl
Dom Name: dev.domain.com
Forest Name: dev.domain.com
De Site Name: SITE
Our Site Name: SITE
Flags: GC DS LDAP KDC TIMESERV WRITABLE DNS_DC DNS_DOMAIN DNS_FOREST CLOSE_SITE FULL_SECRE
TWS D5_8 D5_9 D5_10 0x20000
The command completed successfully

编辑:服务器管理器显示 NetJoin 的错误事件,它给出了错误代码 1359 我尝试运行:

nltest /dclist:MYDOMAIN并得到: You don't have access to DsBind to dev.domain.com

我也尝试运行:nltest /server:UserSyncServer /sc_reset:domain\devdc并得到:I_NetLogonControl failed: Status = 1722 0x6ba RPC_S_SERVER_UNAVAILABLE

powershell active-directory vmware-vsphere windows-server-2019 packer
  • 1 个回答
  • 361 Views
Martin Hope
Pieter
Asked: 2021-10-29 06:37:13 +0800 CST

使用 Packer 将 Windows VM 添加到域

  • 0

我正在尝试使用 Packer 创建 Windows 映像以在 Azure 上使用。作为此过程的一部分,我需要将一些位于 Azure 中现有 VM 上的文件放入映像中。我的想法是将虚拟机添加到域中,这样我就可以直接复制文件。但是,到目前为止,我还无法将图像添加到域中。

我试过运行一个 powershell 脚本,但这给了我以下错误消息:

Error uploading ps script containing env vars: Error uploading file to $env:TEMP

接下来,我尝试直接从 powershell-provisioner(普通用户和提升用户)运行“Add-Computer”命令,但两个选项都没有成功。使用常规外壳,Packer 似乎只是卡住了。消息后没有任何反应Provisioning with Powershell。提升的外壳给我一个错误消息:

(12,8):UserId:
==> azure-arm.xxxxx: At C:\Windows\Temp\packer-elevated-shell-617ab2e4-e084-8ef8-f9f6-0d66a82a0129.ps1:60 char:1

有谁知道如何将图像添加到域?还是有另一种方法可以将文件从现有 VM 复制到映像?或者最好在部署期间使用 Terraform 复制文件?

terraform packer
  • 1 个回答
  • 361 Views
Martin Hope
ZoFreX
Asked: 2021-03-26 02:39:42 +0800 CST

journalctl 在 DigitalOcean droplet 上启动后随机停止工作

  • 0

我正在使用我在 DigitalOcean 上使用 Packer 制作的自定义图像构建服务器,并且我遇到了一个反复出现的问题,即 journalctl 没有任何日志:

# journalctl
No journal files were found.

有时我对我构建的图像有这个问题,有时我没有。有时,由同一映像构建的一台服务器可以工作,而另一台则不能。

我还注意到,如果我非常快速地登录到服务器,有时 journalctl 最初可以工作,但很快就会中断(<1 分钟后)。

如果我重新启动 journald,那么从那时起它会正常工作,但我会丢失在那之前的所有日志。

digital-ocean packer journalctl
  • 1 个回答
  • 216 Views
Martin Hope
openCivilisation
Asked: 2021-02-27 23:06:10 +0800 CST

使用打包程序构建的 OpenVPN AMI 错误地使用了生成的配置文件中构建的旧公共 IP

  • 1

当我使用基于 AWS OpenVPN AMI 的 Hashicorp Packer 构建 AMI 时,来自执行构建的第一个实例的公共 IP 地址将在以后使用 AMI 时保持不变,而此时它应该更新。

因此,当我尝试在新的 AWS 实例上使用生成的 AMI 时,如果我尝试为用户生成证书,openvpn.conf 文件总是包含来自用于构建 AMI 的实例的不正确的旧公共 IP。它应该使用当前实例的公共 IP。我能做些什么来纠正这种行为吗?

如果有帮助,这是用户数据的相关提取,仅在实例启动时(而不是在构建期间)使用。在这种情况下,VPN 客户端将被配置为网关。

client_network=${client_network}
client_netmask_bits=${client_netmask_bits}
private_subnet1=${private_subnet1}
public_subnet1=${public_subnet1}
aws_internal_domain=${aws_internal_domain}
remote_subnet_cidr=${remote_subnet_cidr}

ls -la /usr/local/openvpn_as/scripts/
/usr/local/openvpn_as/scripts/sacli -k vpn.daemon.0.client.network -v $client_network ConfigPut
/usr/local/openvpn_as/scripts/sacli -k vpn.daemon.0.client.netmask_bits -v $client_netmask_bits ConfigPut
/usr/local/openvpn_as/scripts/sacli --key 'vpn.server.tls_auth' --value 'true' ConfigPut
/usr/local/openvpn_as/scripts/sacli --key vpn.server.routing.gateway_access --value 'true' ConfigPut
/usr/local/openvpn_as/scripts/sacli --key vpn.server.routing.private_network.0 --value "$private_subnet1" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key vpn.server.routing.private_network.1 --value "$public_subnet1" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key vpn.server.routing.private_network.2 --value "$client_network/$client_netmask_bits" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key vpn.server.routing.private_access --value 'route' ConfigPut
/usr/local/openvpn_as/scripts/sacli --key 'vpn.client.routing.reroute_dns' --value 'true' ConfigPut
/usr/local/openvpn_as/scripts/sacli --key 'vpn.server.dhcp_option.domain' --value "$aws_internal_domain" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key 'vpn.server.routing.allow_private_nets_to_clients' --value 'true' ConfigPut
/usr/local/openvpn_as/scripts/sacli start
cd /usr/local/openvpn_as/scripts/
./sacli --user $openvpn_user --key 'prop_autologin' --value 'true' UserPropPut
./sacli --user $openvpn_user --key 'c2s_route.0' --value "$remote_subnet_cidr" UserPropPut
./sacli --user $openvpn_user AutoGenerateOnBehalfOf
mkdir -p seperate
./sacli -o ./seperate --cn "${openvpn_user}_AUTOLOGIN" get5
chown $openvpn_user seperate/*
/usr/local/openvpn_as/scripts/sacli start
ls -la seperate
openvpn amazon-web-services packer amazon-ami
  • 1 个回答
  • 127 Views
Martin Hope
Adam C
Asked: 2020-12-01 08:20:50 +0800 CST

在 Windows 上将 WinRM 替换为 OpenSSH,以便与 AWS 上的 Ansible 一起使用

  • 0

目前,在 Windows 上运行扩展构建(基于Packer/ Ansible)时,我们发现 WinRM 经常出现错误以至于无法使用,因此不得不回退到手动运行一些大型构建作业。使用 AWS 中的主机作为构建源(而不是远程)在一定程度上有所帮助,消除了作为错误原因之一的连接性,但是失败的次数过多且代价高昂,因为构建然后从头开始重新启动,即使它们已经已经运行了几个小时。

Ansible文档提到OpenSSH可以使用(风险自负,因为它是实验性的)来配置 Windows 主机来代替WinRM. 但是,在如何设置方面几乎没有给出指导。

除了怀疑ssh可能比WinRM作为 Ansible 的连接方法更可靠之外,ssh在端口 22 上使用将简化我们的一些安全规则,并从连接的角度使 Windows 与我们的 Linux 构建主机保持一致。理想的情况是创建一个可重用的构建作业,以允许我们创建一个基础AMI(来自官方 Windows Server 2019 AMI),作为我们的 Packer/Ansible 作业的新基础。从未OpenSSH在 Windows 上使用过,也没有尝试使用sshAnsible 连接到 Windows,如果有人可以共享一个工作配置或至少是指针,将不胜感激。

windows ssh amazon-web-services ansible packer
  • 1 个回答
  • 1581 Views
Martin Hope
stevenmiller
Asked: 2020-07-20 05:13:44 +0800 CST

在自定义和部署的 Ubuntu 18.04 模板上断开 NIC

  • 0

在我的 vSphere 6.7 U3 环境中,我有一个由打包程序生成的 Ubuntu 18.04 模板,然后我使用 Terraform 来部署它的两个副本。我遇到了一个问题,即部署的 VM 的 NIC 断开连接,从而阻止 Terraform 完成部署。

我遵循了来自 vmware 的以下 KB:https ://kb.vmware.com/s/article/56409虽然有人提到这个问题应该在我的 vSphere 和 open-vm-tools 版本中得到修复跑步。我在 Packer 生成的模板中的 KB 中列出了修复程序。

To resolve this issue, follow below provided steps and do not skip the steps.

    Open the tmp.conf under /usr/lib/tmpfiles.d/tmp.conf file.

Go to the line 11 and add the prefix # .

For example
#D /tmp 1777 root root -

    If you have open-vm-tools installed, open the /lib/systemd/system/open-vm-tools.service file.

         In certain version path may be different the use find command locate the file 
               #find  /  -iname  open-vm-tools.service
 
Add this line “After=dbus.service” under [Unit]

有没有其他人遇到过这个?我没有使用 cloud-init 自定义方法。这是我在 /var/log/vmware-imc/toolsDeployPkg.log 文件中看到的唯一错误:

[2020-07-17T18:17:57.140Z] [   error] Customization command failed with exitcode: 2, stderr: 'Can't locate File/stat.pm in @INC (you may need to install the File::stat module) (@INC contains: /var/run/.vmware-imgcust-dk2xFAt/scripts /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /var/run/.vmware-imgcust-dk2xFAt/scripts/Utils.pm line 26.
BEGIN failed--compilation aborted at /var/run/.vmware-imgcust-dk2xFAt/scripts/Utils.pm line 26.
Compilation failed in require at /var/run/.vmware-imgcust-dk2xFAt/scripts/Customize.pl line 24.
BEGIN failed--compilation aborted at /var/run/.vmware-imgcust-dk2xFAt/scripts/Customize.pl line 24.
ubuntu vmware-vsphere terraform ubuntu-18.04 packer
  • 1 个回答
  • 1245 Views
Martin Hope
rexford
Asked: 2020-06-26 02:29:37 +0800 CST

如何在打包程序外壳配置程序中提供 sudo pwd

  • 0

我想使用打包程序创建一个 AWS AMI。设置过程的一部分是运行构建脚本,该脚本将为非 root 的系统用户 averagejoe 设置服务和配置环境。安装脚本基本上如下所示:

# some cmds that need to be run by averagejoe
echo "alias ll='ls -Alfh'" > $HOME/.bashrc
# some cmds that need to be run by a privileged user
sudo firewall-cmd --zone=public --permanent --add-port=3389/tcp

因此,部分脚本应以系统用户 averagejoe 执行,部分脚本应以特权用户使用 sudo 执行。因此,不能按照此处的建议以特权用户身份运行整个脚本。

当打包程序配置程序执行脚本时,如何提供 sudo pwd?我想到了一个 3 阶段的方法,首先将 sudo 重新配置为不需要密码,然后运行设置脚本,然后将 sudo 重置为请求密码,但是还有什么更优雅的吗?

packer
  • 2 个回答
  • 2849 Views
Martin Hope
Aziz Alfoudari
Asked: 2016-09-14 13:32:56 +0800 CST

使用带有 shell 配置器的 Packer 构建 AMI

  • 2

我正在尝试创建一个 AMI(基于 ubuntu;ami-2d39803a),我可以将其重用于安装了一组组件的项目。我正在使用 packer 通过一个由配置程序执行的 shell 脚本来实现这一点:

#/bin/bash

# salt
sudo add-apt-repository --yes ppa:saltstack/salt
sudo apt-get update
sudo apt-get install --yes salt-api salt-cloud salt-master salt-minion salt-ssh salt-syndic

# run on startup
sudo update-rc.d salt-master defaults

# salt hostname for minions
sudo bash -v -c "echo 127.0.0.1 salt >> /etc/hosts"

# get docker-formula and move it to /srv/salt
sudo mkdir /tmp/docker-formula
sudo git clone https://github.com/saltstack-formulas/docker-formula /tmp/docker-formula/.
sudo mkdir -p /srv/salt
sudo cp -vr /tmp/docker-formula/docker /srv/salt/docker/

# top.sls
sudo cp -v /ops/config/top.sls /srv/salt/

# accept all minions (minions try to connect to master every 30 seconds)
sudo sleep 30
sudo salt-key -A --yes

# apply to minions
sudo salt '*' -v -t 60 state.apply

# add user to docker group
sudo usermod -aG docker $USER

这是奇怪的部分。当我创建一个新实例并一一执行 shell 脚本命令时,运行它就可以了。但是,当我运行时,packer build我得到以下信息:

    ......
    aws-us-east-1-ubuntu-base: The following keys are going to be accepted:
    aws-us-east-1-ubuntu-base: Unaccepted Keys:
    aws-us-east-1-ubuntu-base: ip-172-30-2-245.ec2.internal
    aws-us-east-1-ubuntu-base: Key for minion ip-172-30-2-245.ec2.internal accepted.
    aws-us-east-1-ubuntu-base: Executing job with jid 20160913191722659701
    aws-us-east-1-ubuntu-base: -------------------------------------------
    aws-us-east-1-ubuntu-base:
    aws-us-east-1-ubuntu-base: ip-172-30-2-245.ec2.internal:
    aws-us-east-1-ubuntu-base: Minion did not return. [No response]
    aws-us-east-1-ubuntu-base: usermod: group 'docker' does not exist
==> aws-us-east-1-ubuntu-base: Terminating the source AWS instance...
==> aws-us-east-1-ubuntu-base: No AMIs to cleanup
==> aws-us-east-1-ubuntu-base: Deleting temporary security group...
==> aws-us-east-1-ubuntu-base: Deleting temporary keypair...
Build 'aws-us-east-1-ubuntu-base' errored: Script exited with non-zero exit status: 6

它sudo salt '*' -v -t 60 state.apply失败了:

小黄人没有回来。[没有反应]

这两种情况之间的唯一区别是加壳程序是从文件执行 bash 脚本,而创建实例不是执行文件。我看不出它与盐大师和它的爪牙之间的沟通有什么关系。

有什么想法吗?

saltstack packer
  • 1 个回答
  • 1342 Views
Martin Hope
Thiago Rider Augusto
Asked: 2016-06-30 12:26:01 +0800 CST

有没有办法用 Packer 提供裸机?

  • 11

Packer 能否用于安装和配置裸机服务器?Packer 为 webserver 提供存储库包和 preseed/kickstart,并且可以运行一些其他配置软件(ansible、puppet、chef 等)。可以用来安装裸机服务器吗?如果是,packer .json 应该是什么样子?

packer
  • 1 个回答
  • 10050 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve