]> git.phdru.name Git - ansible.git/commitdiff
Fix(init-system): Overwrite `sources.list` only if it's brand-new
authorOleg Broytman <phd@phdru.name>
Sun, 28 Jul 2019 17:17:54 +0000 (20:17 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 28 Jul 2019 18:43:45 +0000 (21:43 +0300)
playbooks/debian/roles/init-system/tasks/apt.yml

index 3ea63a8c2decd7aa7b9f02bbcf305832f301b8af..a24e44aa49ae938a05a412da243cf1acd13cfc20 100644 (file)
@@ -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