Created
July 15, 2020 12:30
-
-
Save dreiggy/c4ca263a3f227d84ab100874cc465077 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
#source: https://serverfault.com/a/883713 | |
- hosts: ubuntu | |
tasks: | |
- name: install all updates | |
apt: | |
upgrade: dist | |
update_cache: yes | |
autoremove: yes | |
autoclean: yes | |
register: result | |
- name: List installed and updated packages | |
shell: grep -E "^$(date +%Y-%m-%d).+ (install|upgrade) " /var/log/dpkg.log |cut -d " " -f 3-5 | |
register: result | |
- name: Show Output | |
debug: msg="{{ result.stdout_lines }}" | |
- hosts: centos | |
tasks: | |
- name: install all updates | |
yum: | |
name: '*' | |
update_cache: yes | |
state: latest | |
- name: List updated packages | |
shell: rpm -qa --last | grep "$(date +%a\ %d\ %b\ %Y)" |cut -f 1 -d " " | |
register: result | |
args: | |
warn: no | |
- name: Updates packages | |
debug: msg="{{ result.stdout_lines }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment