I'm trying to get some very basic things working with Ansible 126.96.36.199 on OS X.
My targets are all Ubuntu 16.04, so the very first thing I have to do is get it to install python2.7, as without that even 'ping' won't work.
I have an inventory set up like this in
[dbservers] 192.168.x.x set_hostname=db [webservers] [servers:children] dbservers webservers
And this is my play in
--- - hosts: servers gather_facts: False become: yes tasks: - name: apt-get update raw: /usr/bin/apt-get update -qq - name: Install python 2.7 raw: test -e /usr/bin/python || /usr/bin/apt-get install -q -y python2.7 python-simplejson
I check that it's selecting the right hosts by specifying the
dbservers group, which is a subset of
servers (there is only 1 anyway), which looks right to me:
# ansible dbservers -i servers --list-hosts hosts (1): 192.168.x.x
The command I'm running is this:
# ansible dbservers -i servers init.yml
and that's when I get the error
ERROR! Missing target hosts. I don't understand how it can have hosts and no hosts at the same time! What am I doing wrong?