*gather_facts* was what I needed! On Friday, September 29, 2017 at 3:33:25 AM UTC-4, Mischa ter Smitten wrote: > > 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 > > > On Saturday, September 23, 2017 at 3:28:07 AM UTC+2, 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", >> >> >> --- >> # 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) >> >> >>
-- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c8c0bc59-cb4d-43da-b27b-58d375bb69ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
