User Tools

Site Tools


linux:ansible:playbooks:patching

Patching script

The process we use is to modify the crontab and then we run the usual patching script

patch-crontab.yml

You use this playbook by simply

 ansible-playbook patch-crontab.yml 
---
- name: change cronjob
  hosts: all

  tasks:
    - name: carry out change
      lineinfile:
        path: /etc/crontab
        regexp: 'yum_update_RHEL.sh'
        line: '00 23 26 apr * root /scripts/yum_update/yum_update_RHEL.sh'

Remember to change the date to the appropriate one

You can check the settings with

ansible all -a "grep RHEL /etc/crontab"

you can also check the results of the patching with

ansible all -a "sudo yum history" >> result1.txt

THis generates a files called result1.txt that has the full saet of yum historys

linux/ansible/playbooks/patching.txt · Last modified: by 127.0.0.1