ERROR: provided hosts list is empty

Hello, I’m trying out the example project on a Windows 7 + VMWare box. Upon running vagrant up it ends with the error “provided hosts list is empty”

==> default: Sorry, version: 1.0.5 was not found on galaxy.ansible.com.
==> default: Running Ansible Playbooks
==> default: ERROR: provided hosts list is empty
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Should something be populating the hosts/inventory file? Or is there a different debugging path I should take to figure this out?

If I add the contents of trellis/hosts/development to /etc/ansible/hosts I then get the error of ERROR: become is not a legal parameter in an Ansible Playbook

Here is some output of /etc/ansible/hosts (before modification), my vagrant up, my ifconfig, and my attempt running windows.sh in the vm

This might be a connection issue because version 1.0.5 of the MailHog role does exist on Galaxy: https://galaxy.ansible.com/geerlingguy/mailhog/

Did you try it again?

Yes, tried again with same results. However, while running the command directly and getting the same errors I then found this issue after searching which mentions this is likely a failure of the ansible version not recognizing the yml.

vagrant@roots-example-project:/vagrant$ ansible-galaxy install -r /vagrant/requirements.yml -p /vagrant/vendor/roles
 downloading role '-%20name%3A%20composer', owned by
Sorry, - name: composer was not found on galaxy.ansible.com.
 downloading role 'composer', owned by src%3A%20geerlingguy
Sorry, src: geerlingguy.composer was not found on galaxy.ansible.com.
 downloading role '7', owned by version%3A%201.2
Sorry, version: 1.2.7 was not found on galaxy.ansible.com.
 downloading role '-%20name%3A%20ntp', owned by
Sorry, - name: ntp was not found on galaxy.ansible.com.
 downloading role 'ntp', owned by src%3A%20resmo
Sorry, src: resmo.ntp was not found on galaxy.ansible.com.
 downloading role '0', owned by version%3A%200.3
Sorry, version: 0.3.0 was not found on galaxy.ansible.com.
 downloading role '-%20name%3A%20logrotate', owned by
Sorry, - name: logrotate was not found on galaxy.ansible.com.
 downloading role 'logrotate', owned by src%3A%20nickhammond
Sorry, src: nickhammond.logrotate was not found on galaxy.ansible.com.
 downloading role 'version%3A%20fc3ea4', owned by
Sorry, version: fc3ea4 was not found on galaxy.ansible.com.
 downloading role '-%20name%3A%20swapfile', owned by
Sorry, - name: swapfile was not found on galaxy.ansible.com.
 downloading role 'swapfile', owned by src%3A%20kamaln7
Sorry, src: kamaln7.swapfile was not found on galaxy.ansible.com.
 downloading role '4', owned by version%3A%200
Sorry, version: 0.4 was not found on galaxy.ansible.com.
 downloading role '-%20name%3A%20mailhog', owned by
Sorry, - name: mailhog was not found on galaxy.ansible.com.
 downloading role 'mailhog', owned by src%3A%20geerlingguy
Sorry, src: geerlingguy.mailhog was not found on galaxy.ansible.com.
 downloading role '5', owned by version%3A%201.0
Sorry, version: 1.0.5 was not found on galaxy.ansible.com.

vagrant@roots-example-project:/vagrant$ ansible --version
ansible 1.5.4
vagrant@roots-example-project:/vagrant$ 

So my version was not the latest for some reason. Looking back at my vagrant up gist I see where it failed

==> default: Adding add-apt-repository...
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: The following extra packages will be installed:
==> default:   python3-pycurl python3-software-properties unattended-upgrades
==> default: Suggested packages:
==> default:   libcurl4-gnutls-dev python3-pycurl-dbg bsd-mailx mail-transport-agent
==> default: The following NEW packages will be installed:
==> default:   python3-pycurl python3-software-properties software-properties-common
==> default:   unattended-upgrades
==> default: 0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
==> default: Need to get 102 kB of archives.
==> default: After this operation, 800 kB of additional disk space will be used.
==> default: Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main python3-pycurl amd64 7.19.3-0ubuntu3 [47.5 kB]
==> default: Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main unattended-upgrades all 0.82.1ubuntu2.3 [25.5 kB]
==> default: Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main python3-software-properties all 0.92.37.3
==> default:   404  Not Found [IP: 91.189.91.14 80]
==> default: Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main software-properties-common all 0.92.37.3
==> default:   404  Not Found [IP: 91.189.91.14 80]
==> default: Fetched 73.0 kB in 0s (129 kB/s)
==> default: E
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/software-properties/python3-software-properties_0.92.37.3_all.deb  404  Not Found [IP: 91.189.91.14 80]
==> default: E
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/software-properties/software-properties-common_0.92.37.3_all.deb  404  Not Found [IP: 91.189.91.14 80]
==> default: E
==> default: :
==> default: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Which lead to Ansible not being upgraded

==> default: Adding Ansible repository...
==> default: sudo: apt-add-repository: command not found
==> default: Updating system...

Odd that apt-add-repository was available when I ran through those steps manually. I don’t see software-properties-common anywhere besides windows.sh

I’m now trying to figure out why that part failed.

1 Like

After a couple of vagrant destroy's and starting over it looks like the windows.sh file needs a line with sudo apt-get update prior to installing software-properties-common:

# Check that add-apt-repository is installed for non-standard Vagrant boxes
if [ ! -f /usr/bin/add-apt-repository ]; then
  sudo apt-get update
  echo "Adding add-apt-repository..."
  sudo apt-get -y install software-properties-common
fi

To answer my question earlier as to why apt-add-repository worked it looks like that was also installed via main.yml with python-software-properties

From this SO question apt-add-repository is provided directly via software-properties-common and installing python-software-properties first will grab software-properties-common as a dependency

vagrant@roots-example-project:/vagrant$ dpkg -S add-apt-repository
software-properties-common: /usr/bin/add-apt-repository
software-properties-common: /usr/share/man/man1/add-apt-repository.1.gz
1 Like

Awesome debugging, thanks!

So should we be adding anything to windows.sh by default? If so, could you either open a PR or Issue on our repo please?

NP, PR sent. I originally added that block in a different PR for my VMWare setup… perhaps I just didn’t vagrant destroy test it enough the first time or maybe it’s been so long since the upgrade to 2.0?

My free time has been on/off again for learning wordpress that I’m thinking it was the latter, hopefully I can stay in the saddle a bit longer this time through :slightly_smiling:

2 Likes