replace VM if cloudinit image is replaced
This commit is contained in:
parent
e542ecc3a6
commit
95dce43d40
4 changed files with 13 additions and 12 deletions
|
@ -1,11 +1,7 @@
|
|||
#cloud-config
|
||||
hostname: hermes
|
||||
hostname: "${name}"
|
||||
manage_etc_hosts: true
|
||||
ssh_pwauth: false
|
||||
disable_root: false
|
||||
ssh_authorized_keys:
|
||||
- "${host_public_key}"
|
||||
chpasswd:
|
||||
list: |
|
||||
root:root
|
||||
expire: False
|
||||
|
|
|
@ -15,9 +15,9 @@ domain=dmz
|
|||
# IPv4 DHCP range
|
||||
dhcp-range=192.168.30.100,192.168.30.200,infinite
|
||||
# Predefined DHCP hosts
|
||||
dhcp-host=b8:27:eb:b9:ab:e2,esrom,192.168.30.2
|
||||
dhcp-host=b4:2e:99:77:1b:da,max,192.168.30.3
|
||||
dhcp-host=d8:5e:d3:47:33:6e,lewis,192.168.30.6
|
||||
dhcp-host=b8:27:eb:b9:ab:e2,esrom
|
||||
dhcp-host=b4:2e:99:77:1b:da,max
|
||||
dhcp-host=d8:5e:d3:47:33:6e,lewis
|
||||
# Advertise router
|
||||
dhcp-option=3,192.168.30.1
|
||||
# Always send the IPv6 DNS server address (this machine)
|
||||
|
|
11
main.tf
11
main.tf
|
@ -43,9 +43,8 @@ resource "libvirt_domain" "ubuntu" {
|
|||
|
||||
network_interface {
|
||||
bridge = "dmzbr"
|
||||
hostname = "hermes"
|
||||
/* addresses = ["${var.internal_ip}/24"] */
|
||||
mac = "ca:fe:c0:ff:ee:07"
|
||||
hostname = var.name
|
||||
mac = "CA:FE:C0:FF:EE:07"
|
||||
}
|
||||
|
||||
cloudinit = libvirt_cloudinit_disk.cloudinit.id
|
||||
|
@ -57,4 +56,10 @@ resource "libvirt_domain" "ubuntu" {
|
|||
ANSIBLE_HOST_KEY_CHECKING = "False"
|
||||
}
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
replace_triggered_by = [
|
||||
libvirt_cloudinit_disk.cloudinit.id
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
variable "name" {
|
||||
default = "dmzdns"
|
||||
default = "hermes"
|
||||
}
|
||||
|
||||
variable "libvirt_endpoint" {
|
||||
|
|
Reference in a new issue