From: Oleg Broytman Date: Sun, 1 Sep 2019 23:41:44 +0000 (+0300) Subject: Feat(variables): Calculate Debian distribution X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=81c71e4cc95aecf38f263e385f2a2ebd20b9eda6;p=ansible.git Feat(variables): Calculate Debian distribution Ansible knows OS family and version, there is no need to mark every host with variable `debian_distr`. --- diff --git a/hosts b/hosts index 0e3f9ed..332312f 100644 --- a/hosts +++ b/hosts @@ -10,5 +10,4 @@ oper.med.ru 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/debian/roles/dev-packages/tasks/main.yml b/playbooks/debian/roles/dev-packages/tasks/main.yml index e523f95..5d733bc 100644 --- a/playbooks/debian/roles/dev-packages/tasks/main.yml +++ b/playbooks/debian/roles/dev-packages/tasks/main.yml @@ -7,7 +7,7 @@ install_recommends: no name: ['g++', 'gcc', 'git', 'libexpat1', 'libffi6', - 'libgdbm{% if debian_distr == "stretch" %}3{% elif debian_distr == "buster" %}6{% endif %}', + 'libgdbm{% if ansible_facts.distribution_major_version == "9" %}3{% elif ansible_facts.distribution_major_version == "10" %}6{% endif %}', 'libgmp10', 'liblzma5', 'libmpdec2', 'libreadline5', 'libreadline7', 'make', 'openssl', 'patch', 'sqlite3', 'zlib1g', diff --git a/playbooks/debian/roles/init-system/templates/sources.list b/playbooks/debian/roles/init-system/templates/sources.list index a235526..6681c9d 100644 --- a/playbooks/debian/roles/init-system/templates/sources.list +++ b/playbooks/debian/roles/init-system/templates/sources.list @@ -1,3 +1,8 @@ +{% if ansible_facts.distribution_major_version == '9' %} +{% set debian_distr = 'stretch' %} +{% elif ansible_facts.distribution_major_version == '10' %} +{% set debian_distr = 'buster' %} +{% endif %} deb {{ debian_mirror }} {{ debian_distr }} main non-free contrib deb {{ debian_mirror }} {{ debian_distr }}-updates main non-free contrib diff --git a/playbooks/debian/roles/python-dev-packages/tasks/main.yml b/playbooks/debian/roles/python-dev-packages/tasks/main.yml index 0b3f99b..1c9277f 100644 --- a/playbooks/debian/roles/python-dev-packages/tasks/main.yml +++ b/playbooks/debian/roles/python-dev-packages/tasks/main.yml @@ -9,7 +9,7 @@ ] state: latest update_cache: yes - when: debian_distr == "stretch" + when: ansible_facts.distribution_major_version == '9' - name: Install development packages become: true diff --git a/vbox-inventory b/vbox-inventory index 6d49280..decbb80 100644 --- a/vbox-inventory +++ b/vbox-inventory @@ -1,3 +1,3 @@ -vbox-d9 ansible_host=localhost ansible_port=2022 debian_distr=stretch debian_mirror=http://mirror.yandex.ru/debian -vbox-d10 ansible_host=localhost ansible_port=2022 debian_distr=buster debian_mirror=https://mirror.yandex.ru/debian +vbox-d9 ansible_host=localhost ansible_port=2022 debian_mirror=http://mirror.yandex.ru/debian +vbox-d10 ansible_host=localhost ansible_port=2022 debian_mirror=https://mirror.yandex.ru/debian vbox-f30-64 ansible_host=localhost ansible_port=2022