6 Commits

Author SHA1 Message Date
Greg Karékinian
8f304d00ce Remove unused kitchen.yml files 2020-12-08 16:34:24 +01:00
Greg Karékinian
94a34e4758 Add arguments for RAM and number of CPUs 2020-12-08 16:33:27 +01:00
Greg Karékinian
b3c1f81ec6 Set the description of the kosmos_zerotier cookbook 2020-12-08 16:26:14 +01:00
Greg Karékinian
6f7b493173 Create the base Ubuntu 20.04 cloud image with code 2020-12-08 16:25:32 +01:00
Greg Karékinian
176083497c Install the libvirt-daemon-system package
It creates the libvirt-qemu user
2020-12-08 16:25:04 +01:00
Greg Karékinian
89c8f42a46 Set the description for the kosmos_kvm cookbook 2020-12-08 16:03:18 +01:00
6 changed files with 29 additions and 90 deletions

View File

@@ -1,17 +1,17 @@
#!/bin/bash
set -e
# The base VM was downloaded using the following commands:
# mkdir /var/lib/libvirt/images/base
# curl -o http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img /var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2
# chown -R libvirt-qemu:root /var/lib/libvirt/images/base
if [[ $# -lt 3 ]] ; then
cat <<-EOF
USAGE (RAM in megabytes)
if [[ $# -eq 0 ]] ; then
echo 'USAGE: create_vm VMNAME'
create_vm VMNAME RAM CPUS
EOF
exit 1
fi
VMNAME=$1
RAM=$2
CPUS=$3
# Directory where image files will be stored
IMAGE_DIR=/var/lib/libvirt/images
@@ -72,8 +72,8 @@ fi
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
virt-install \
--name cloudinit-1 \
--ram 2048 \
--vcpus 1\
--ram "$RAM" \
--vcpus "$CPUS" \
--cpu host \
--arch x86_64 \
--os-type linux \

View File

@@ -1,32 +0,0 @@
---
driver:
name: vagrant
## The forwarded_port port feature lets you connect to ports on the VM guest via
## localhost on the host.
## see also: https://www.vagrantup.com/docs/networking/forwarded_ports.html
# network:
# - ["forwarded_port", {guest: 80, host: 8080}]
provisioner:
name: chef_zero
## product_name and product_version specifies a specific Chef product and version to install.
## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
# product_name: chef
# product_version: 15
verifier:
name: inspec
platforms:
- name: ubuntu-18.04
- name: centos-7
suites:
- name: default
verifier:
inspec_tests:
- test/integration/default
attributes:

View File

@@ -2,19 +2,7 @@ name 'kosmos_kvm'
maintainer 'Kosmos Developers'
maintainer_email 'mail@kosmos.org'
license 'MIT'
description 'Installs/Configures kosmos_kvm'
long_description 'Installs/Configures kosmos_kvm'
description 'Install virt-install and deploy a script to create VMs'
long_description 'Install virt-install and deploy a script to create VMs with KVM'
version '0.1.0'
chef_version '>= 14.0'
# The `issues_url` points to the location where issues for this cookbook are
# tracked. A `View Issues` link will be displayed on this cookbook's page when
# uploaded to a Supermarket.
#
# issues_url 'https://github.com/<insert_org_here>/kosmos_kvm/issues'
# The `source_url` points to the development repository for this cookbook. A
# `View Source` link will be displayed on this cookbook's page when uploaded to
# a Supermarket.
#
# source_url 'https://github.com/<insert_org_here>/kosmos_kvm'

View File

@@ -24,7 +24,22 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
package 'virtinst'
package %w(virtinst libvirt-daemon-system)
directory "/var/lib/libvirt/images/base" do
recursive true
owner "libvirt-qemu"
group "root"
mode "0750"
end
# Base Ubuntu 20.04 image
remote_file "/var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2" do
source "http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img"
owner "libvirt-qemu"
group "root"
mode "0640"
end
cookbook_file "/usr/local/sbin/create_vm" do
source "create_vm"

View File

@@ -1,32 +0,0 @@
---
driver:
name: vagrant
## The forwarded_port port feature lets you connect to ports on the VM guest via
## localhost on the host.
## see also: https://www.vagrantup.com/docs/networking/forwarded_ports.html
# network:
# - ["forwarded_port", {guest: 80, host: 8080}]
provisioner:
name: chef_zero
## product_name and product_version specifies a specific Chef product and version to install.
## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
# product_name: chef
# product_version: 15
verifier:
name: inspec
platforms:
- name: ubuntu-18.04
- name: centos-7
suites:
- name: default
verifier:
inspec_tests:
- test/integration/default
attributes:

View File

@@ -2,8 +2,8 @@ name 'kosmos_zerotier'
maintainer 'Kosmos Developers'
maintainer_email 'mail@kosmos.org'
license 'MIT'
description 'Installs/Configures kosmos_zerotier'
long_description 'Installs/Configures kosmos_zerotier'
description 'Installs/Configures zerotier'
long_description 'Installs/Configures zerotier'
version '0.1.0'
chef_version '>= 14.0'