首页 > 解决方案 > Ansible 在 azure 批处理节点上更新 HKEY

问题描述

作为 ansible 工作流程的一部分,我希望在运行时使用 ansible 更新天蓝色批处理池 Windows 图像以禁用 Windows 更新

我创建了一个天蓝色批处理节点:

- 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 。

我已经准备好了一个 ansible 片段:

- 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

我想在天蓝色批处理池中运行时执行它。有谁知道如何用 ansible 存档?

标签: azureansibleazure-batch

解决方案


要在批处理池中启动时运行某些内容,您只需将其作为启动任务的一部分 ( 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


推荐阅读