From 1684e9a2514ee6287d77529698452eb850b6ac56 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 3 Nov 2023 16:07:08 +0100 Subject: [PATCH 1/2] Ubuntu no longer has /var/lib/locales/supported.d/local fixes #10 fixes #9 --- .github/workflows/ci.yml | 6 ++--- README.md | 44 +++++++++++++++++---------------- Vagrantfile | 20 +++++++-------- defaults/main.yml | 3 +-- meta/main.yml | 4 +-- tasks/main.yml | 11 +++++++++ templates/etc/default/locale.j2 | 2 +- vars/_default.yml | 3 +++ vars/_trusty.yml | 3 +++ vars/main.yml | 1 - 10 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 vars/_default.yml create mode 100644 vars/_trusty.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4658bf8..be428c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,9 +44,9 @@ jobs: fail-fast: false matrix: include: - - distro: debian8 - - distro: debian9 - distro: debian10 + - distro: debian11 + - distro: debian12 - distro: ubuntu1604 ansible-version: '>=2.10, <2.11' - distro: ubuntu1604 @@ -66,7 +66,7 @@ jobs: python-version: '3.x' - name: Install test dependencies - run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker + run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker - name: Run Molecule tests run: | diff --git a/README.md b/README.md index a4d584b..42b5514 100644 --- a/README.md +++ b/README.md @@ -11,27 +11,29 @@ None #### Variables - * `locales_present` [default: `[en_US.UTF-8]`]: - * `locales_language_packs_present` [default: `[language-pack-en, language-pack-en-base]`]: - * `locales_absent` [default: `[]`]: - * `locales_language_packs_absent` [default: `[]`]: - * `locales_default`: - * `lang` [default: `en_US.UTF-8`]: Provides default value for LC_* variables that have not been explicitly set - * `language` [optional]: Same as above? But with higher priority, [see](http://www.gnu.org/software/gettext/manual/gettext.html#Locale-Environment-Variables) - * `lc_address` [optional]: How addresses are formatted (country first or last, where zip code goes etc.) - * `lc_all` [optional]: Overrides individual LC_* settings: if LC_ALL is set, none of the below have any effect - * `lc_collate` [optional]: How strings (file names...) are alphabetically sorted. Using the "C" or "POSIX" locale here results in a strcmp()-like sort order, which may be preferable to language-specific locales - * `lc_ctype` [optional]: How characters are classified as letters, numbers etc. This determines things like how characters are converted between upper and lower case - * `lc_identification` [optional]: Metadata about the locale information - * `lc_measurement` [optional]: What units of measurement are used (feet, meters, pounds, kilos etc.) - * `lc_messages` [optional]: What language should be used for system messages - * `lc_monetary` [optional]: What currency you use, its name, and its symbol - * `lc_name` [optional]: How names are represented (surname first or last, etc.) - * `lc_numeric` [optional]: How you format your numbers. For example, in many countries a period (.) is used as a decimal separator, while others use a comma (,) - * `lc_paper` [optional]: Paper sizes: 11 x 17 inches, A4, etc - * `lc_response` [optional]: Determines how responses (such as Yes and No) appear in the local language - * `lc_telephone` [optional]: What your telephone numbers look like - * `lc_time` [optional]: How your time and date are formatted. Use for example "en_DK.UTF-8" to get a 24-hour-clock in some programs +* `locales_present` [default: `['en_US.UTF-8']`]: +* `locales_absent` [default: `[]`]: +* +* `locales_language_packs_present` [default: `['language-pack-en', 'language-pack-en-base']`]: +* `locales_language_packs_absent` [default: `[]`]: +* +* `locales_default`: [default: `{}`]: Default declarations +* `locales_default.lang`: [default: `'en_US.UTF-8'`]: Provides default value for `LC_*` variables that have not been explicitly set +* `locales_default.language`: [optional]: Same as above? But with higher priority, [see](http://www.gnu.org/software/gettext/manual/gettext.html#Locale-Environment-Variables) +* `locales_default.lc_address`: [optional]: How addresses are formatted (country first or last, where zip code goes etc.) +* `locales_default.lc_all`: [optional]: Overrides individual `LC_*` settings: if `LC_ALL` is set, none of the below have any effect +* `locales_default.lc_collate`: [optional]: How strings (file names...) are alphabetically sorted. Using the "C" or "POSIX" locale here results in a strcmp()-like sort order, which may be preferable to language-specific locales +* `locales_default.lc_ctype`: [optional]: How characters are classified as letters, numbers etc. This determines things like how characters are converted between upper and lower case +* `locales_default.lc_identification`: [optional]: Metadata about the locale information +* `locales_default.lc_measurement`: [optional]: What units of measurement are used (feet, meters, pounds, kilos etc.) +* `locales_default.lc_messages`: [optional]: What language should be used for system messages +* `locales_default.lc_monetary`: [optional]: What currency you use, its name, and its symbol +* `locales_default.lc_name`: [optional]: How names are represented (surname first or last, etc.) +* `locales_default.lc_numeric`: [optional]: How you format your numbers. For example, in many countries a period (.) is used as a decimal separator, while others use a comma (,) +* `locales_default.lc_paper`: [optional]: Paper sizes: 11 x 17 inches, A4, etc +* `locales_default.lc_response`: [optional]: Determines how responses (such as Yes and No) appear in the local language +* `locales_default.lc_telephone`: [optional]: What your telephone numbers look like +* `locales_default.lc_time`: [optional]: How your time and date are formatted. Use for example "en_DK.UTF-8" to get a 24-hour-clock in some programs ## Dependencies diff --git a/Vagrantfile b/Vagrantfile index 4713224..7d9405a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -23,7 +23,7 @@ boxes = [ :box => "bento/ubuntu-20.04", :ip => '10.0.0.14', :cpu => "50", - :ram => "384" + :ram => "512" }, { :name => "ubuntu-2204", @@ -33,23 +33,23 @@ boxes = [ :ram => "512" }, { - :name => "debian-8", - :box => "bento/debian-8", - :ip => '10.0.0.16', + :name => "debian-10", + :box => "bento/debian-10", + :ip => '10.0.0.18', :cpu => "50", :ram => "256" }, { - :name => "debian-9", - :box => "bento/debian-9", - :ip => '10.0.0.17', + :name => "debian-11", + :box => "bento/debian-11", + :ip => '10.0.0.19', :cpu => "50", :ram => "256" }, { - :name => "debian-10", - :box => "bento/debian-10", - :ip => '10.0.0.18', + :name => "debian-12", + :box => "bento/debian-12", + :ip => '10.0.0.20', :cpu => "50", :ram => "256" }, diff --git a/defaults/main.yml b/defaults/main.yml index 3febaed..268ae9f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,5 +11,4 @@ locales_absent: [] locales_language_packs_absent: [] -locales_default: - lang: en_US.UTF-8 +locales_default: {} diff --git a/meta/main.yml b/meta/main.yml index 0366a94..f6b5fdb 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -16,9 +16,9 @@ galaxy_info: - jammy - name: Debian versions: - - jessie - - stretch - buster + - bullseye + - bookworm galaxy_tags: - system dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index cd43ca7..6208264 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,16 @@ # tasks file --- +- name: include variables + ansible.builtin.include_vars: "{{ item }}" + with_first_found: + - "_{{ ansible_distribution_release }}.yml" + - "_{{ ansible_distribution | lower }}.yml" + - _default.yml + tags: + - configuration + - locales + - locales-include-variables + - name: install # noqa args[module] ansible.builtin.apt: name: "{{ locales_dependencies }}" diff --git a/templates/etc/default/locale.j2 b/templates/etc/default/locale.j2 index c1ff1ed..4e6974b 100644 --- a/templates/etc/default/locale.j2 +++ b/templates/etc/default/locale.j2 @@ -1,5 +1,5 @@ # {{ ansible_managed }} -LANG={{ locales_default.lang }} +LANG={{ locales_default.lang | default('en_US.UTF-8') }} {% if locales_default.language is defined %} LANGUAGE="{{ locales_default.language }}" {% endif %} diff --git a/vars/_default.yml b/vars/_default.yml new file mode 100644 index 0000000..ad75f0b --- /dev/null +++ b/vars/_default.yml @@ -0,0 +1,3 @@ +# vars file +--- +locales_gen_file: /etc/locale.gen diff --git a/vars/_trusty.yml b/vars/_trusty.yml new file mode 100644 index 0000000..7395ef2 --- /dev/null +++ b/vars/_trusty.yml @@ -0,0 +1,3 @@ +# vars file +--- +locales_gen_file: /var/lib/locales/supported.d/local diff --git a/vars/main.yml b/vars/main.yml index de59fea..b5b1e5c 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -3,4 +3,3 @@ locales_dependencies: - tzdata - locales -locales_gen_file: "{{ '/var/lib/locales/supported.d/local' if ansible_distribution == 'Ubuntu' else '/etc/locale.gen' }}" From baa5d1624e7dac364392534122f3bce33799bfc8 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 3 Nov 2023 16:36:32 +0100 Subject: [PATCH 2/2] Cs fixes --- Vagrantfile | 2 +- handlers/main.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 7d9405a..f6252e5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -33,7 +33,7 @@ boxes = [ :ram => "512" }, { - :name => "debian-10", + :name => "debian-10", :box => "bento/debian-10", :ip => '10.0.0.18', :cpu => "50", diff --git a/handlers/main.yml b/handlers/main.yml index 707b93a..b25c67c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,3 +3,4 @@ - name: update locales ansible.builtin.command: > dpkg-reconfigure --frontend noninteractive locales + changed_when: true