sysadmin is patching systems
sysadmin is patching systems
In the first line, we give the task a meaningful name so we know what
Ansible is doing. In the next line, the yum module updates the CentOS
virtual machine (VM), then name: "*" tells yum to update everything,
and, finally, state: latest updates to the latest RPM.
The shell module puts the system to sleep for 5 seconds then reboots.
We use sleep to prevent the connection from breaking, async to avoid
timeout, and poll to fire & forget. We pause for 10 seconds to wait
for the VM to come back and use wait_for_connection to connect back
to the VM as soon as it can make a connection. Then we install
epel-release to test the RPM installation. You can run this playbook
multiple times to show the idempotent, and the only task that will
show as changed is the reboot since we are using the shell module.
You can use changed_when: False to ignore the change when using
the shell module if you expect no actual changes.
- hosts: all
roles:
- centos-update
- nginx-simple