Skip to content

Locale are not available #1405

@pratikbin

Description

@pratikbin

Trying to install foreman with ansible

ansible-playbook --become --become-method=sudo -i hosts playbooks/foreman.yml -e foreman_repositories_version=3.0 --diff -vv

getting error The locale you've entered is not available on your system

TASK [foreman_installer : Ensure en_US.UTF-8 locale is available] *************************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:7
ok: [10.10.0.5] => changed=false 
  msg: OK
  name: en_US.UTF-8
 [started TASK: foreman_installer : Print the gateway for each host when defined on 10.10.0.5]

TASK [foreman_installer : Print the gateway for each host when defined] *******************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:11
ok: [10.10.0.5] => 
  msg:
  - en_US.utf8
  - C
 [started TASK: foreman_installer : Ensure ENV locales are available on 10.10.0.5]
redirecting (type: modules) ansible.builtin.locale_gen to community.general.locale_gen
[WARNING]: sftp transfer mechanism failed on [10.10.0.5]. Use ANSIBLE_DEBUG=1 to see detailed information

TASK [foreman_installer : Ensure ENV locales are available] *******************************************************************************************************************************************************
task path: /home/pratik/workspace/pratikbalar/forklift/roles/foreman_installer/tasks/locales.yml:15
failed: [10.10.0.5] (item=en_US.utf8) => changed=false 
  ansible_loop_var: item
  item: en_US.utf8
  msg: The locale you've entered is not available on your system.
redirecting (type: modules) ansible.builtin.locale_gen to community.general.locale_gen
failed: [10.10.0.5] (item=C) => changed=false 
  ansible_loop_var: item
  item: C
  msg: The locale you've entered is not available on your system.

added one job Print query before Ensure ENV locales are available to render and print the query thing

- name: 'Print query'
ansible.builtin.debug:
msg: "{{ query('env', 'LANG', 'LC_ADDRESS', 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_IDENTIFICATION', 'LC_MEASUREMENT', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NAME', 'LC_NUMERIC', 'LC_PAPER', 'LC_TELEPHONE', 'LC_TIME') | unique | select() | list }}"
- name: 'Ensure ENV locales are available'
locale_gen:
name: "{{ item }}"
loop: "{{ query('env', 'LANG', 'LC_ADDRESS', 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_IDENTIFICATION', 'LC_MEASUREMENT', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NAME', 'LC_NUMERIC', 'LC_PAPER', 'LC_TELEPHONE', 'LC_TIME') | unique | select() | list }}"

list of locales with diffrent commands

root@foreman:/home/administrator# localectl status
   System Locale: LANG=en_US.UTF-8
                  LANGUAGE=en_US
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105
root@foreman:/home/administrator# locale
LANG=en_US.UTF-8
LANGUAGE=
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
root@foreman:/home/administrator# localectl list-locales
C.UTF-8
en_US.UTF-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions