From 34ee94071359b7e0e18c1365730fda2aff634fd5 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 28 Jul 2019 20:17:54 +0300 Subject: [PATCH] Fix(init-system): Overwrite `sources.list` only if it's brand-new --- playbooks/debian/roles/init-system/tasks/apt.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/playbooks/debian/roles/init-system/tasks/apt.yml b/playbooks/debian/roles/init-system/tasks/apt.yml index 3ea63a8..a24e44a 100644 --- a/playbooks/debian/roles/init-system/tasks/apt.yml +++ b/playbooks/debian/roles/init-system/tasks/apt.yml @@ -1,3 +1,12 @@ +- name: Check backports + shell: "grep -Fc backports /etc/apt/sources.list || :" + register: apt_configured + changed_when: apt_configured.stdout == "0" + +- debug: + msg: "apt has already been configured" + when: apt_configured.stdout != "0" + - name: Configure apt become: true template: @@ -6,7 +15,7 @@ owner: root group: root mode: '0640' - force: no + when: apt_configured.stdout == "0" - name: Install minimal software packages become: true -- 2.39.5