Use ansible.builtin.apt in a single operation.
Change-Id: Iaccd7a5aaa90fdfd5bb68ee16ef092ea1132b830
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
-- name: Dist upgrade and optional reboot
+- name: "Dist upgrade and optional reboot"
hosts: all
vars:
restart: 'no'
private: no
tasks:
- - name: apt-get update
- apt: update_cache=yes cache_valid_time=3600
+ - name: "apt update && apt dist-upgrade && apt clean && apt autoremove --purge"
+ ansible.builtin.apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ upgrade: dist
+ clean: yes
+ autoremove: yes
+ purge: yes
- - name: apt-get dist-upgrade
- apt: upgrade=dist
-
- - name: apt-get autoremove
- command:
- cmd: apt-get -y --purge autoremove
- warn: false
- register: autoremove_output
- changed_when: "'The following packages will be REMOVED' in autoremove_output.stdout"
-
- - name: reboot server
+ - name: "Reboot server"
command: /sbin/reboot
async: 0
poll: 0