Skip to content

Commit

Permalink
ansible: use apt ansible task to autoremove
Browse files Browse the repository at this point in the history
Ansible's builtin `apt` task has had an `autoremove` option since
version 2.1 of the builtin. Using the builtin task rather than
directly running `apt` will correctly set the `DEBIAN_FRONTEND`
environment variable to `noninteractive` to prevent user prompts
from packages which would otherwise cause `apt` to wait for user
input (which will never come when run via Ansible).
  • Loading branch information
richardlau committed Apr 29, 2021
1 parent 44ee1fd commit e028b22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansible/roles/package-upgrade/tasks/partials/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
environment:
FLASH_KERNEL_SKIP: true

# don't know how to use autoremove=yes for all packages
- name: clean unwanted packages
command: apt-get -y autoremove warn=False
apt:
autoremove: yes

0 comments on commit e028b22

Please sign in to comment.