ansible-pull playing playbook on remote host : how to point to the localhost in inventory? (Could not match supplied host pattern)

Viewed 23

Im trying to use ansible-pull locally on a remote host where ansible retrieve a playbook on a git repo with an inventory.

I dont know how to point to the remote host in the inventory and in group vars. I have tried with the machine_name (user@machine_name in bash) but it tells me

[WARNING]: Could not match supplied host pattern, ignoring:

this is my inventory :

all:
  children:
    webserver:
      hosts:
        ip-172-31-21-218: #this is the machine name
    dbserver:
      hosts:
        node2:
          ansible_host: 34.201.53.127

I want the playbook to use the host machine to play the playbook locally with ansible pull but using the inventory to understand the inventory machine name matches the host machine name...

1 Answers

this is sample from official documentation and keep reading the comments :)

all:
  hosts:                        # you ignore this line
    mail.example.com:           # and this line also
  children:
    webservers:
      hosts:
        foo.example.com:
        bar.example.com:
    dbservers:
      hosts:
        one.example.com:
        two.example.com:
        three.example.com:

Regards.

Related