-1

I have a Vagrantfile to provision an Ubuntu VM. After I do vagrant up the script will eventually run into the below error. I tried searching for any answer and the best I could find was Ubuntu specific. I am attempting to run this Vagrantfile on Windows 10.

==> dev: Running provisioner: ansible_local...
    dev: Installing Ansible...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!


                add-apt-repository ppa:ansible/ansible -y && apt-get update -y -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq ansible --option "Dpkg::Options::=--force-confold"


Stdout from the command:

Cannot add PPA: 'ppa:~ansible/ubuntu/ansible'.
ERROR: '~ansible' user or team does not exist.


Stderr from the command:

Here is the vagrant file I am trying to run: Vagrantfile

It may be a problem with a self signed company SSL cert. I am not sure how to work around that issue. I have updated the C:\HashiCorp\Vagrant\embedded\cacert.pem with the correct certs. It got further than before but is still failing.

Tim
  • 1,606
  • 2
  • 21
  • 42
  • (a) you have failed to include the **code** that you wrote, in order for anyone to correct it (b) installing ansible into a virtualenv will be a ton less heartache; have you tried that? – mdaniel Jul 17 '20 at 15:56
  • @mdaniel I did not write the code. I was mainly hoping someone had ran into this same error before and could let me know what it meant. Here is the Vagrant file I am trying to run: [Vagrantfile](https://github.com/nasa-itc/deployment/blob/910717025033e453c2ae70e86cf5db80cd57f28f/Vagrantfile) – Tim Jul 21 '20 at 20:58

1 Answers1

0

They're using the ansible_local provisioner, which tries to install on ansible on the guest, defaulting to almost the cited PPA for ubuntu-ish systems. It's entirely possible that the version of Vagrant you are using has a bug, or any number of stray neutron stars causing that to fail.

Thankfully, there's the much more sane :pip install mode, which is should make for less heartache

            nos3.vm.provision "ansible_local" do |ansible|
              ansible.install_mode = "pip"

or, of course, if you're already ansible savvy and have it on your machine, you can change the provisioner to be ansible (not ansible_local) and provision from your machine

mdaniel
  • 31,240
  • 5
  • 55
  • 58
  • I get a new error when I try this. `dev: Installing Ansible... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! apt-get update -y -qq Stdout from the command: Stderr from the command: E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/` – Tim Jul 22 '20 at 18:45
  • You'll need [`ansible.become = true`](https://www.vagrantup.com/docs/provisioning/ansible_common#become) – mdaniel Jul 23 '20 at 04:09
  • I added `ansible.become = true` to the vagrantfile. Unfortunately it still returns the same error and stops the build. – Tim Jul 28 '20 at 00:17