I have workflow that create 2 virtual machines on GCP. When virtual instance created I store output with external ip to variable. In next playbook i want to use all of my ip addresses in host section. My code is:

- name: Download and install jenkins
   - "{{ node_1_ip }}"
   - "{{ node_2_ip }}"
   - name: Install java
       name: java-1.8.0-openjdk-devel
     become: true

But when I run my playbook i have warning:

[WARNING]: Could not match supplied host pattern, ignoring: is my node_2_ip. How can I apply my playbook to this 2 machines?

1 Answer 1


I suspect you haven't set up the host in your inventory you can figure out where your hosts are being pulled from with the following command:

ansible-config dump | grep HOST

In practice, you probably just need to create an inventory file with the following content:

node01 ansible_host=IP OF YOUR FIRST NODE HERE!!!
node02 ansible_host=

Then specify the -i parameter to ansible-playbook:

ansible-playbook -i inventory -k playbook.yml

Depending on your exact use cases it might be more scalable and maintainable to use GCE Dynamic Inventory, although this does require a little bit of extra setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.