From e04c6caa7051462a7c1963360b20825833546308 Mon Sep 17 00:00:00 2001 From: Maspital Date: Thu, 2 Jan 2025 16:45:38 +0100 Subject: [PATCH] Fix syntax error and remove repository from sources after successful install --- .../external_mail_handler/tasks/main.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/provisioning/ansible/roles/external_mail_handler/tasks/main.yml b/provisioning/ansible/roles/external_mail_handler/tasks/main.yml index 2b83a59..8a5af80 100644 --- a/provisioning/ansible/roles/external_mail_handler/tasks/main.yml +++ b/provisioning/ansible/roles/external_mail_handler/tasks/main.yml @@ -4,11 +4,10 @@ # Additionally, creates a logrotate config file for logs # -- name: Add Kali Linux archive repository - apt_repository: - repo: "deb http://old.kali.org/kali 2024.4 main contrib non-free" - state: present - trusted: yes # Bypass signature verification +- name: Add Kali Linux archive repository manually + copy: + dest: /etc/apt/sources.list.d/kali-archive.list + content: "deb [trusted=yes] http://old.kali.org/kali 2024.4 main contrib non-free" - name: Update apt cache ignoring signature verification shell: apt-get update -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true @@ -27,6 +26,16 @@ state: present allow_downgrade: yes +- name: Remove Kali Linux archive repository after installing required packages + apt_repository: + repo: "deb http://old.kali.org/kali 2024.4 main contrib non-free" + state: absent + +- name: Update apt cache after removing repository + shell: apt-get update + args: + warn: false + - name: "Create script directory {{ script_dir }}" file: path: "{{ script_dir }}"