Skip to content

Commit

Permalink
Some light renaming/comment streamlining
Browse files Browse the repository at this point in the history
  • Loading branch information
moio committed Oct 29, 2018
1 parent c37288b commit fd69078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#cloud-config
# vim: syntax=yaml
# set locale
locale: en_US.UTF-8

# set timezone
timezone: Europe/Paris

ssh_pwauth: True
chpasswd:
list: |
root:linux
expire: False

disable_root: false
apt_update: true

# NOTE: this pkg are tested only for ubuntu. For sure other distro have othre pkgs names ...
apt_update: true
packages:
- qemu-guest-agent
- salt-minion
Expand Down
21 changes: 7 additions & 14 deletions modules/libvirt/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ resource "libvirt_volume" "main_disk" {
}

data "template_file" "user_data" {
template = "${file("${path.module}/cloud_init_ubuntu.cfg")}"
template = "${file("${path.module}/cloud_init.cfg")}"
}

resource "libvirt_cloudinit_disk" "minimalconf" {
name = "${var.base_configuration["name_prefix"]}${var.name}${var.count > 1 ? "-${count.index + 1}" : ""}-minimalconf.iso"
user_data = "${data.template_file.user_data.rendered}"
// this is the hcl way of comparing substrings..
count = "${replace(var.image, "ubuntu1804", "") != var.image ? 1 : 0}"
resource "libvirt_cloudinit_disk" "cloudinit_disk" {
name = "${var.base_configuration["name_prefix"]}${var.name}${var.count > 1 ? "-${count.index + 1}" : ""}-cloudinit.iso"
user_data = "${data.template_file.user_data.rendered}"
}


resource "libvirt_domain" "domain" {
name = "${var.base_configuration["name_prefix"]}${var.name}${var.count > 1 ? "-${count.index + 1}" : ""}"
memory = "${var.memory}"
Expand All @@ -35,7 +32,8 @@ resource "libvirt_domain" "domain" {
count = "${var.count}"
qemu_agent = true

cloudinit = "${libvirt_cloudinit_disk.minimalconf.id}"
cloudinit = "${libvirt_cloudinit_disk.cloudinit_disk.id}"

// base disk + additional disks if any
disk = ["${concat(
list(
Expand Down Expand Up @@ -63,9 +61,7 @@ resource "libvirt_domain" "domain" {
user = "root"
password = "linux"
}
# IMPORTANT
# Ubuntu can hang if an isa-serial is not present at boot time.
# If you find your CPU 100% and never is available this is why

console {
type = "pty"
target_port = "0"
Expand All @@ -84,9 +80,6 @@ resource "libvirt_domain" "domain" {
autoport = true
}




provisioner "file" {
source = "salt"
destination = "/root"
Expand Down

0 comments on commit fd69078

Please sign in to comment.