From 89db59788108fc68325a57e5374f7fdfa0ed269c Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 4 Nov 2020 09:11:07 +0200 Subject: feat! make all sane_debian_system variables be prefixed properly This is a breaking change. --- roles/sane_debian_system/defaults/main.yml | 14 ++++++++------ roles/sane_debian_system/subplot.md | 10 +++++----- roles/sane_debian_system/tasks/apt.yml | 12 ++++++------ roles/sane_debian_system/tasks/env.yml | 12 ++++++------ roles/sane_debian_system/tasks/main.yml | 2 +- roles/sane_debian_system/templates/sources.list.j2 | 13 +------------ 6 files changed, 27 insertions(+), 36 deletions(-) (limited to 'roles') diff --git a/roles/sane_debian_system/defaults/main.yml b/roles/sane_debian_system/defaults/main.yml index 95eeb42..43d0262 100644 --- a/roles/sane_debian_system/defaults/main.yml +++ b/roles/sane_debian_system/defaults/main.yml @@ -1,18 +1,20 @@ # These are the variables expected by this role. +# Playbook should set this to the version of this role it expects to +# use. sane_debian_system_version: null # The desired hostname. Default is empty, which means hostname won't # be set. -hostname: "" +sane_debian_system_hostname: "" # The Debian release code name to use. -debian_codename: +sane_debian_system_codename: # Default Debian mirror to use. Default should work everywhere, but if # needed, pick a faster mirror, perhaps a local one. -debian_mirror: deb.debian.org +sane_debian_system_mirror: deb.debian.org # A list of extra APT repositories to add. Each list entry should be a @@ -21,13 +23,13 @@ debian_mirror: deb.debian.org # keys are "signing_key", the public key of the archive signing key, # and "keyring_packge", which contains the .deb package with the # archive signing key. -sources_lists: [] +sane_debian_system_sources_lists: [] # Locales that should be generated. This should be a list of name, such as # fi_FI.UTF-8. -locales: [] +sane_debian_system_locales: [] # Default time zone. -timezone: UTC +sane_debian_system_timezone: UTC diff --git a/roles/sane_debian_system/subplot.md b/roles/sane_debian_system/subplot.md index af2a53f..087ae44 100644 --- a/roles/sane_debian_system/subplot.md +++ b/roles/sane_debian_system/subplot.md @@ -20,10 +20,10 @@ and the host has saneone in /etc/hosts for 127.0.1.1 ~~~ ~~~{#sane1.yml .file .yaml} -sane_debian_system_version: 0 +sane_debian_system_version: 1 -debian_codename: buster -hostname: saneone +sane_debian_system_codename: buster +sane_debian_system_hostname: saneone ~~~ ## Checks that debian codename is set @@ -34,9 +34,9 @@ when I use role sane_debian_system and I use variables from sane2.yml and I try to run the playbook then the command fails -and stdout contains "debian_codename" +and stdout contains "sane_debian_system_codename" ~~~ ~~~{#sane2.yml .file .yaml} -sane_debian_system_version: 0 +sane_debian_system_version: 1 ~~~ diff --git a/roles/sane_debian_system/tasks/apt.yml b/roles/sane_debian_system/tasks/apt.yml index d7c82d4..21eea70 100644 --- a/roles/sane_debian_system/tasks/apt.yml +++ b/roles/sane_debian_system/tasks/apt.yml @@ -1,9 +1,9 @@ # Safety check: make sure debian_codename is set. -- name: check that debian_codename is set +- name: check that sane_debian_system_codename is set shell: | - if [ "{{ debian_codename }}" = "" ] + if [ "{{ sane_debian_system_codename }}" = "" ] then - echo "You MUST set debian_codename" 1>&2 + echo "You MUST set sane_debian_system_codename" 1>&2 exit 1 fi @@ -42,13 +42,13 @@ dest: /etc/apt/sources.list - name: additional sources.list.d/* - with_items: "{{ sources_lists }}" + with_items: "{{ sane_debian_system_sources_lists }}" apt_repository: repo: "{{ item.repo }}" update_cache: no - name: add archive signing keys - with_items: "{{ sources_lists }}" + with_items: "{{ sane_debian_system_sources_lists }}" apt_key: data: "{{ item.signing_key }}" state: present @@ -60,7 +60,7 @@ cache_valid_time: 0 - name: add archive keyrings - with_items: "{{ sources_lists }}" + with_items: "{{ sane_debian_system_sources_lists }}" apt: name: "{{ item.keyring_package }}" when: item.keyring_package is defined diff --git a/roles/sane_debian_system/tasks/env.yml b/roles/sane_debian_system/tasks/env.yml index 3b6ae9e..db8f5ba 100644 --- a/roles/sane_debian_system/tasks/env.yml +++ b/roles/sane_debian_system/tasks/env.yml @@ -4,19 +4,19 @@ - name: set /etc/hostname hostname: - name: "{{ hostname }}" - when: hostname is defined + name: "{{ sane_debian_system_hostname }}" + when: sane_debian_system_hostname is defined - name: add hostname to /etc/hosts lineinfile: dest: /etc/hosts regexp: '^127\.0\.1\.1 ' - line: "127.0.1.1 {{ hostname }}" - when: hostname is defined + line: "127.0.1.1 {{ sane_debian_system_hostname }}" + when: sane_debian_system_hostname is defined - name: set timezone timezone: - name: "{{ timezone }}" + name: "{{ sane_debian_system_timezone }}" - name: install environment packages apt: @@ -29,4 +29,4 @@ locale_gen: name: "{{ item }}" state: present - with_items: "{{ locales }}" + with_items: "{{ sane_debian_system_locales }}" diff --git a/roles/sane_debian_system/tasks/main.yml b/roles/sane_debian_system/tasks/main.yml index 5a16724..7722f1c 100644 --- a/roles/sane_debian_system/tasks/main.yml +++ b/roles/sane_debian_system/tasks/main.yml @@ -1,6 +1,6 @@ - name: "sane_debian_system_version" shell: | - [ "{{ sane_debian_system_version }}" = "0" ] || \ + [ "{{ sane_debian_system_version }}" = "1" ] || \ (echo "Unexpected version {{ sane_debian_system_version }}" 1>&2; exit 1) - include: apt.yml diff --git a/roles/sane_debian_system/templates/sources.list.j2 b/roles/sane_debian_system/templates/sources.list.j2 index 65e8706..897e2ce 100644 --- a/roles/sane_debian_system/templates/sources.list.j2 +++ b/roles/sane_debian_system/templates/sources.list.j2 @@ -1,12 +1 @@ -deb http://{{ debian_mirror }}/debian {{ debian_codename }} main - -{% if debian_codename != 'unstable' %} -deb http://security.debian.org/ {{ debian_codename }}/updates main -{% endif %} - -{% if debian_codename != 'buster' %} -{% if debian_codename != 'unstable' %} -deb http://{{ debian_mirror }}/debian {{ debian_codename }}-updates main -deb http://{{ debian_mirror }}/debian {{ debian_codename }}-backports main -{% endif %} -{% endif %} +deb http://{{ sane_debian_system_mirror }}/debian {{ sane_debian_system_codename }} main -- cgit v1.2.1