vagrant plugin update

Vagrant is a program which makes it easy to start new Virtual Machines.
I’ve got a Windows machine (for the games and video editing software). But usually code websites which are run on Linux servers.

I usually have 1 or 2 VM’s running on my laptop.

After getting messages from Vagrant every time I started up a VM that a new update was available, I decided to install the latest version (v2.2.5)

It then stopped working and when running the usual vagrant up I got the following:

Vagrant failed to initialize at a very early stage:
The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory. Vagrant can
attempt to automatically correct this issue by running:
vagrant plugin repair
If Vagrant was recently updated, this error may be due to incompatible
versions of dependencies. To fix this problem please remove and re-install
all plugins. Vagrant can attempt to do this automatically by running:
vagrant plugin expunge –reinstall
Or you may want to try updating the installed plugins to their latest
versions:
vagrant plugin update
Error message given during initialization: Unable to resolve dependency: user requested ‘vagrant-hostmanager (= 1.8.9)’

Running a vagrant plugin repair showed a new error.

Unable to resolve dependency: user requested ‘vagrant-vbguest (= 0.18.0)

Running the vagrant plugin expunge –reinstall didn’t help.

The vbguest is a reference to the VirtualBox manager I use and likely the guest plugins which allow for better 2 way communication between my host machine and the guest VMs.

There was no reference to the plugin in my Vagrant file, nor in the vagrant folder. There wasn’t any good Google results (hence why I’m writing this post).

After some playing around I found the command which fixed it:

vagrant plugin update

Running a vagrant plugin update caused it to update to v0.19.0 of the plugin and then everything worked happily.

Hopefully if others have the same issue they can quickly try a vagrant plugin update and see if that fixes their issue.

My ~/.bash_aliases 2017

I have a base ~/.bash_aliases file which I normally use Ansible to update on various servers when needed and thought I’d share it.
This is intended for sys admins using Ubuntu.
The main aliases are :
ll – I use this ALL the time, it’s `ls -aslch` and shows the file listing.
agu – Apt get update, just refreshes the apt files from the net, doesn’t actually install anything but should be run before running any apt programs.
agg – Apt Get Upgrade this updates all the programs that need upgrading. Usually the server needs to be restarted after.
acs – Apt Cache Search. If there’s something to install like the PHP gearman extension I’ll usually use `acs php | grep gearman` to work out the name.
a2r – Apache2 reload.
a2rr – Apache2 restart, for when just reloading the config isn’t enough.
aliasd – Open up the local aliases file. Will apply the changes when you exit nano.
aliasd_base – Open up the main (base) aliases file which contains these aliases. If not using Ansible then I normally load the aliases into a new server by pasting the contents of the file in on the command line, then running aliasd_base and pasting it in again into the file.
chownWWW – Change the file and folder contents to being owned by www-data:www-data DO NOT RUN THIS IN THE ROOT DIRECTORY.
du – Directory usage. A general listing of file and directory sizes.
das – A directory size listing ordered by largest at the top. It’s not amazing but works well enough. I use `ncdu` the program (usually has to be installed with `agi ncdu`) to get better directory listing.
directoryExec – Makes the directories executable by the user and group.
logs – Shows most of the /var/log files, tails them so you can see any changes.
logsudo – Same as logs, but with sudo so you see more of the files.
gac – Git add and git commit. A nice quick way of doing a git commit. I usually do `gac -m “* Commit message here”
gitt – Shows the last 24hrs worth of git commits. Great for putting into a timesheet.
gittt – Shows how long ago the commits were, I mainly use this when trying to work out which commits are from today vs yesterday.
ssh-config – Edit the main ssh config file.
diglookup – Does a quick check of the A records, MX, TXT and other stuff for a domain, useful when someone says that there’s an issue with the site. example usage `diglookup kublermdk.com`
Note that the attempt to do a reverse lookup on the IP usually fails if there’s multiple A records for the main site, so you sometimes have to [ctrl] + [c] cancel out of that bit at the end. I’ll fix it one day :P
$ diglookup kublermdk.com
=====================
=== kublermdk.com ===
=====================
Wed Jan 18 11:36:58 ACDT 2017
--- dig kublermdk.com
139.162.46.66

--- dig www.kublermdk.com
kublermdk.com.
139.162.46.66

--- dig kublermdk.com mx
20 aspmx2.googlemail.com.
30 aspmx4.googlemail.com.
30 aspmx3.googlemail.com.
40 aspmx5.googlemail.com.
10 aspmx.l.google.com.
20 alt1.aspmx.l.google.com.

--- dig kublermdk.com txt
"i=221&m=domains-mx2-p11"
"keybase-site-verification=XREU5_ZiKnxXnNBV2L5Jcmn1tfUvL371DsulTNs7s9I"
"google-site-verification=m1fr_lDxzFtXawjhPXV56vbyOzKdw0SyTa1zCrdbArU"

--- dig mail.kublermdk.com
ghs.google.com.
ghs.l.google.com.
172.217.25.179

--- whois kublermdk.com

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

 Domain Name: KUBLERMDK.COM
 Registrar: NETREGISTRY PTY. LTD.
 Sponsoring Registrar IANA ID: 677
 Whois Server: whois.netregistry.net
 Referral URL: http://www.netregistry.com.au
 Name Server: NS0.DNSMADEEASY.COM
 Name Server: NS1.DNSMADEEASY.COM
 Name Server: NS2.DNSMADEEASY.COM
 Name Server: NS3.DNSMADEEASY.COM
 Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
 Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
 Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
 Updated Date: 29-oct-2014
 Creation Date: 06-jul-2007
 Expiration Date: 06-jul-2017

>>> Last update of whois database: Wed, 18 Jan 2017 01:06:49 GMT <<<

For more information on Whois status codes, please visit https://icann.org/epp

[...]

--- Web server's reverse IP 'nslookup 139.162.46.66'

li1459-66.members.linode.com.

Server: 10.0.2.3
Address: 10.0.2.3#53

Non-authoritative answer:
66.46.162.139.in-addr.arpa name = li1459-66.members.linode.com.

Authoritative answers can be found from:

---======---
I then have a ~/.bash_aliases_local file that has server specific changes. e.g kublermdk-logs which will show the logs specific for my site, esp if it’s something like a Symfony project where a lot of the useful log files are stored in something specific. I’d have
alias kublermdk-logs='tail -f /var/logs/apache2/kublermdk/*.log /var/www/kublermdk/www/app/logs/*.log'
Grab what you want, let me know if you’ve got any good aliases yourself.
Cheers!

Initial Ansible Install on Ubuntu

Because I have to run this on any new Ansible or Vagrant machine, here’s a note to myself to make this a little faster.

For Ubuntu Linux machines

sudo apt-get --assume-yes install nano man git python # For a new, minimal install of Ubuntu, e.g a Vagrant Box, they don't even include a ~/.bashrc file nor nano or man, this can help. Also, Ansible needs python (version 2 not 3) to run.
sudo apt-get --assume-yes install software-properties-common
sudo apt-add-repository --yes ppa:ansible/ansible
sudo apt-get --assume-yes update
sudo apt-get --assume-yes install ansible

 

Also ensure the hostname is something you want. Here’s a 1 liner I use, just set the hostname to something you want :
NEW_HOSTNAME='vagrant.servers.example.com'; echo ${NEW_HOSTNAME} > /etc/hostname; echo "127.0.0.1 ${NEW_HOSTNAME}" >> /etc/hosts; hostname ${NEW_HOSTNAME};

# Don’t forget to copy over the ~/.ssh/config and ~/.ssh/*.pem files across, although you probably have an Ansible task for that.

 

Hopefully you are hosting your Ansible playbooks and other files in a git repo, so you should be able to clone that and start using it.

Once you’ve setup your /etc/ansible/hosts file (I usually copy mine from my Git repo) you can try ssh’ing into all the servers. You’ll want to ensure you have run ssh-copy-id and logged in if you usually connect to the machine via a password, or have the vars for the pem file(s) set, especially if connecting to an AWS machine via ssh keyfile.

After that you’ll likely want to run the command below which will automatically say ‘yes’ to all the requests to add the server’s SSH key. This assumes your flavour of Linux has the ‘yes‘ command.

yes yes | ansible all -m ping