feat: per-vm cloudinit template
This commit is contained in:
parent
9f10cd1ead
commit
f87a4053bc
|
@ -0,0 +1,65 @@
|
|||
#cloud-config
|
||||
# vim: ft=yaml
|
||||
|
||||
runcmd:
|
||||
- cat /etc/resolv.conf
|
||||
- uname -r
|
||||
|
||||
ssh_pwauth: true
|
||||
chpasswd:
|
||||
list: |
|
||||
root:1234
|
||||
expire: false
|
||||
|
||||
users:
|
||||
- name: overlord
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
shell: /bin/bash
|
||||
groups: wheel
|
||||
- name: root
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
- name: ansible
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
shell: /bin/bash
|
||||
groups: wheel
|
||||
|
||||
ssh_publish_hostkeys:
|
||||
enabled: false
|
||||
ssh:
|
||||
emit_keys_to_console: false
|
||||
|
||||
# hostname is set based on main.tf variables
|
||||
preserve_hostname: false
|
||||
fqdn: ${hostname}.${domainname}
|
||||
hostname: ${hostname}
|
||||
|
||||
|
||||
# reboot after fqdn is set to update the info in libvirt's dnsmasq
|
||||
power_state:
|
||||
delay: "+1"
|
||||
mode: reboot
|
||||
condition: true
|
||||
|
||||
packages:
|
||||
- vim
|
||||
- gcc
|
||||
- lld
|
||||
- golang
|
||||
- htop
|
||||
- kernel-devel
|
||||
- kernel-headers
|
||||
- nmap
|
||||
- python39 # for ansible
|
||||
- "@Security Lab"
|
||||
- sudo
|
||||
- tcpdump
|
||||
- tcpflow
|
||||
- tcptrack
|
||||
|
||||
package_upgrade: true
|
||||
package_reboot_if_required: true
|
|
@ -0,0 +1,59 @@
|
|||
#cloud-config
|
||||
# vim: ft=yaml
|
||||
|
||||
runcmd:
|
||||
- cat /etc/resolv.conf
|
||||
- uname -r
|
||||
|
||||
ssh_pwauth: true
|
||||
chpasswd:
|
||||
list: |
|
||||
root:1234
|
||||
expire: false
|
||||
|
||||
users:
|
||||
- name: root
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
- name: ansible
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
shell: /bin/bash
|
||||
groups: wheel
|
||||
|
||||
ssh_publish_hostkeys:
|
||||
enabled: false
|
||||
ssh:
|
||||
emit_keys_to_console: false
|
||||
|
||||
# hostname is set based on main.tf variables
|
||||
preserve_hostname: false
|
||||
fqdn: ${hostname}.${domainname}
|
||||
hostname: ${hostname}
|
||||
|
||||
|
||||
# reboot after fqdn is set to update the info in libvirt's dnsmasq
|
||||
power_state:
|
||||
delay: "+1"
|
||||
mode: reboot
|
||||
condition: true
|
||||
|
||||
packages:
|
||||
- vim
|
||||
- gcc
|
||||
- lld
|
||||
- golang
|
||||
- htop
|
||||
- kernel-devel
|
||||
- kernel-headers
|
||||
- nmap
|
||||
- python39 # for ansible
|
||||
- "@Security Lab"
|
||||
- sudo
|
||||
- tcpdump
|
||||
- tcpflow
|
||||
- tcptrack
|
||||
|
||||
package_upgrade: true
|
||||
package_reboot_if_required: true
|
|
@ -46,8 +46,6 @@ power_state:
|
|||
condition: true
|
||||
|
||||
packages:
|
||||
- vim
|
||||
- htop
|
||||
- sudo
|
||||
- python39 # for ansible
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#cloud-config
|
||||
# vim: ft=yaml
|
||||
|
||||
runcmd:
|
||||
- cat /etc/resolv.conf
|
||||
- uname -r
|
||||
|
||||
ssh_pwauth: true
|
||||
chpasswd:
|
||||
list: |
|
||||
root:1234
|
||||
expire: false
|
||||
|
||||
users:
|
||||
- name: root
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
- name: ansible
|
||||
ssh_authorized_keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtG6NCgdLHX4ztpfvYNRaslKWZcl6KdTc1DehVH4kAL
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
shell: /bin/bash
|
||||
groups: wheel
|
||||
|
||||
ssh_publish_hostkeys:
|
||||
enabled: false
|
||||
ssh:
|
||||
emit_keys_to_console: false
|
||||
|
||||
# hostname is set based on main.tf variables
|
||||
preserve_hostname: false
|
||||
fqdn: ${hostname}.${domainname}
|
||||
hostname: ${hostname}
|
||||
|
||||
|
||||
# reboot after fqdn is set to update the info in libvirt's dnsmasq
|
||||
power_state:
|
||||
delay: "+1"
|
||||
mode: reboot
|
||||
condition: true
|
||||
|
||||
packages:
|
||||
- vim
|
||||
- frr
|
||||
- htop
|
||||
- python39 # for ansible
|
||||
- sudo
|
||||
|
||||
package_upgrade: true
|
||||
package_reboot_if_required: true
|
|
@ -79,8 +79,8 @@ resource "libvirt_volume" "qcow2_volume" {
|
|||
# Use cloudinit config file
|
||||
# pass certain vars to cloudinit
|
||||
data "template_file" "user_data" {
|
||||
template = file("${path.module}/cloudinit.cfg")
|
||||
for_each = var.hosts
|
||||
template = file("${path.module}/cloudinit.${each.value.category}.cfg")
|
||||
vars = {
|
||||
hostname = each.value.name
|
||||
domainname = var.domainname
|
||||
|
|
Loading…
Reference in New Issue