localhost for limited roles while still using hosts:all for the rest

16 views
Skip to first unread message

Daniel Boland

unread,
Mar 17, 2016, 8:10:17 AM3/17/16
to Ansible Project

I have a playbook that will update the local source code for my web project and then it will deploy it to remote servers. 
Everything works when i run it locally on OS X, but when i try to run from the deployment server (aws linux)  I get no matching host errors

I'm a little confused at why it would work locally but not remotely.  This is the  message i get:


PLAY [Get latest Code] *********************************************************

skipping: no hosts matched


Do i need to add localhost to the inventory first, and if so how to i keep it from being included in the 2nd step? 
The biggest puzzle is why it works on the mac but not on linux.  Ansible was installed using pip on both so not sure what could be different on them

Below is the command and code.

Thanks,
Daniel


ansible playbook command:

ansible-playbook -i inventory/dev/ -l ~tag_role_web full-deploy.yml 


ansible playbook


- name: Get latest Code

  gather_facts: no

  hosts: localhost

  vars:

     next_color_name: "{{ lookup('file', './src/nextArchive') }}"

     update_archive: "{{ next_color_name }}-web"

  roles:

  - role: update-code



- name: Deploy web code

  hosts: all

  vars:

     latest_archive: "{{ lookup('file', './src/nextArchive') }}"

  roles:

  - role: deploy-web



Reply all
Reply to author
Forward
0 new messages