I stumbled upon this error running ansible on Ubuntu 15.10 server, because it ships with Python 3.4.3 and ansible requires Python 2.
This is how my provision.yml
looks now:
- hosts: my_app
sudo: yes
remote_user: root
gather_facts: no
pre_tasks:
- name: 'install python2'
raw: sudo apt-get -y install python
tasks:
- name: 'ensure user {{ project_name }} exists'
user: name={{ project_name }} state=present
-
Don’t forget the -y (says yes to all questions) option with apt-get (or raw module will get stuck silently)
-
gather_facts: no
line is also critical (because we can’t gather facts without python)