订阅 RSS 源

Patch management is an integral part of the IT system lifecycle and vulnerability management. Applying updates to a system keeps it current with the latest bug fixes.

Typically, several teams operate large enterprise IT environments. Such environments contain hundreds of systems requiring thousands of security patches and bug fixes. Automation can help reduce the time IT teams spend deploying patches, making sure those updates are applied consistently across systems.

[ Learn more about patch management and automation. ]

Here are my eight favorite things that Ansible can do when patching Red Hat Enterprise Linux (RHEL) systems using Red Hat Satellite.

1. Stop applications during an update

Patching often updates packages that are actively in use by a running application. Use the service or command module to stop a service or application before patching.

2. Take a snapshot

Murphy's Law says, "Anything that can go wrong will go wrong." If it's possible to take a snapshot of a working system or configuration before applying a patch, then Ansible can help. There are modules like ovirt_snapshot, gcp_compute_snapshot, ec2_snapshot, and many more to help you preserve a working state before you update.

3. Fetch a precount of errata

Knowing the number of errata applied to the system is useful. In contrast to patching Linux by pushing errata from the Satellite GUI, you can't see the errata count when you automate patching using Ansible. Instead, you can trigger a Red Hat Satellite API from Ansible with the uri module to fetch a count of errata. You can store the count of bug fixes, enhancements, security fixes, and upgradable packages in variables using the set_fact module.

4. Register a host

You can use redhat_subscription and dnf modules to register a managed host to a Satellite server, enable repositories, set release versions, and perform updates.

5. Reboot

The Ansible reboot module can preserve a connection state to a managed host while the host reboots. It also supports options like reboot_timeout, pre_reboot_delay, msg, test_commands, and more.

6. Fetch a post-count of errata

Once the patches have been applied, you can use Satellite APIs to fetch a post-count of errata. Ideally, that count is zero!

7. Start an application

Use the service or command module to start the services or applications you stopped before your updates.

8. Send mail

Ansible can automatically email a report to your team or users about the system updates.

As a best practice, you should set a variable, determined by set_fact, to capture the system time before and after playbook execution. The difference between the start and finish times can help gauge the duration of patching and downtime requirements for updates.

The Ansible module for mail can also include information such as the system name, errata pre- and post-count, patching duration, and more. For best results, enable Ansible logging on your control node and configure a cron job schedule for periodic patching.

[ Take Ansible essentials: Simplicity in automation technical overview, a no-cost technical overview course from Red Hat. ]

Wrap up

Automate your operations and monitor your automation. You have the steps and the modules, so now it's time to do yourself a favor: Set it up, and then sit back and enjoy your coffee!


关于作者

Pratheek is a Sysadmin at a Fortune 500 company in India where he specializes in IT automation with Ansible. He has experience in SAP Basis, RHEL Satellite, AWS Cloud, and VMware Administration. An avid reader, cricketer, and artist.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来