gpt4 book ai didi

Azure CustomScript 扩展未在 Centos 7.2 中执行

转载 作者:行者123 更新时间:2023-12-03 04:26:57 26 4
gpt4 key购买 nike

我想在虚拟机部署后启动以下脚本,按照下面 URL 中提供的说明进行操作,并上传脚本和命令以在门户中执行

https://azure.microsoft.com/en-us/blog/automate-linux-vm-customization-tasks-using-customscript-extension/

这是我在 shell 脚本中的命令

{
cd /tmp && wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm
yum install ansible -y

{

部署虚拟机后,我看不到虚拟机内的脚本,也看不到虚拟机内的脚本的字体

然后我添加了命令 mkdir/tmp/test 来创建文件夹作为部署的一部分,此部署花费了超过 5 分钟,而且我看不到在虚拟机内创建的文件夹/tmp/test,

还在启动日志中观察到此错误

2017/02/06 22:55:49.085043 INFO Gateway:None
2017/02/06 22:55:49.089684 INFO Routes:None
2017/02/06 22:56:11.662445 WARNING Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.
2017/02/06 22:56:11.678998 ERROR Event: name=WALinuxAgent, op=, message=Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.
2017/02/06 22:56:37.728636 WARNING Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.
2017/02/06 22:56:37.745898 ERROR Event: name=WALinuxAgent, op=, message=Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.
2017/02/06 22:57:02.794418 WARNING Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.
2017/02/06 22:57:02.810250 ERROR Event: name=WALinuxAgent, op=, message=Exception retrieving extension handlers: (000008)/var/lib/waagent/ExtensionsConfig.2.xml is missing.

在扩展下看到此错误

enter image description here

最佳答案

根据你的描述,我在实验室进行了测试。你最好调整一下脚本格式。以下脚本是我的,它对我有用。

cd /tmp 
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm
yum install ansible -y

当你没有得到预期的结果时,你可以检查/var/log/waagent.log,你会得到如下日志:

2017/02/07 01:49:53 CustomScriptForLinux started to handle.
2017/02/07 01:49:53 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.1] cwd is /var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.1
2017/02/07 01:49:53 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.1] Change log file to /var/log/azure/Microsoft.OSTCExtensions.CustomScriptForLinux/1.5.2.1/extension.log
2017/02/07 01:49:54.508725 INFO Event: name=Microsoft.OSTCExtensions.CustomScriptForLinux, op=Install, message=Launch command succeeded: customscript.py -install
2017/02/07 01:49:54.518685 INFO [Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.1] Enable extension.
2017/02/07 01:49:54.541244 INFO [Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.1] Launch command:customscript.py -enable

现在,您可以检查日志 /var/log/azure/Microsoft.OSTCExtensions.CustomScriptForLinux/1.5.2.1/extension.log

更新:如果您丢失了某些文件,您可以尝试卸载扩展程序并重新安装。 enter image description here

关于Azure CustomScript 扩展未在 Centos 7.2 中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42078342/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com