指定推出選項可讓您調整設定變更的速度,並控制設定部署的速度。OS 政策指派作業的每個作業都會啟動推出程序。作業包括建立、更新或刪除 OS 政策指派。
您可以使用推行選項設定下列項目:
波次大小 (中斷預算):一次可推行更新的 VM 固定數量或百分比。也就是說,在推行期間的任何時間點,系統只會指定特定數量的 VM。
等待時間:服務將政策套用至 VM 與 VM 從中斷門檻移除之間的時間。舉例來說,如果等待時間為 15 分鐘,表示在將政策套用至 VM 後,推出程序必須等待 15 分鐘,才能將 VM 從中斷門檻中移除,並繼續推出。等待時間有助於控制推出速度,也能讓您及早發現並解決潛在的推出問題。請選取足夠長的時間,以便您監控推出作業的狀態。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-19 (世界標準時間)。"],[[["\u003cp\u003eOS policies automate the deployment, configuration, maintenance, and reporting of software configurations on virtual machine (VM) instances.\u003c/p\u003e\n"],["\u003cp\u003eOS policies are used to manage tasks such as installing and maintaining agents, deploying security agents, managing files, running compliance checks, and executing condition-based scripts.\u003c/p\u003e\n"],["\u003cp\u003eOS policy assignments combine multiple OS policies and target them to dynamic groups of VMs by using filters like labels, OS families, and zones.\u003c/p\u003e\n"],["\u003cp\u003eRollouts enable pacing of configuration changes and controlling the speed of configuration deployments, using wave size and wait time settings to mitigate disruptions.\u003c/p\u003e\n"],["\u003cp\u003eVM Manager uses OS Config agents on VMs to apply changes specified in OS policies, with a periodic enforcement check every 60 minutes.\u003c/p\u003e\n"]]],[],null,["# About OS policies\n\nThis page provides an overview of OS policies. Use OS policies to automate and centralize the\ndeployment, configuration, maintenance, and reporting of software configurations\non your virtual machine (VM) instances.\n\nUse cases\n---------\n\nOS policies are ideal for the following scenarios:\n\n- Installing and maintaining agents for tasks such as monitoring and logging\n- Deploying agents such as security agents, and ensuring that these agent are running on all VMs\n- Improving startup script flexibility. With OS policies you can modify existing scripts and re-deploy them\n- Running compliance checks\n- Adding update repositories for software packages\n- Managing files on the operating system\n- Running condition-based scripts. You can set up scripts that run based on certain conditions to maintain consistent state within the operating system.\n\n| **Note:** Custom OS policy scripts and output files that you define using the [`Exec`](/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments#exec) resource don't use [customer-managed encryption keys (CMEKs)](/kms/docs/cmek). These OS policies are incompatible with Google Cloud's [Access\n| Transparency](/assured-workloads/access-transparency/docs/overview) and [Access\n| Approval](/assured-workloads/access-approval/docs/overview). Make sure that you don't include any sensitive information in these scripts or output files.\n\nComponents\n----------\n\n### OS policy\n\nAn OS policy is a file that contains the declarative configuration for OS\nresources such as packages, repositories, files, or custom resources defined by\nscripts.\n\nAn OS resource can perform a single task such as installing an agent and can be\nreused without changes in different assignments.\nYou can create a multi-step workflow by combining multiple OS resources into a single\nOS policy. For example, an OS policy can have one resource that sets up a repository\nand a second resource that installs specific packages from that repository.\n\nFor more information about OS policies, see\n[OS policy and OS policy assignment](/compute/vm-manager/docs/os-policies/working-with-os-policies).\n\n### OS policy assignment\n\nOS policy assignments are used by VM Manager to apply your OS policies to\nVMs. Use OS policy\nassignments to combine multiple OS policies and target them to a dynamic group\nof VMs by using filters such as labels, OS families, and zones.\n\nFor example, an OS policy assignment that applies three policies\nto all the Ubuntu VMs in your test environment, while excluding those that are\nrunning Google Kubernetes Engine, can be created by specifying the following:\n\n- Policy A: install monitoring agent\n- Policy B: install logging agent\n- Policy C: install security agent\n- Include label: `env:test`\n- Exclude label: `goog-gke-node`\n- OS family: `ubuntu`\n\n| **Note:** OS policy assignments are zonal resources. One assignment can target multiple VMs in a single zone. For more information about zonal resources, see [Zonal resources](/compute/docs/regions-zones/global-regional-zonal-resources#zoneresource).\n\n#### Rollouts\n\nWhen you create a new OS policy assignment, VM Manager applies the\nOS policies to each VM according to the rollout configuration. During the rollout,\na copy of each OS policy is placed on the VM. When you update an OS policy assignment,\nVM Manager checks and enforces the configuration changes for the\nOS policy that is on the target VM.\n\nWe recommend that you apply new configuration changes slowly to ensure that\nyou have time to identify any potential disruptions that might be caused\nby configuration changes. This provides you with time needed to cancel\nthe rollout and address the issue.\n\nSpecifying the rollout option enables you to pace configuration changes and\ncontrol the speed of configuration deployments. Each operation for\nan OS policy assignment starts a rollout process. Operations include the creation,\nupdate, or deletion of an OS policy assignment.\n\nYou can use the rollout option to set the following:\n\n- Wave size (disruption budget): the fixed number or percentage of VMs that can experience a rollout at one time. This means that at any moment of the rollout only a specified number of VMs are targeted.\n- Wait time: the time between when the service applies policies to the VM and when a VM is removed from the disruption threshold. For example, a wait time of 15 minutes means that the rollout process must wait 15 minutes after applying the policies to a VM before it can remove the VM from the disruption threshold and the rollout can proceed. The wait time helps control the speed of a rollout and also lets you catch and resolve potential rollout issues early. Select a time that is long enough for you to monitor the status of your rollouts.\n\nFor information about how to create OS policy assignments, see\n[Creating an OS policy assignment](/compute/vm-manager/docs/os-policies/create-os-policy-assignment).\n\n### OS Config agent\n\nDuring VM Manager setup, OS Config agents are enabled on the VMs in\nyour project. The OS Config agents that are running on these target VMs use\nstandard system utilities to apply the changes that are specified in the\nOS policies.\n\n- Linux VMs run system package managers such as `apt` or `yum` for package installation, or `/bin/sh` for scripting.\n- Windows VMs run `googet` package manager and PowerShell for scripting.\n\nFor information about how to set up VM Manager,\nsee [Setting up VM Manager](/compute/vm-manager/docs/setup#overview).\n\nHow OS policies work\n--------------------\n\nTo use OS policies for maintaining your operating systems, do the following:\n\n1. Create or download OS policies\n2. Create OS policy assignments that applies these OS policies to the target VMs\n\n[](/static/compute/images/os-config/os-configuration-arch.png) Figure 1. OS policies architecture overview\n\nAfter the OS policy assignments are created, VM Manager periodically\nchecks and enforces these OS policies. The time interval between each\nenforcement check is 60 minutes.\n\nDuring the check and enforcement, VM Manager completes the\nfollowing steps:\n\n1. Identifies the OS policy assignments for a VM.\n2. Identifies the OS policies associated with the OS policy assignments.\n3. Sends the information for each OS policy to the OS Config agent that is running on the VM.\n4. The OS Config agent then validates each policy and makes the following\n updates:\n\n - If resources within an OS policy are already in their desired state, then the OS Config agent does not perform any actions\n - If resources within an OS policy are not in their desired state, then the OS Config agent takes appropriate actions to bring the resources to the desired state\n5. Collects the compliance status of each OS policy that is applied to the VM.\n To view compliance reports, see\n [View compliance reports](/compute/vm-manager/docs/os-policies/view-compliance).\n\nPricing\n-------\n\nFor information about pricing, see\n[VM Manager pricing](/compute/vm-manager/pricing).\n\nWhat's next?\n------------\n\n- Review [OS policy and OS policy assignment](/compute/vm-manager/docs/os-policies/working-with-os-policies).\n- Learn how to [create an OS policy assignment](/compute/vm-manager/docs/os-policies/create-os-policy-assignment).\n- Learn how to [manage OS policy assignments](/compute/vm-manager/docs/os-policies/manage-os-policy)."]]