From 4720b514057d5a996d3e572d05c7cdd7dcc09b52 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 16 Jul 2019 02:25:26 +0300 Subject: [PATCH] Feat(debian-init-system): Configure `apt` Setup `/etc/apt/sources.list` from a template. --- hosts | 6 +++++- playbooks/roles/debian-init-system/README.txt | 2 +- .../roles/debian-init-system/tasks/main.yml | 16 ++++++++++++++++ .../debian-init-system/templates/sources.list | 13 +++++++++++++ vbox-inventory | 6 +++++- 5 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 playbooks/roles/debian-init-system/templates/sources.list diff --git a/hosts b/hosts index 7c5f185..0e3f9ed 100644 --- a/hosts +++ b/hosts @@ -7,4 +7,8 @@ iskra-aviel.phdru.name [servers] iskra-aviel.phdru.name oper.med.ru -phdru.name +phdru.name debian_mirror=http://debian.mirror.cambrium.nl/debian + +[all:vars] +debian_distr=stretch +debian_mirror=http://mirror.yandex.ru/debian diff --git a/playbooks/roles/debian-init-system/README.txt b/playbooks/roles/debian-init-system/README.txt index 57a5b0a..1f7eced 100644 --- a/playbooks/roles/debian-init-system/README.txt +++ b/playbooks/roles/debian-init-system/README.txt @@ -1 +1 @@ -Init new Debian system: install minimal list of packages. +Init new Debian system: configure apt, install minimal list of packages. diff --git a/playbooks/roles/debian-init-system/tasks/main.yml b/playbooks/roles/debian-init-system/tasks/main.yml index 76a06fe..39c1900 100644 --- a/playbooks/roles/debian-init-system/tasks/main.yml +++ b/playbooks/roles/debian-init-system/tasks/main.yml @@ -1,3 +1,12 @@ +- name: Configure apt + become: true + template: + src: sources.list + dest: /etc/apt/sources.list + owner: root + group: root + mode: '0640' + - name: Install minimal software packages become: true apt: @@ -13,3 +22,10 @@ purge: yes state: latest update_cache: yes + +- name: Configure apt key for deb-multimedia + become: true + apt_key: + keyserver: keyserver.ubuntu.com + id: 5C808C2B65558117 + when: "inventory_hostname in ('localhost', 'iskra-aviel.phdru.name')" diff --git a/playbooks/roles/debian-init-system/templates/sources.list b/playbooks/roles/debian-init-system/templates/sources.list new file mode 100644 index 0000000..a235526 --- /dev/null +++ b/playbooks/roles/debian-init-system/templates/sources.list @@ -0,0 +1,13 @@ +deb {{ debian_mirror }} {{ debian_distr }} main non-free contrib +deb {{ debian_mirror }} {{ debian_distr }}-updates main non-free contrib + +deb {{ debian_mirror }}-security {{ debian_distr }}/updates main non-free contrib +#deb {{ debian_mirror }} {{ debian_distr }}-backports main non-free contrib +{% if inventory_hostname in ('localhost', 'iskra-aviel.phdru.name') %} + +deb {{ debian_mirror }}-multimedia {{ debian_distr }} main non-free +#deb {{ debian_mirror }}-multimedia {{ debian_distr }}-backports main non-free + +#deb https://deb.opera.com/opera/ stable non-free +#deb https://download.virtualbox.org/virtualbox/debian {{ debian_distr }} contrib non-free +{% endif %} diff --git a/vbox-inventory b/vbox-inventory index e52e579..a478ee1 100644 --- a/vbox-inventory +++ b/vbox-inventory @@ -1,2 +1,6 @@ [servers] -vbox ansible_host=localhost ansible_port=2022 +vbox ansible_host=localhost ansible_port=2022 debian_distr=buster + +[all:vars] +debian_distr=stretch +debian_mirror=https://mirror.yandex.ru/debian -- 2.39.5