From ad68a724788b41bdd28ad9733f05a10d319adfa7 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Wed, 20 May 2026 09:00:16 +0200 Subject: [PATCH] chore: use ansible_facts --- templates/apt/sources.d/ubuntu.sources.j2 | 5 ++-- .../apt/sources.d/ubuntu.sources.list.j2 | 24 +++++++++---------- templates/sshd/sshd_config.j2 | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/templates/apt/sources.d/ubuntu.sources.j2 b/templates/apt/sources.d/ubuntu.sources.j2 index 41de9a3..d5d57c6 100644 --- a/templates/apt/sources.d/ubuntu.sources.j2 +++ b/templates/apt/sources.d/ubuntu.sources.j2 @@ -1,11 +1,12 @@ Types: deb URIs: {{ apt_repository_main }} -Suites: {{ ansible_distribution_release }} {{ ansible_distribution_release }}-updates {{ ansible_distribution_release }}-backports +Suites: {{ ansible_facts['distribution_release'] }} {{ ansible_facts['distribution_release'] }}-updates {{ + ansible_facts['distribution_release'] }}-backports Components: main restricted {% if apt_enable_universe == True %}universe{% endif %} {% if apt_enable_multiverse == True %}multiverse{% endif %} Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: {{ apt_repository_security }} -Suites: {{ ansible_distribution_release }}-security +Suites: {{ ansible_facts['distribution_release'] }}-security Components: main restricted {% if apt_enable_universe == True %}universe{% endif %} {% if apt_enable_multiverse == True %}multiverse{% endif %} Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg diff --git a/templates/apt/sources.d/ubuntu.sources.list.j2 b/templates/apt/sources.d/ubuntu.sources.list.j2 index a346e2b..77031b7 100644 --- a/templates/apt/sources.d/ubuntu.sources.list.j2 +++ b/templates/apt/sources.d/ubuntu.sources.list.j2 @@ -1,21 +1,21 @@ # main + restricted -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }} main restricted -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-updates main restricted -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-security main restricted -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-backports main restricted +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }} main restricted +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-updates main restricted +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-security main restricted +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-backports main restricted {% if apt_enable_universe == True %} # universe -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }} universe -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-updates universe -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-security universe -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-backports universe +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }} universe +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-updates universe +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-security universe +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-backports universe {% endif %} {% if apt_enable_multiverse == True %} # multiverse -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }} multiverse -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-updates multiverse -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-security multiverse -deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_distribution_release }}-backports multiverse +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }} multiverse +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-updates multiverse +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-security multiverse +deb [ arch=amd64 ] {{ apt_repository }} {{ ansible_facts['distribution_release'] }}-backports multiverse {% endif %} diff --git a/templates/sshd/sshd_config.j2 b/templates/sshd/sshd_config.j2 index d75e809..eebd38c 100644 --- a/templates/sshd/sshd_config.j2 +++ b/templates/sshd/sshd_config.j2 @@ -29,7 +29,7 @@ Compression no AllowTcpForwarding yes AllowAgentForwarding yes PrintMotd yes -{% if ansible_distribution == 'Debian' %} +{% if ansible_facts['distribution'] == 'Debian' %} UsePAM yes PrintLastLog no {% endif %}