Unable to install python-minimal

181 views
Skip to first unread message

Eric

unread,
Sep 22, 2017, 9:28:07 PM9/22/17
to Ansible Project

I'm running an Ansible playbook to use the raw module, to install python-minimal.

The host is reachable.
The host can be SSH'ed into as root.

However, when running the playbook below, it fails.

It gives the error:

    "module_stdout": "bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)\r\n/bin/sh: 1: /usr/bin/python: not found\r\n",


---
# https://gist.github.com/gwillem/4ba393dceb55e5ae276a87300f6b8e6f
- hosts: all

tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

Eric

unread,
Sep 22, 2017, 10:03:29 PM9/22/17
to Ansible Project
However, it works when run manually:

ansible -i all.yml -m raw -a "apt install -y python-minimal"

Kai Stian Olstad

unread,
Sep 28, 2017, 10:59:04 AM9/28/17
to ansible...@googlegroups.com
On 23. sep. 2017 03:28, Eric wrote:
>
> I'm running an Ansible playbook to use the raw module, to install
> python-minimal.
>
> The host is reachable.
> The host can be SSH'ed into as root.
>
> However, when running the playbook below, it fails.
>
> It gives the error:
>
> "module_stdout": "bash: warning: setlocale: LC_ALL: cannot change
> locale (en_US.UTF-8)\r\n/bin/sh: 1: /usr/bin/python: not found\r\n",

The problem is that you don't provide the whole error message, if you
had you probably would have gotten an answer several days ago.

So without the error message I can only guess, but default Ansible has
gather facts on, so you need to turn it off.


--
Kai Stian Olstad

Mischa ter Smitten

unread,
Sep 29, 2017, 3:33:25 AM9/29/17
to Ansible Project
This is what we use:

---
- hosts: ubuntu-1604
gather_facts: no
pre_tasks:
# Needed because python is not installed
- name: install python (if needed)
raw: test -e /usr/bin/python || (apt update -y && apt install -y python-minimal)
register: _python_minimal
changed_when: _python_minimal.stdout_lines | length > 0

Eric

unread,
Sep 29, 2017, 5:19:16 AM9/29/17
to Ansible Project
gather_facts was what I needed!
Reply all
Reply to author
Forward
0 new messages