Initial vmtool/ovhtool commit

This commit is contained in:
2016-05-31 00:08:37 +02:00
commit 9d721349c4
10 changed files with 434 additions and 0 deletions

44
templates/libvirt.xml Normal file
View File

@@ -0,0 +1,44 @@
<domain type='kvm'>
<name>{{ instance.name }}</name>
<vcpu>{{ instance.cpus }}</vcpu>
<currentMemory unit='MiB'>{{ instance.memory|megabytes }}</currentMemory>
<memory unit='MiB'>{{ instance.memory|megabytes }}</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<devices>
<interface type='bridge'>
<mac address='{{ instance.mac }}' />
<source bridge='{{ config.bridge }}'/>
<filterref filter='clean-traffic'>
<parameter name='IP' value='{{ instance.ip }}' />
<parameter name='MAC' value='{{ instance.mac }}' />
</filterref>
<model type='virtio'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/3'/>
<target port='0'/>
</serial>
<graphics type='vnc' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video/>
<disk type='block' device='disk'>
<driver name='qemu' type='raw' />
<source dev='{{ instance.storage_path }}'/>
<target dev='vda' bus='virtio' />
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' />
<source file='{{ instance.ds_path }}' />
<target dev='vdb' bus='virtio' />
</disk>
</devices>
</domain>

3
templates/meta-data Normal file
View File

@@ -0,0 +1,3 @@
dsmode: local
hostname: {{ instance.name }}
local-hostname: {{ instance.name }}

20
templates/network-config Normal file
View File

@@ -0,0 +1,20 @@
---
version: 1
config:
{% for ns in instance.dns.split(' ') %}
- type: nameserver
address: {{ ns }}
{% endfor %}
- type: physical
name: ens3
subnets:
- control: auto
type: static
address: |
{{ instance.ip }}
post-up route add {{ host_ip|ipreplace('254') }} dev ens3
post-up route add default gw {{ host_ip|ipreplace('254') }}
post-down route del {{ host_ip|ipreplace('254') }} dev ens3
post-down route del default gw {{ host_ip|ipreplace('254') }}
netmask: 255.255.255.255
broadcast: {{ instance.ip|ipreplace('1') }}

8
templates/user-data Normal file
View File

@@ -0,0 +1,8 @@
#cloud-config
chpasswd:
list: |
{{ instance.user }}:{{ instance.password }}
expire: False
bootcmd:
- [ cloud-init-per, once, sshenable, sed, -i, 's/PasswordAuthentication no/PasswordAuthentication yes/g', /etc/ssh/sshd_config ]