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

**URL:** <https://forum.ansible.com/t/localhost-for-limited-roles-while-still-using-hosts-all-for-the-rest/20890>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 16, 2016, 4:39pm UTC](https://forum.ansible.com/t/localhost-for-limited-roles-while-still-using-hosts-all-for-the-rest/20890 "2016-03-16T16:39:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Boland](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Daniel\_Boland](https://forum.ansible.com/u/Daniel_Boland)\
**Post date:** [March 16, 2016, 4:39pm UTC](https://forum.ansible.com/t/localhost-for-limited-roles-while-still-using-hosts-all-for-the-rest/20890/1 "2016-03-16T16:39:34Z")

</div>

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
