On Friday, December 6, 2019 at 2:21:06 PM UTC-5, Christian Del Pino wrote: > > > 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. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b1575cb1-6a8c-473d-b18e-6971484ff853%40googlegroups.com.
