mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(snippets/cloud-init): prepare disks for ec2 instances
This commit is contained in:
33
snippets/cloud-init/commands.sh
Normal file
33
snippets/cloud-init/commands.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cloud-init status
|
||||
|
||||
# Check logs
|
||||
cat '/var/log/cloud-init-output.log'
|
||||
tail -f '/var/log/cloud-init.log' '/var/log/cloud-init-output.log'
|
||||
|
||||
##
|
||||
# Re-run everything
|
||||
##
|
||||
|
||||
# 1. Clean the existing configuration
|
||||
sudo cloud-init clean --logs
|
||||
|
||||
# 2. Detect local data sources
|
||||
sudo cloud-init init --local
|
||||
|
||||
# 3. Detect any data source requiring the network and run the 'initialization' modules
|
||||
sudo cloud-init init
|
||||
|
||||
# 4. Run the 'configuration' modules
|
||||
sudo cloud-init modules --mode='config'
|
||||
|
||||
# 5. Run the 'final' modules
|
||||
sudo cloud-init modules -m 'final'
|
||||
|
||||
# All together now!
|
||||
sudo cloud-init clean --logs
|
||||
sudo cloud-init init --local
|
||||
sudo cloud-init init
|
||||
sudo cloud-init modules --mode='config'
|
||||
sudo cloud-init modules -m 'final'
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
#cloud-config
|
||||
|
||||
###
|
||||
# Sources:
|
||||
# - https://cloudinit.readthedocs.io/en/latest/reference/modules.html#mounts
|
||||
# - https://stackoverflow.com/questions/49980714/how-to-use-cloud-init-to-mount-an-unformatted-ebs-volume#78737805
|
||||
###
|
||||
|
||||
device_aliases:
|
||||
data: /dev/nvme1n1
|
||||
disk_setup:
|
||||
data:
|
||||
layout: true
|
||||
overwrite: false
|
||||
table_type: gpt
|
||||
fs_setup:
|
||||
- device: "data.1"
|
||||
filesystem: "xfs"
|
||||
label: "data"
|
||||
mounts:
|
||||
- [ "data.1", "/mnt/data" ]
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
#cloud-config
|
||||
|
||||
###
|
||||
# Sources:
|
||||
# - https://cloudinit.readthedocs.io/en/latest/reference/modules.html#mounts
|
||||
# - https://stackoverflow.com/questions/49980714/how-to-use-cloud-init-to-mount-an-unformatted-ebs-volume#78737805
|
||||
###
|
||||
|
||||
device_aliases:
|
||||
data: /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol0a250869ccd411b30
|
||||
disk_setup:
|
||||
data:
|
||||
layout: true
|
||||
overwrite: false
|
||||
table_type: gpt
|
||||
fs_setup:
|
||||
- device: "data.1"
|
||||
filesystem: "xfs"
|
||||
label: "data"
|
||||
mounts:
|
||||
- [
|
||||
"/dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol0a250869ccd411b30-part1",
|
||||
"/mnt/data",
|
||||
"xfs",
|
||||
"defaults,nofail,x-systemd.device-timeout=30s,x-systemd.makefs",
|
||||
"0",
|
||||
"2"
|
||||
]
|
||||
Reference in New Issue
Block a user