From 3b1445f1a3c0e315c4228d038ee4323099aaa628 Mon Sep 17 00:00:00 2001 From: BenjaminS <97973081+benjisho@users.noreply.github.com> Date: Fri, 28 Apr 2023 02:20:42 +0300 Subject: [PATCH] Update apt-upgrade-update.yml 1. The sudo directive is deprecated since Ansible 2.9, and it's recommended to use become instead. 2. Also, it's a good practice to use Ansible's apt module instead of the shell command for apt operations. --- playbooks/apt-upgrade-update.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/playbooks/apt-upgrade-update.yml b/playbooks/apt-upgrade-update.yml index e89d140..9517daf 100644 --- a/playbooks/apt-upgrade-update.yml +++ b/playbooks/apt-upgrade-update.yml @@ -1,6 +1,12 @@ --- - hosts: all - sudo: yes + become: yes tasks: - - shell: apt-get upgrade -y; apt-get update - + - name: Update apt cache + apt: + update_cache: yes + changed_when: false + + - name: Upgrade all packages + apt: + upgrade: 'yes'