In my playbooks, I need to set the locale, and have the changes go into effect so that in a subsequent play, when postgresql is installed it will use the appropriate locale settings.
However, if I set the locale in one play using ansible, the locale change does not take effect in subsequent plays. I know that when you’re interacting with a traditional ssh session, you need to log out and back in for a locale change to take effect. What can I do to cause the locale setting change to take effect in subsequent plays? Note that I’m using ssh for transport, with default settings.
See https://gist.github.com/4262334 for an example playbook, output, and my ansible.cfg file. Here you can see the issue being reproduced using the “ansible”
$ ansible vagrant -s -m command -a “/usr/sbin/update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8”
vagrant.nimbis.net | success | rc=0 >>
$ ansible vagrant -m command -a locale
vagrant.nimbis.net | success | rc=0 >>
LANG=C
LANGUAGE=
LC_CTYPE=“en_US”
LC_NUMERIC=“en_US”
LC_TIME=“en_US”
LC_COLLATE=“en_US”
LC_MONETARY=“en_US”
LC_MESSAGES=“en_US”
LC_PAPER=“en_US”
LC_NAME=“en_US”
LC_ADDRESS=“en_US”
LC_TELEPHONE=“en_US”
LC_MEASUREMENT=“en_US”
LC_IDENTIFICATION=“en_US”
LC_ALL=en_US
If I connect via ssh, it shows the correct thing
$ ssh vagrant 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
$ ansible --version
ansible 1.0 (devel 637883164e) last updated 2012/12/08 14:06:41 (GMT -400)
Take care,
Lorin