ansible - 在 Ansible 中排除 Windows 更新
问题描述
我有一个在 Windows 上安装关键和安全更新的 Ansible 剧本:
---
- name: Install all security, critical updates
win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
reject_list:
reboot: yes
reboot_timeout: 900
我想对 playbook 进行微调,以拒绝名称中包含 Preview、* Preview*、* VMware* 和 * Driver* 的任何更新。我知道该reject_list
参数允许您将更新标题用作正则表达式,但我不确定对于我希望更新拒绝的特定名称如何表达这一点。
解决方案
根据https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_updates_module.html ,根据 PowerShell 正则表达式规则,每个条目可以是知识库文章或更新标题作为正则表达式。在此网站https://regexr.com/3c0lf上对 powershell 正则表达式和测试用例进行了快速研究。我相信以下语法应该可以工作,但我自己没有尝试过。
reject_list:
- '.*Preview.*'
- '.*VMware.*'
- '.*Driver.*'
推荐阅读
- mysql - SQL 按列计数出现次数
- angular - 用 jasmine 测试 NGXS 异常
- node.js - 使用 node.js 监听特定 URL 的请求(不是 LOCALHOST)
- php - MYSQLi 创建数据库?作为名字
- android - 我怎样才能在android中保持“在线”状态
- cron - 如何使用 cronjob 删除空文件夹和子文件夹
- excel - 如何在条形图上添加数据标签并使用 VBA 从单元格中添加值
- mysql - sql查询密码列
- salesforce - Visualforce 页面弹出窗口
- typescript - 我试图装饰的类的实例中缺少 TypeScript 报告属性