# Issue trying to parse tag

**URL:** <https://forum.ansible.com/t/issue-trying-to-parse-tag/31782>\
**Category:** Ansible Project\
**Tags:** ubuntu, aws, kubernetes\
**Created:** [December 6, 2019, 7:21pm UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782 "2019-12-06T19:21:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Del\_Pino1](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Christian\_Del\_Pino1](https://forum.ansible.com/u/Christian_Del_Pino1)\
**Post date:** [December 6, 2019, 7:21pm UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782/1 "2019-12-06T19:21:05Z")

</div>

Hi,

I am currently trying to connect to a newly created ec2 instance via a tag that I created, but I am getting an error during the run:

setting up inventory plugins  
host\_list declined parsing /Users/christiandelpino/stash-infra-shared/modules/aws/k8s/k8s-ansible/hosts/hosts as it did not pass its verify\_file() method  
script declined parsing /Users/christiandelpino/stash-infra-shared/modules/aws/k8s/k8s-ansible/hosts/hosts as it did not pass its verify\_file() method  
auto declined parsing /Users/christiandelpino/stash-infra-shared/modules/aws/k8s/k8s-ansible/hosts/hosts as it did not pass its verify\_file() method  
Set default localhost to localhost  
Parsed /Users/christiandelpino/stash-infra-shared/modules/aws/k8s/k8s-ansible/hosts/hosts inventory source with ini plugin  
META: inventory successfully refreshed  
META: ran handlers  
META: ran handlers

PLAY [Init] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: no hosts matched

The tag I am trying to connect to is init. My deploy task looks like this:

- name: Build out AWS Infrastructure  
hosts: localhost  
connection: local  
gather\_facts: False  
roles:

- role: aws

- name: Refresh Inventory  
hosts: localhost  
connection: local  
gather\_facts: False  
tasks:

- name: Refresh ec2 cache  
command: hosts/ec2.py --refresh-cache

- name: Refresh in-memory EC2 cache  
meta: refresh\_inventory

- name: Init  
hosts: tag\_type\_init  
gather\_facts: false  
remote\_user: ubuntu  
roles:

- role: init

When running verbose, I do see tag\_type\_init with the IP:

" "tag\_type\_init": [“,  
" "3.17.77.3"”,  
" ],",

This is the exact ansible command being run:

ansible-playbook --private-key …/…/…/…/…/Downloads/XXXXXX.pem deploy.yaml --inventory=hosts/hosts

I can provide further info if needed.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![flowerysong1](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@flowerysong1](https://forum.ansible.com/u/flowerysong1)\
**Post date:** [December 7, 2019, 1:22am UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782/2 "2019-12-07T01:22:43Z")

</div>

> I am currently trying to connect to a newly created ec2 instance via a tag that I created, but I am getting an error during the run:
> 
> setting up inventory plugins  
> Parsed /Users/christiandelpino/stash-infra-shared/modules/aws/k8s/k8s-ansible/hosts/hosts inventory source with ini plugin
> 
> META: inventory successfully refreshed  
> META: ran handlers  
> META: ran handlers
> 
> PLAY [Init] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> skipping: no hosts matched
> 
> The tag I am trying to connect to is init. My deploy task looks like this:
> 
> - name: Build out AWS Infrastructure  
> hosts: localhost  
> connection: local  
> gather\_facts: False  
> roles:
> 
> - role: aws
> 
> - name: Refresh Inventory  
> hosts: localhost  
> connection: local  
> gather\_facts: False  
> tasks:
> 
> - name: Refresh ec2 cache  
> command: hosts/ec2.py --refresh-cache
> 
> - name: Refresh in-memory EC2 cache  
> meta: refresh\_inventory

Here, you’re referencing hosts/ec2.py

> This is the exact ansible command being run:
> 
> ansible-playbook --private-key …/…/…/…/…/Downloads/XXXXXX.pem deploy.yaml --inventory=hosts/hosts

But here, you’re only using hosts/hosts. refresh\_inventory is not going to magically load inventories that aren’t in use, so (as the playbook output shows) you’re only getting the static hosts in hosts/hosts.

---

<div class="post-metadata">

**Author:** ![Christian\_Del\_Pino1](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Christian\_Del\_Pino1](https://forum.ansible.com/u/Christian_Del_Pino1)\
**Post date:** [December 9, 2019, 6:16am UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782/3 "2019-12-09T06:16:56Z")

</div>

So what is the best way to get the details of a new instance using tags, or is another method recommended?

Thanks.

---

<div class="post-metadata">

**Author:** ![flowerysong1](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@flowerysong1](https://forum.ansible.com/u/flowerysong1)\
**Post date:** [December 9, 2019, 7:04am UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782/4 "2019-12-09T07:04:40Z")

</div>

…use the correct set of inventories with your playbook?

---

<div class="post-metadata">

**Author:** ![Christian\_Del\_Pino1](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Christian\_Del\_Pino1](https://forum.ansible.com/u/Christian_Del_Pino1)\
**Post date:** [December 9, 2019, 10:25pm UTC](https://forum.ansible.com/t/issue-trying-to-parse-tag/31782/5 "2019-12-09T22:25:05Z")

</div>

Thanks, but I’ll abandon this idea and go for:

[https://docs.ansible.com/ansible/latest/plugins/inventory/aws\_ec2.html](https://docs.ansible.com/ansible/latest/plugins/inventory/aws_ec2.html)

since Ansible has been promoting the inventory plugin ecosystem.

Investment advisory services are offered by Stash Investments LLC, a federally-registered investment adviser.

Stash’s outgoing and incoming emails are electronically archived and subject to review and/or disclosure to someone other than the recipient. We cannot accept requests for securities transactions or other similar instructions through email. This communication is not an offer or solicitation to buy or sell any financial product(s). We cannot ensure the security of information emailed over the Internet, so you should be careful when transmitting confidential information such as account numbers and security holdings. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to this message and deleting it from your computer.
