问题描述
作为ansible工作流程的一部分,我希望在运行时更新azure批处理池Windows映像,并禁用Windows Update
我创建了一个天蓝色的批处理节点:
- name: Create Batch Account
azure_rm_batchaccount:
resource_group: MyResGroup
name: mybatchaccount
location: eastus
auto_storage_account:
name: mystorageaccountname
pool_allocation_mode: batch_service
事实上,我知道我可以在azure批处理节点中使用Start任务并执行a cmd将Hkey更改为NoUpdate = 1。
- name: "Ensure 'Configure Automatic Updates' is set to 'disabled'"
win_regedit:
path: HKLM:\Software\Policies\Microsoft\Windows\Windowsupdate\Au
name: "NoAutoUpdate"
data: "1"
type: dword
我想在运行时在azure批处理池中执行它。 有谁知道如何用ansible将其归档?
解决方法
要在批处理池启动时运行某些内容,您只需将其作为启动任务(https://docs.microsoft.com/en-us/rest/api/batchservice/pool/add#starttask)的一部分即可。
但是在这种情况下,您可能应该仅使用Azure功能来关闭自动更新https://docs.microsoft.com/en-us/rest/api/batchservice/pool/add#windowsconfiguration