Compare commits
6 Commits
1837285b79
...
8f304d00ce
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f304d00ce | |||
| 94a34e4758 | |||
| b3c1f81ec6 | |||
| 6f7b493173 | |||
| 176083497c | |||
| 89c8f42a46 |
@@ -1,17 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# The base VM was downloaded using the following commands:
|
if [[ $# -lt 3 ]] ; then
|
||||||
# mkdir /var/lib/libvirt/images/base
|
cat <<-EOF
|
||||||
# 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
|
USAGE (RAM in megabytes)
|
||||||
# chown -R libvirt-qemu:root /var/lib/libvirt/images/base
|
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ; then
|
create_vm VMNAME RAM CPUS
|
||||||
echo 'USAGE: create_vm VMNAME'
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
VMNAME=$1
|
VMNAME=$1
|
||||||
|
RAM=$2
|
||||||
|
CPUS=$3
|
||||||
|
|
||||||
# Directory where image files will be stored
|
# Directory where image files will be stored
|
||||||
IMAGE_DIR=/var/lib/libvirt/images
|
IMAGE_DIR=/var/lib/libvirt/images
|
||||||
@@ -72,8 +72,8 @@ fi
|
|||||||
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
|
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
|
||||||
virt-install \
|
virt-install \
|
||||||
--name cloudinit-1 \
|
--name cloudinit-1 \
|
||||||
--ram 2048 \
|
--ram "$RAM" \
|
||||||
--vcpus 1\
|
--vcpus "$CPUS" \
|
||||||
--cpu host \
|
--cpu host \
|
||||||
--arch x86_64 \
|
--arch x86_64 \
|
||||||
--os-type linux \
|
--os-type linux \
|
||||||
|
|||||||
@@ -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:
|
|
||||||
@@ -2,19 +2,7 @@ name 'kosmos_kvm'
|
|||||||
maintainer 'Kosmos Developers'
|
maintainer 'Kosmos Developers'
|
||||||
maintainer_email 'mail@kosmos.org'
|
maintainer_email 'mail@kosmos.org'
|
||||||
license 'MIT'
|
license 'MIT'
|
||||||
description 'Installs/Configures kosmos_kvm'
|
description 'Install virt-install and deploy a script to create VMs'
|
||||||
long_description 'Installs/Configures kosmos_kvm'
|
long_description 'Install virt-install and deploy a script to create VMs with KVM'
|
||||||
version '0.1.0'
|
version '0.1.0'
|
||||||
chef_version '>= 14.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'
|
|
||||||
|
|||||||
@@ -24,7 +24,22 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# 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
|
cookbook_file "/usr/local/sbin/create_vm" do
|
||||||
source "create_vm"
|
source "create_vm"
|
||||||
|
|||||||
@@ -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:
|
|
||||||
@@ -2,8 +2,8 @@ name 'kosmos_zerotier'
|
|||||||
maintainer 'Kosmos Developers'
|
maintainer 'Kosmos Developers'
|
||||||
maintainer_email 'mail@kosmos.org'
|
maintainer_email 'mail@kosmos.org'
|
||||||
license 'MIT'
|
license 'MIT'
|
||||||
description 'Installs/Configures kosmos_zerotier'
|
description 'Installs/Configures zerotier'
|
||||||
long_description 'Installs/Configures kosmos_zerotier'
|
long_description 'Installs/Configures zerotier'
|
||||||
version '0.1.0'
|
version '0.1.0'
|
||||||
chef_version '>= 14.0'
|
chef_version '>= 14.0'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user