/ansible-role-locales

The Ansible locales role used by Infopen company

Primary LanguageJinjaMIT LicenseMIT

locales

CI Mergify Status Updates Python 3 Ansible Role

Install locales package.

Requirements

This role requires Ansible 2.8 or higher, and platform requirements are listed in the metadata file.

Testing

This role use Molecule to run tests.

Local and Github Actions tests run tests on Docker by default. See molecule documentation to use other backend.

Currently, tests are done on:

  • CentOS 7
  • CentOS 8
  • Debian Buster
  • Debian Stretch
  • Ubuntu Bionic
  • Ubuntu Focal

and use:

  • Ansible 2.8.x
  • Ansible 2.9.x

Running tests

Using Docker driver

$ tox

You can also configure molecule options and molecule command using environment variables:

  • MOLECULE_OPTIONS Default: "--debug"
  • MOLECULE_COMMAND Default: "test"
$ MOLECULE_OPTIONS='' MOLECULE_COMMAND=converge tox

Role Variables

Default role variables

# Packages management
locales_packages: "{{ _locales_packages }}"
locales_language_packs_packages: "{{ _locales_language_packs_packages | default([]) }}"
locales_repositories_cache_valid_time: 3600

# Files management
locales_config_file_dest: "{{ _locales_config_file_dest }}"
locales_gen_file_dest: "{{ _locales_gen_file_dest }}"
locales_update_command: "{{ _locales_update_command }}"
locales_config_file_owner: 'root'
locales_config_file_group: 'root'
locales_config_file_mode: '0644'

# Locales management
locales_to_configure:
  - name: 'en_US.UTF-8'
    modifier: 'UTF-8'
locales_defaults:
  LANG: 'en_US.UTF-8'
  LANGUAGE: 'en_US.UTF-8'
  LC_CTYPE: '"en_US.UTF-8"'
  LC_NUMERIC: '"en_US.UTF-8"'
  LC_TIME: '"en_US.UTF-8"'
  LC_COLLATE: '"en_US.UTF-8"'
  LC_MONETARY: '"en_US.UTF-8"'
  LC_MESSAGES: '"en_US.UTF-8"'
  LC_PAPER: '"en_US.UTF-8"'
  LC_NAME: '"en_US.UTF-8"'
  LC_ADDRESS: '"en_US.UTF-8"'
  LC_TELEPHONE: '"en_US.UTF-8"'
  LC_MEASUREMENT: '"en_US.UTF-8"'
  LC_IDENTIFICATION: '"en_US.UTF-8"'
  LC_ALL: 'en_US.UTF-8'

Debian family role variables

# Packages
_locales_packages:
  - name: 'locales'

# Configuration files path
_locales_config_file_dest: '/etc/default/locale'
_locales_gen_file_dest: '/etc/locale.gen'

# Locale update command
_locales_update_command: '/usr/sbin/update-locale'

Ubuntu OS role variables

locales_language_packs_packages:
  - name: 'language-pack-en'

Dependencies

None

Example Playbook

- hosts: servers
  roles:
    - { role: infOpen.locales }

License

MIT

Author Information

Alexandre Chaussier (for Infopen company)