From b9581a9fa383a48bcf4a0c918c42ef9f109eace8 Mon Sep 17 00:00:00 2001 From: jalr Date: Thu, 22 Mar 2018 21:48:28 +0100 Subject: [PATCH] Add defaults; clear sources.list --- packer/ansible/playbook.yml | 10 +++++----- packer/ansible/roles/packages/defaults/main.yml | 4 ++++ packer/ansible/roles/packages/tasks/sources.yml | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 packer/ansible/roles/packages/defaults/main.yml diff --git a/packer/ansible/playbook.yml b/packer/ansible/playbook.yml index 52ab4e8..9bff890 100644 --- a/packer/ansible/playbook.yml +++ b/packer/ansible/playbook.yml @@ -52,11 +52,11 @@ version: 1.8.5 visicut: url: "https://github.com/t-oster/VisiCut/releases/download/1.7_310/visicut_1.7-310-gcf8c087-1_all.deb" - apt_sources: - debian_sections: - - main - - contrib - - non-free + debian_sections: + - main + - contrib + - non-free + debian_mirror: http://ftp.de.debian.org/debian hardware: firmware: - firmware-amd-graphics diff --git a/packer/ansible/roles/packages/defaults/main.yml b/packer/ansible/roles/packages/defaults/main.yml new file mode 100644 index 0000000..766cd0c --- /dev/null +++ b/packer/ansible/roles/packages/defaults/main.yml @@ -0,0 +1,4 @@ +debian_mirror: http://deb.debian.org/debian +debian_mirror_security: http://security.debian.org/ +debian_sections: + - main diff --git a/packer/ansible/roles/packages/tasks/sources.yml b/packer/ansible/roles/packages/tasks/sources.yml index 2841021..2ed5381 100644 --- a/packer/ansible/roles/packages/tasks/sources.yml +++ b/packer/ansible/roles/packages/tasks/sources.yml @@ -1,15 +1,25 @@ --- +- name: clear sources.list + copy: + content: "" + dest: /etc/apt/sources.list + - name: configure main repo apt_repository: - repo: "deb http://deb.debian.org/debian stretch {{ apt_sources.debian_sections | join(' ') }}" + filename: "{{ ansible_distribution_release }}" + repo: "deb {{ debian_mirror }} {{ ansible_distribution_release }} {{ debian_sections | join(' ') }}" state: present - name: configure updates repo apt_repository: - repo: "deb http://deb.debian.org/debian stretch-updates {{ apt_sources.debian_sections | join(' ') }}" + filename: "{{ ansible_distribution_release }}-updates" + repo: "deb {{ mirror }} {{ ansible_distribution_release }}-updates {{ debian_sections | join(' ') }}" state: present + vars: + mirror: "{{ debian_mirror_updates | default(debian_mirror) }}" - name: configure security updates repo apt_repository: - repo: "deb http://security.debian.org stretch/updates {{ apt_sources.debian_sections | join(' ') }}" + filename: "{{ ansible_distribution_release }}-security" + repo: "deb {{ debian_mirror_security }} {{ ansible_distribution_release }}/updates {{ debian_sections | join(' ') }}" state: present