# new module locale\_gen fails with "Is the package “locales” installed?"

**URL:** <https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 24, 2014, 9:16pm UTC](https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088 "2014-04-24T21:16:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayounggun](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@ayounggun](https://forum.ansible.com/u/ayounggun)\
**Post date:** [April 24, 2014, 9:16pm UTC](https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088/1 "2014-04-24T21:16:28Z")

</div>

Hi all

Can anyone see what I’m doing wrong? I’m trying to generate and set the system’s locale with the following tasks against ubuntu server 14.04.

**tasks**

- name: install the locales package

apt: pkg=locales state=present

- name: ensure the locale exists  
locale\_gen: name={{ locale }} state=present

- name: set the locale  
command: /usr/sbin/update-locale LANG={{ locale }} --reset

**output**

msg: /etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package “locales” installed?

However I have confirmed that the locales package is indeed installed.

Also if I don’t use the locale\_gen: module everything works fine.

**tasks**

- name: install the locales package

apt: pkg=locales state=present

- name: ensure the locale exists  
command: /usr/sbin/locale-gen {{ locale }}

- name: set the locale  
command: /usr/sbin/update-locale LANG={{ locale }} --reset

**output**

changed: [[vps03.fqdn.com](http://vps03.fqdn.com)] =\> {“changed”: true, “cmd”: [“/usr/sbin/locale-gen”, “en\_GB.UTF-8”], “delta”: “0:00:02.105356”, “end”: “2014-04-25 01:03:10.600058”, “item”: “”, “rc”: 0, “start”: “2014-04-25 01:03:08.494702”, “stderr”: “”, “stdout”: “Generating locales…\n en\_GB.UTF-8… done\nGeneration complete.”}

Thanks for the help

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 25, 2014, 8:36pm UTC](https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088/2 "2014-04-25T20:36:58Z")

</div>

“However I have confirmed that the locales package is indeed installed.”

Is it installed on the remote node? That’s where it’s needed.

---

<div class="post-metadata">

**Author:** ![ayounggun](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@ayounggun](https://forum.ansible.com/u/ayounggun)\
**Post date:** [May 5, 2014, 7:01pm UTC](https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088/3 "2014-05-05T19:01:42Z")

</div>

Hi Michael

Thanks - sorry for not replying. I forgot to set up notifications correctly.

the locales package is installed on the remote node via the task

- name: install the locales package

apt: pkg=locales state=present

and I confirmed that it was present

root@vps01:~# apt-get install locales  
Reading package lists… Done  
Building dependency tree  
Reading state information… Done  
locales is already the newest version.  
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

using /usr/sbin/locale-gen directly works fine so I guess I’ll stick with that for now

I get the error message on ubuntu server 12.04 and 14.04

if I haven’t made any obvious mistakes perhaps I should mention this on github

Thanks

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 6, 2014, 3:53am UTC](https://forum.ansible.com/t/new-module-locale-gen-fails-with-is-the-package-locales-installed/15088/4 "2014-05-06T03:53:00Z")

</div>

The error message may have made some assumptions about the name of the package in a particular distro.

If you’d like to file a ticket in github we can take a look.

[github.com/ansible/ansible](http://github.com/ansible/ansible) – thanks!
