terraform-libvirt-ubuntu-ex.../datadisks/cloud_init.cfg

66 lines
1.5 KiB
INI

#cloud-config
hostname: ${hostname}
fqdn: ${fqdn}
manage_etc_hosts: true
users:
- name: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
home: /home/ubuntu
shell: /bin/bash
lock_passwd: false
ssh-authorized-keys:
- ${file("id_rsa.pub")}
# only cert auth via ssh (console access can still login)
ssh_pwauth: false
disable_root: false
chpasswd:
list: |
ubuntu:linux
expire: False
packages:
- qemu-guest-agent
growpart:
mode: auto
devices: ['/']
disk_setup:
/dev/vdb:
table_type: gpt
layout: True
overwrite: False
/dev/vdc:
table_type: gpt
layout: True
overwrite: False
fs_setup:
- label: DATA_XFS
filesystem: xfs
device: '/dev/vdb'
partition: auto
#cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
- label: DATA_EXT4
filesystem: ext4
device: '/dev/vdc'
partition: auto
#cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
mounts:
# [ /dev/vdx, /mountpoint, fstype ]
- [ LABEL=DATA_XFS, /dataxfs, xfs ]
- [ LABEL=DATA_EXT4, /dataext4, ext4 ]
# https://linuxroutes.com/linux-fstab/
# 3rd col=fs type, 4th col=permissions, 5th=backup enabled, 6th=fsck order
mount_default_fields: [ None, None, "ext4", "defaults,noatime","0","2"]
# every boot
bootcmd:
- [ sh, -c, 'echo $(date) | sudo tee -a /root/bootcmd.log' ]
# run once for setup
runcmd:
- [ sh, -c, 'echo $(date) | sudo tee -a /root/runcmd.log' ]
# written to /var/log/cloud-init-output.log
final_message: "The system is finall up, after $UPTIME seconds"