Switch VM provisioning method

Remove Ansible playbook. Add shell script to do provisioning. Modify Vagrantfile accordingly.
This commit is contained in:
Scott S. Lowe 2016-04-17 19:00:43 -06:00
parent d25f50f81f
commit 2733fdfa3e
3 changed files with 52 additions and 49 deletions

View file

@ -51,10 +51,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vb.cpus = machine['vcpu']
end # srv.vm.provider virtualbox
# Provision Docker on appropriate VMs
if machine['provision'] != nil
srv.vm.provision 'ansible', playbook: machine['provision']
end # if machine['provision']
# Provision the VMs
srv.vm.provision 'shell', path: 'provision.sh', privileged: true
end # config.vm.define
end # machines.each
end # Vagrant.configure

View file

@ -1,45 +0,0 @@
---
- hosts: "all"
sudo: "yes"
remote_user: "vagrant"
gather_facts: false
tasks:
- name: "Bootstrap node"
raw: "apt-get install -y python python2.7"
- name: "Download containerd"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/containerd"
dest: "/usr/local/bin/containerd"
mode: "0755"
- name: "Download containerd-shim"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/containerd-shim"
dest: "/usr/local/bin/containerd-shim"
mode: "0755"
- name: "Download runc"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/runc"
dest: "/usr/local/bin/runc"
mode: "0755"
- name: "Download ctr"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/ctr"
dest: "/usr/local/bin/ctr"
mode: "0755"
- name: "Set properties for downloaded files"
file:
path: "{{ item }}"
owner: "root"
group: "root"
mode: "0755"
with_items:
- /usr/local/bin/containerd
- /usr/local/bin/runc
- /usr/local/bin/ctr
- /usr/local/bin/containerd-shim

View file

@ -0,0 +1,50 @@
#!/bin/bash
# Install curl if needed
if [[ ! -e /usr/bin/curl ]]; then
sudo apt-get -yqq install curl
fi
# Download containerd, if it isn't already present on the system
if [[ ! -e /usr/local/bin/containerd ]]; then
# Download containerd from GitHub
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/containerd
# Move the downloaded binary to /usr/local/bin
sudo mv containerd /usr/local/bin/containerd
sudo chmod a+x /usr/local/bin/containerd
fi
# Download containerd-shim, if it isn't already present on the system
if [[ ! -e /usr/local/bin/containerd-shim ]]; then
# Download containerd-shim from GitHub
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/containerd-shim
# Move the downloaded binary to /usr/local/bin
sudo mv containerd-shim /usr/local/bin/containerd-shim
sudo chmod a+x /usr/local/bin/containerd-shim
fi
# Download ctr, if it isn't already present on the system
if [[ ! -e /usr/local/bin/ctr ]]; then
# Download ctr from GitHub
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/ctr
# Move the downloaded binary to /usr/local/bin
sudo mv ctr /usr/local/bin/ctr
sudo chmod a+x /usr/local/bin/ctr
fi
# Download runc, if it isn't already present on the system
if [[ ! -e /usr/local/bin/runc ]]; then
# Download runc from GitHub
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/runc
# Move the downloaded binary to /usr/local/bin
sudo mv runc /usr/local/bin/runc
sudo chmod a+x /usr/local/bin/runc
fi