Ansible: How can I update the system CentOS with Ansible


I am trying to update the CentOS systems with ansible. Unfortunately I am not able to do that.

I already tried:

Isn’t working.

The last task works but is it true, that the task updates the system?


The first task you’re telling the system to only update the yum cache.

On the second you are effectively upgrading all packages to the latest version by using state=latest but you should also use update_cache=yes on the same task to be sure you’re refreshing the cache with its latest package information.

The yum module documentation provides exactly this example:

After the execution of the task, the terminal should display a message in yellow meaning the status of the task is changed.

Leave a Reply