bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Ansible produces this error when attempting to collect facts:

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)\nTraceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 87, in _ansiballz_main\n  File \"/usr/lib/python2.7/tempfile.py\", line 331, in mkdtemp\n    dir = gettempdir()\n  File \"/usr/lib/python2.7/tempfile.py\", line 275, in gettempdir\n    tempdir = _get_default_tempdir()\n  File \"/usr/lib/python2.7/tempfile.py\", line 217, in _get_default_tempdir\n    (\"No usable temporary directory found in %s\" % dirlist))\nIOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/root']\n

Supposedly fixable with:

sudo locale-gen en_US
sudo update-locale LANG="C"

This should happen automatically in provision to avoid this error in the future.

Edited by GoMatrixHosting