Skip to content

Instantly share code, notes, and snippets.

@piroux
Last active June 6, 2018 10:33
Show Gist options
  • Save piroux/e3e8215c13f510bd1d7e56fdbb07e307 to your computer and use it in GitHub Desktop.
Save piroux/e3e8215c13f510bd1d7e56fdbb07e307 to your computer and use it in GitHub Desktop.
Bringing machine 'qdbi-ansible-01' up with 'virtualbox' provider...
Bringing machine 'qdbi-ansible-02' up with 'virtualbox' provider...
==> qdbi-ansible-01: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
qdbi-ansible-01: Box Provider: virtualbox
qdbi-ansible-01: Box Version: >= 0
==> qdbi-ansible-01: Loading metadata for box 'ubuntu/trusty64'
qdbi-ansible-01: URL: https://vagrantcloud.com/ubuntu/trusty64
==> qdbi-ansible-01: Adding box 'ubuntu/trusty64' (v20180604.0.0) for provider: virtualbox
qdbi-ansible-01: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20180604.0.0/providers/virtualbox.box
 qdbi-ansible-01: Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)
 qdbi-ansible-01: Download redirected to host: cloud-images.ubuntu.com
 qdbi-ansible-01: Progress: 100% (Rate: 358/s, Estimated time remaining: --:--:--)
 qdbi-ansible-01: Progress: 0% (Rate: 2169k/s, Estimated time remaining: 0:03:21)
 qdbi-ansible-01: Progress: 4% (Rate: 15.7M/s, Estimated time remaining: 0:00:45)
 qdbi-ansible-01: Progress: 9% (Rate: 18.2M/s, Estimated time remaining: 0:00:30)
 qdbi-ansible-01: Progress: 14% (Rate: 19.3M/s, Estimated time remaining: 0:00:24)
 qdbi-ansible-01: Progress: 19% (Rate: 20.3M/s, Estimated time remaining: 0:00:21)
 qdbi-ansible-01: Progress: 24% (Rate: 20.2M/s, Estimated time remaining: 0:00:19)
 qdbi-ansible-01: Progress: 28% (Rate: 20.8M/s, Estimated time remaining: 0:00:18)
 qdbi-ansible-01: Progress: 33% (Rate: 20.5M/s, Estimated time remaining: 0:00:16)
 qdbi-ansible-01: Progress: 37% (Rate: 20.1M/s, Estimated time remaining: 0:00:15)
 qdbi-ansible-01: Progress: 41% (Rate: 18.8M/s, Estimated time remaining: 0:00:14)
 qdbi-ansible-01: Progress: 46% (Rate: 18.8M/s, Estimated time remaining: 0:00:13)
 qdbi-ansible-01: Progress: 50% (Rate: 19.0M/s, Estimated time remaining: 0:00:12)
 qdbi-ansible-01: Progress: 55% (Rate: 19.1M/s, Estimated time remaining: 0:00:11)
 qdbi-ansible-01: Progress: 60% (Rate: 19.3M/s, Estimated time remaining: 0:00:10)
 qdbi-ansible-01: Progress: 65% (Rate: 20.1M/s, Estimated time remaining: 0:00:08)
 qdbi-ansible-01: Progress: 70% (Rate: 20.5M/s, Estimated time remaining: 0:00:07)
 qdbi-ansible-01: Progress: 75% (Rate: 21.3M/s, Estimated time remaining: 0:00:06)
 qdbi-ansible-01: Progress: 81% (Rate: 22.2M/s, Estimated time remaining: 0:00:04)
 qdbi-ansible-01: Progress: 88% (Rate: 23.7M/s, Estimated time remaining: 0:00:03)
 qdbi-ansible-01: Progress: 95% (Rate: 25.3M/s, Estimated time remaining: 0:00:01)
==> qdbi-ansible-01: Successfully added box 'ubuntu/trusty64' (v20180604.0.0) for 'virtualbox'!
==> qdbi-ansible-01: Importing base box 'ubuntu/trusty64'...
Progress: 30%
Progress: 90%
==> qdbi-ansible-01: Matching MAC address for NAT networking...
==> qdbi-ansible-01: Setting the name of the VM: qdbi-ansible-01
==> qdbi-ansible-01: Clearing any previously set forwarded ports...
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> qdbi-ansible-01: Clearing any previously set network interfaces...
==> qdbi-ansible-01: Preparing network interfaces based on configuration...
qdbi-ansible-01: Adapter 1: nat
qdbi-ansible-01: Adapter 2: hostonly
==> qdbi-ansible-01: Forwarding ports...
qdbi-ansible-01: 22 (guest) => 2222 (host) (adapter 1)
==> qdbi-ansible-01: Running 'pre-boot' VM customizations...
==> qdbi-ansible-01: Booting VM...
==> qdbi-ansible-01: Waiting for machine to boot. This may take a few minutes...
qdbi-ansible-01: SSH address: 127.0.0.1:2222
qdbi-ansible-01: SSH username: vagrant
qdbi-ansible-01: SSH auth method: private key
qdbi-ansible-01: Warning: Connection reset. Retrying...
qdbi-ansible-01: Warning: Connection reset. Retrying...
qdbi-ansible-01: Warning: Connection reset. Retrying...
qdbi-ansible-01: Warning: Connection reset. Retrying...
qdbi-ansible-01:
qdbi-ansible-01: Vagrant insecure key detected. Vagrant will automatically replace
qdbi-ansible-01: this with a newly generated keypair for better security.
qdbi-ansible-01:
qdbi-ansible-01: Inserting generated public key within guest...
qdbi-ansible-01: Removing insecure key from the guest if it's present...
qdbi-ansible-01: Key inserted! Disconnecting and reconnecting using new SSH key...
==> qdbi-ansible-01: Machine booted and ready!
==> qdbi-ansible-01: Checking for guest additions in VM...
qdbi-ansible-01: The guest additions on this VM do not match the installed version of
qdbi-ansible-01: VirtualBox! In most cases this is fine, but in rare cases it can
qdbi-ansible-01: prevent things such as shared folders from working properly. If you see
qdbi-ansible-01: shared folder errors, please make sure the guest additions within the
qdbi-ansible-01: virtual machine match the version of VirtualBox you have installed on
qdbi-ansible-01: your host and reload your VM.
qdbi-ansible-01:
qdbi-ansible-01: Guest Additions Version: 4.3.36
qdbi-ansible-01: VirtualBox Version: 5.2
==> qdbi-ansible-01: Setting hostname...
==> qdbi-ansible-01: Configuring and enabling network interfaces...
==> qdbi-ansible-01: Mounting shared folders...
qdbi-ansible-01: /vagrant => /home/piroux/project_first_week/qucit-slave-ansible
==> qdbi-ansible-01: Running provisioner: shell...
qdbi-ansible-01: Running: inline script
qdbi-ansible-01: ssh stop/waiting
qdbi-ansible-01: ssh start/running, process 2317
==> qdbi-ansible-01: Running provisioner: file...
==> qdbi-ansible-01: Running provisioner: shell...
qdbi-ansible-01: Running: inline script
qdbi-ansible-01: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
==> qdbi-ansible-01: Running provisioner: shell...
qdbi-ansible-01: Running: inline script
qdbi-ansible-01: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
qdbi-ansible-01: link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
qdbi-ansible-01: inet 127.0.0.1/8 scope host lo
qdbi-ansible-01: valid_lft forever preferred_lft forever
qdbi-ansible-01: inet6 ::1/128 scope host
qdbi-ansible-01: valid_lft forever preferred_lft forever
qdbi-ansible-01: 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
qdbi-ansible-01: link/ether 08:00:27:fc:de:2b brd ff:ff:ff:ff:ff:ff
qdbi-ansible-01: inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
qdbi-ansible-01: valid_lft forever preferred_lft forever
qdbi-ansible-01: inet 192.168.44.10/24 brd 192.168.44.255 scope global eth0
qdbi-ansible-01: valid_lft forever preferred_lft forever
qdbi-ansible-01: inet6 fe80::a00:27ff:fefc:de2b/64 scope link
qdbi-ansible-01: valid_lft forever preferred_lft forever
qdbi-ansible-01: 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
qdbi-ansible-01: link/ether 08:00:27:18:d6:64 brd ff:ff:ff:ff:ff:ff
qdbi-ansible-01: inet6 fe80::a00:27ff:fe18:d664/64 scope link
qdbi-ansible-01: valid_lft forever preferred_lft forever
==> qdbi-ansible-02: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
qdbi-ansible-02: Box Provider: virtualbox
qdbi-ansible-02: Box Version: >= 0
==> qdbi-ansible-02: Loading metadata for box 'ubuntu/trusty64'
qdbi-ansible-02: URL: https://vagrantcloud.com/ubuntu/trusty64
==> qdbi-ansible-02: Adding box 'ubuntu/trusty64' (v20180604.0.0) for provider: virtualbox
==> qdbi-ansible-02: Importing base box 'ubuntu/trusty64'...
Progress: 90%
==> qdbi-ansible-02: Matching MAC address for NAT networking...
==> qdbi-ansible-02: Setting the name of the VM: qdbi-ansible-02
==> qdbi-ansible-02: Clearing any previously set forwarded ports...
==> qdbi-ansible-02: Fixed port collision for 22 => 2222. Now on port 2200.
==> qdbi-ansible-02: Clearing any previously set network interfaces...
==> qdbi-ansible-02: Preparing network interfaces based on configuration...
qdbi-ansible-02: Adapter 1: nat
qdbi-ansible-02: Adapter 2: hostonly
==> qdbi-ansible-02: Forwarding ports...
qdbi-ansible-02: 22 (guest) => 2200 (host) (adapter 1)
==> qdbi-ansible-02: Running 'pre-boot' VM customizations...
==> qdbi-ansible-02: Booting VM...
==> qdbi-ansible-02: Waiting for machine to boot. This may take a few minutes...
qdbi-ansible-02: SSH address: 127.0.0.1:2200
qdbi-ansible-02: SSH username: vagrant
qdbi-ansible-02: SSH auth method: private key
qdbi-ansible-02: Warning: Connection reset. Retrying...
qdbi-ansible-02: Warning: Connection reset. Retrying...
qdbi-ansible-02: Warning: Connection reset. Retrying...
qdbi-ansible-02: Warning: Remote connection disconnect. Retrying...
qdbi-ansible-02: Warning: Connection reset. Retrying...
qdbi-ansible-02:
qdbi-ansible-02: Vagrant insecure key detected. Vagrant will automatically replace
qdbi-ansible-02: this with a newly generated keypair for better security.
qdbi-ansible-02:
qdbi-ansible-02: Inserting generated public key within guest...
qdbi-ansible-02: Removing insecure key from the guest if it's present...
qdbi-ansible-02: Key inserted! Disconnecting and reconnecting using new SSH key...
==> qdbi-ansible-02: Machine booted and ready!
==> qdbi-ansible-02: Checking for guest additions in VM...
qdbi-ansible-02: The guest additions on this VM do not match the installed version of
qdbi-ansible-02: VirtualBox! In most cases this is fine, but in rare cases it can
qdbi-ansible-02: prevent things such as shared folders from working properly. If you see
qdbi-ansible-02: shared folder errors, please make sure the guest additions within the
qdbi-ansible-02: virtual machine match the version of VirtualBox you have installed on
qdbi-ansible-02: your host and reload your VM.
qdbi-ansible-02:
qdbi-ansible-02: Guest Additions Version: 4.3.36
qdbi-ansible-02: VirtualBox Version: 5.2
==> qdbi-ansible-02: Setting hostname...
==> qdbi-ansible-02: Configuring and enabling network interfaces...
==> qdbi-ansible-02: Mounting shared folders...
qdbi-ansible-02: /vagrant => /home/piroux/project_first_week/qucit-slave-ansible
==> qdbi-ansible-02: Running provisioner: shell...
qdbi-ansible-02: Running: inline script
qdbi-ansible-02: ssh stop/waiting
qdbi-ansible-02: ssh start/running, process 2025
==> qdbi-ansible-02: Running provisioner: file...
==> qdbi-ansible-02: Running provisioner: shell...
qdbi-ansible-02: Running: inline script
==> qdbi-ansible-02: Running provisioner: shell...
qdbi-ansible-02: Running: inline script
qdbi-ansible-02: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
qdbi-ansible-02: link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
qdbi-ansible-02: inet 127.0.0.1/8 scope host lo
qdbi-ansible-02: valid_lft forever preferred_lft forever
qdbi-ansible-02: inet6 ::1/128 scope host
qdbi-ansible-02: valid_lft forever preferred_lft forever
qdbi-ansible-02: 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
qdbi-ansible-02: link/ether 08:00:27:fc:de:2b brd ff:ff:ff:ff:ff:ff
qdbi-ansible-02: inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
qdbi-ansible-02: valid_lft forever preferred_lft forever
qdbi-ansible-02: inet6 fe80::a00:27ff:fefc:de2b/64 scope link
qdbi-ansible-02: valid_lft forever preferred_lft forever
qdbi-ansible-02: 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
qdbi-ansible-02: link/ether 08:00:27:6f:ed:a9 brd ff:ff:ff:ff:ff:ff
qdbi-ansible-02: inet 192.168.44.20/24 brd 192.168.44.255 scope global eth1
qdbi-ansible-02: valid_lft forever preferred_lft forever
==> qdbi-ansible-01: Machine 'qdbi-ansible-01' has a post `vagrant up` message. This is a message
==> qdbi-ansible-01: from the creator of the Vagrantfile, and not from Vagrant itself:
==> qdbi-ansible-01:
==> qdbi-ansible-01: [VM 01] Ready for deployment
==> qdbi-ansible-02: Machine 'qdbi-ansible-02' has a post `vagrant up` message. This is a message
==> qdbi-ansible-02: from the creator of the Vagrantfile, and not from Vagrant itself:
==> qdbi-ansible-02:
==> qdbi-ansible-02: [VM 02] Ready for deployment
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 et :
ENV["LANG"] = "en_US.UTF-8"
ENV["LC_ALL"] = "en_US.UTF-8"
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
system("
if [ #{ARGV[0]} = 'destroy' ]; then
echo 'Removing fingerprint in known_hosts file on the host ...'
ssh-keygen -f ~/.ssh/known_hosts -R 192.168.44.10
ssh-keygen -f ~/.ssh/known_hosts -R 192.168.44.20
fi
")
class VagrantPlugins::ProviderVirtualBox::Action::Network
def dhcp_server_matches_config?(dhcp_server, config)
true
end
end
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
# qdbi : Qucit Deployment Base Image
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = "1"
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
# ssh settings
config.vm.provision "shell", inline: <<-EOC
sed -i -e "\\#PasswordAuthentication yes# s#PasswordAuthentication yes#PasswordAuthentication no#g" /etc/ssh/sshd_config
service ssh restart
useradd -U -m -c 'Qucit Admin' -s /bin/bash -p $(openssl passwd -1 "hubert") hubert
echo "hubert ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/hubert
usermod -c 'Qucit Deployer' -s /bin/bash -p $(openssl passwd -1 "ubuntu") ubuntu
EOC
config.vm.provision "file", source: "../qucit-master/keys/piroux-qucit-2018-id_rsa.pub", destination: "/tmp/authorized_keys"
config.vm.provision "shell", inline: <<-EOC
mkdir -p /home/hubert/.ssh
cat /tmp/authorized_keys >> /home/hubert/.ssh/authorized_keys
chown -R hubert:hubert /home/hubert/.ssh/
chmod 600 /home/hubert/.ssh/*
mkdir -p /home/ubuntu/.ssh
cat /tmp/authorized_keys >> /home/ubuntu/.ssh/authorized_keys
chown -R ubuntu:ubuntu /home/ubuntu/.ssh/
chmod 600 /home/ubuntu/.ssh/*
EOC
#config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y --no-install-recommends git vim watch htop smem
#SHELL
config.vm.provision "shell", inline: <<-SHELL
ip addr
SHELL
config.vm.define "qdbi-ansible-01" do |machine_01|
machine_01.vm.provider "virtualbox" do |vb|
vb.name = "qdbi-ansible-01"
end
machine_01.vm.hostname = "qdbi-ansible-01"
machine_01.vm.network "private_network", ip: "192.168.44.10"
machine_01.vm.post_up_message = "[VM 01] Ready for deployment"
end
config.vm.define "qdbi-ansible-02" do |machine_02|
machine_02.vm.provider "virtualbox" do |vb|
vb.name = "qdbi-ansible-02"
end
machine_02.vm.hostname = "qdbi-ansible-02"
machine_02.vm.network "private_network", ip: "192.168.44.20"
machine_02.vm.post_up_message = "[VM 02] Ready for deployment"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment