Ansible Core Yum Update RHEL

Scenario: Patching run yum update using Ansible to RHEL 6/7 remote machine
System: RHEL 7, Ansible 2.6 (Callback and ansible log is active)
Remote System: RHEL 6/7 (not using ssh key), same root password.

Example yum update host group devservers, here my steps:
1) Empty ansible log.
# cat /dev/null > /var/log/ansible.log

2) Input hosts devservers in /etc/ansible/hosts
# vi /etc/ansible/hosts

3) Crete yaml file ssh login to remote servers.
# mkdir -p /etc/ansible/group_vars
# vi /etc/ansible/group_vars/devservers

4) Create yum playbook
# vi /etc/ansible/yumupdatedev.yml

5) Run the yum playbook.
Below is the result when running above playbook in step 4.

6) Finish copy ansible.log for the your report to your boss.
# cp -avi /var/log/ansible.log /home/bachem/yumreport_$(date -I).txt


Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *