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.
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래