I have a simple Ansible playbook that I use to run updates on all the servers I manage:
- hosts: ubuntu
tasks:
- name: install all updates
apt:
upgrade: dist
update_cache: yes
autoremove: yes
autoclean: yes
- hosts: centos
tasks:
- name: install all updates
yum:
name: '*'
update_cache: yes
state: latest
# use debug to show the output
register: result
- name: Show Output
debug: msg="{{ result.stdout_lines }}"
Is there any way I can make Ansible to show me which packages get updated in the process? Neither the apt nor the yum module provide a an option for this.
Ansible version currently used is 2.4.
Best Answer
Starting with the comment by HBruijn I extended my playbook to show the result of the package management logs afterwards:
The resulting output:
This is a vast improvement, but I'm still hoping someone has a better solution.