exam 9

 It is a recommended practice to apply the security updates on the system in periodic intervals.


Write a playbook /home/thor/playbooks/patch_system.yml to ensure servers listed in /home/thor/playbooks/inventory are up to date with periodic security updates.

In CentOS, ensure the playboook installs and configures the yum-cron package to fit the need.

Confiure the yum-cron config file: /etc/yum/yum-cron.conf as update_cmd = security, to auto-update security packages and ensure yum-cron service is restarted afterwards.






Create patch_system.yml playbook and add below given code
---
- hosts: all
  tasks:
    - package:
        name: yum-cron
        state: present
    - lineinfile:
        path: /etc/yum/yum-cron.conf
        regexp: "^update_cmd"
        line: "update_cmd = security"
    - service:
        name: yum-cron
        state: restarted

Comments

Popular posts from this blog

exam 16

ansible 5

practical 3