Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu no longer has /var/lib/locales/supported.d/local #23

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ boxes = [
:box => "bento/ubuntu-20.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "384"
:ram => "512"
},
{
:name => "ubuntu-2204",
Expand All @@ -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"
},
Expand Down
3 changes: 1 addition & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ locales_absent: []

locales_language_packs_absent: []

locales_default:
lang: en_US.UTF-8
locales_default: {}
1 change: 1 addition & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# handlers file
---
- name: update locales

Check warning on line 3 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.command: >
dpkg-reconfigure --frontend noninteractive locales
changed_when: true
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ galaxy_info:
- jammy
- name: Debian
versions:
- jessie
- stretch
- buster
- bullseye
- bookworm
galaxy_tags:
- system
dependencies: []
11 changes: 11 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# tasks file
---
- name: include variables

Check warning on line 3 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
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]

Check warning on line 14 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.apt:
name: "{{ locales_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
Expand All @@ -11,7 +22,7 @@
- locales
- locales-install

- name: install (specified) language packs # noqa args[module]

Check warning on line 25 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.apt:
name: "{{ locales_language_packs_present }}"
state: "{{ apt_install_state | default('latest') }}"
Expand All @@ -22,7 +33,7 @@
- locales
- locales-language-packs-present

- name: remove (specified) language packs

Check warning on line 36 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.apt:
name: "{{ locales_language_packs_absent }}"
state: absent
Expand All @@ -33,7 +44,7 @@
- locales
- locales-language-packs-absent

- name: detect locale gen file

Check warning on line 47 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.stat:
path: "{{ locales_gen_file }}"
register: _locales_gen_file_stats
Expand All @@ -42,7 +53,7 @@
- locales
- locales-gen-file

- name: create locale gen file

Check warning on line 56 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.file:
path: "{{ locales_gen_file }}"
state: touch
Expand All @@ -53,7 +64,7 @@
- locales
- locales-gen-file

- name: make sure (specified) locales are present

Check warning on line 67 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
community.general.locale_gen:
name: "{{ item }}"
state: present
Expand All @@ -63,7 +74,7 @@
- locales
- locales-present

- name: make sure (specified) locales are absent

Check warning on line 77 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
community.general.locale_gen:
name: "{{ item }}"
state: absent
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/default/locale.j2
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
3 changes: 3 additions & 0 deletions vars/_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# vars file
---
locales_gen_file: /etc/locale.gen
3 changes: 3 additions & 0 deletions vars/_trusty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# vars file
---
locales_gen_file: /var/lib/locales/supported.d/local
1 change: 0 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}"
Loading