No Hosts Matched

Steps I took:

  1. New DO Server
  2. Installed lemp stack using Bedrock Ansible.
  3. Cloned Bedrock project, setup vagrant
  4. Setup ip address in group_vars/production and hosts/production.

I ran deploy.sh and got skipping: no hosts matched

1 Like

Please provide the exact command you ran.

Also try running the manual ansible-playbook command outside of deploy.sh.

ansible-playbook -i hosts/production deploy.yml --extra-vars="site=vacation.brandonshutter.com"

Same error.

wordpress_sites:
  vacation.brandonshutter.com:
    site_hosts:
      - vacation.brandonshutter.com
      - 104.236.225.221
    local_path: '../vacation.dev' # path targeting local Bedrock project directory (relative to Ansible root)
    repo: git@bitbucket.org:brandonshutter/vacation-playces.git
    system_cron: true
    multisite:
      enabled: false
      subdomains: false
    ssl:
     enabled: false
    system_cron: true
    env:
      wp_home: http://vacation.brandonshutter.com
      wp_siteurl: http:vacation.brandonshutter.com/wp

@brandon Could you also post your host/production? Also post the full error message when you run with -vvvv. I’m wondering if it shows what host it tried to connect to, etc.

[web]
104.236.225.221

[production:children]
web



ansible-playbook -i hosts/production deploy.yml --extra-vars="site=vacation.brandonshutter.com" -vvvv

PLAY [Deploy WP site] ********************************************************* 
skipping: no hosts matched

PLAY RECAP ********************************************************************

What command did you use for provisioning the droplet initially? Assuming you used server.yml, I’m stumped as to how/why running server.yml would match a host but running deploy.yml would not match a host.

You can also run this to test inventory: ansible -i hosts/production --list-hosts all

3 Likes

This gave me: 104.236.225.221

1 Like

I used ansible-playbook -i hosts/production server.yml followed by ansible-playbook -i hosts/production secure-root.yml

And if you re-run ansible-playbook -i hosts/production server.yml --ask-sudo-pass -vvvv it does match a host?

(Now that you’ve run secure-root.yml, your server.yml will need sudo: Yes and remote_user: admin)

And I’m assuming you haven’t edited the hosts: web from deploy.yml (example).

And sorry to keep throwing random things out there, but have you tried completely rebuilding this remote server from scratch? If/when you try it, run secure-root.yml first, before server.yml. That’s been the more common sequence, but I doubt it should matter.

This allows me to run the command correctly. I tried rebuilding, running into the exact same issue. I haven’t edited the hosts in deploy.yml

I don’t pretend I’ve got a ton of experience, but this issue seems pretty unique, so my guess is that you’ve got some custom config that’s responsible. I’d probably start retracing steps, changing stuff back to defaults, testing along the way, trying to isolate any problematic customizations.

Maybe the first step could be testing a vanilla bedrock-ansible clone, to rule out potential issues with your environment. Good luck!

Thank you for your assistance though!