I\'m running into an error I\'ve never seen before. Here is the command and the error:
$ ansible-playbook create_api.yml
PLAY [straw] **********************
I found out that it's actually possible to have multiple plays in a single playbook, so my setup now contains a "dependency provisioning" play which runs on all hosts, and other plays for specific hosts. So no more pre_tasks.
For example:
- name: dependency provisioning
hosts: all
become: yes
become_method: sudo
gather_facts: false
tasks:
- name: install python2
raw: sudo apt-get -y install python-simplejson
- name: production
hosts: production_host
roles:
- nginx
tasks:
- name: update apt cache
apt: update_cache=yes cache_valid_time=3600
# ....
- name: staging
hosts: staging_host
roles:
- nginx
tasks:
- name: update apt cache
apt: update_cache=yes cache_valid_time=3600
# ....