personalizzazione dell'installazione di preseed di maas curtin (fastpath)

4

Ho provato, senza successo, a trovare documentazione / esempi su come personalizzare varie cose usando il programma di installazione di fastpath.

Questo documento dà un alto -level panoramica.

Un esempio più pratico per la modifica della configurazione di rete

Sto cercando di personalizzare il layout della partizione (il default non ha swap e il 100% alla partizione root).

Chiunque?

    
posta kyleo 07.08.2014 - 21:31

2 risposte

2

Recentemente ho affrontato la stessa domanda e, a parte l'URL sopra riportato, non ho trovato molto di più.

Con l'aiuto dello sviluppatore di Maas e Curtin, sono riuscito a trovare uno scenario di lavoro che ho descritto in questo blog posta .

Spero che possa aiutarti a risolvere gli altri con la stessa domanda.

    
risposta data louis-bouchard 03.07.2015 - 16:23
0

Se è OK per te tramite riga di comando, lo faccio in questo modo:

- & gt; preparare

PROFILE=maas-mgmt
maas login ${PROFILE} http://localhost/MAAS/api/2.0 \
<Your API-Key>

maas ${PROFILE} machines read | jq '.[] | select(.status_name=="Ready") | {hostname: .hostname, system_id: .system_id, status: .status, in: [.interface_set[].name]|sort }' --compact-output

HOST_ID=<put in the id of your system> # eg. abcxyz

- & gt; 1a: pulizia

cancella tutti i LV

ALL_LVS=$(maas ${PROFILE} volume-groups read ${HOST_ID} | jq '.[] |."logical_volumes"[] | "\(.system_id):\(.id)"' --compact-output | sed 's/"//g')
for THIS_LV in ${ALL_LVS} ; do
  THIS_HOST_ID=$(echo ${THIS_LV} | awk -F":" '{print }')
  THIS_LV_ID=$(echo ${THIS_LV} | awk -F":" '{print }')
  maas ${PROFILE} block-device unmount ${THIS_HOST_ID} ${THIS_LV_ID}
  maas ${PROFILE} block-device delete ${THIS_HOST_ID} ${THIS_LV_ID}
done

cancella tutti i gruppi di volumi

ALL_VG_IDS=$(maas ${PROFILE} volume-groups read ${HOST_ID} | jq '.[] | .id')
for VG_ID in ${ALL_VG_IDS} ; do
  maas ${PROFILE} volume-group delete ${HOST_ID} ${VG_ID}
done

cancella tutti i dispositivi md-RAID

MD_RAIDS=$(maas ${PROFILE} raids read ${HOST_ID})
MD_DEVICES=$(echo ${MD_RAIDS} | jq '.[] | .id')
for MD_DEVICE in ${MD_DEVICES} ; do
  SYSTEM_ID=$(echo $PARTITION | awk -F":" '{print }')
  DEVICE_ID=$(echo $PARTITION | awk -F":" '{print }')
  ID=$(echo $PARTITION | awk -F":" '{print }')
  maas ${PROFILE} raid delete ${HOST_ID} ${MD_DEVICE}
done
#

cancella tutte le partizioni

BLOCK_DEVICES=$(maas ${PROFILE} block-devices read ${HOST_ID})
PARTITIONS=$(echo ${BLOCK_DEVICES} | jq '.[] | ."partitions"[] | "\(.system_id):\(.device_id):\(.id)"' --compact-output | sed 's/"//g')

for PARTITION in ${PARTITIONS} ; do
  SYSTEM_ID=$(echo $PARTITION | awk -F":" '{print }')
  DEVICE_ID=$(echo $PARTITION | awk -F":" '{print }')
  ID=$(echo $PARTITION | awk -F":" '{print }')
  maas ${PROFILE} partition delete ${SYSTEM_ID} ${DEVICE_ID} ${ID}
done

cancella tutti i dispositivi bcache

BCACHE_DEVICE_IDS=$(maas ${PROFILE} bcaches read ${HOST_ID} | jq '.[] .id')
for MY_ID in ${BCACHE_DEVICE_IDS} ; do
  maas ${PROFILE} bcache delete ${HOST_ID} ${MY_ID}
done

cancella tutti i set di cache bcache

BCACHE_CACHE_SETS=$(maas ${PROFILE} bcache-cache-sets read ${HOST_ID} | jq '.[] .id')
for MY_ID in ${BCACHE_CACHE_SETS} ; do
  maas ${PROFILE} bcache-cache-set delete ${HOST_ID} ${MY_ID}
done

cancella tutte le partizioni

BLOCK_DEVICES=$(maas ${PROFILE} block-devices read ${HOST_ID})
PARTITIONS=$(echo ${BLOCK_DEVICES} | jq '.[] | ."partitions"[] | "\(.system_id):\(.device_id):\(.id)"' --compact-output | sed 's/"//g')

for PARTITION in ${PARTITIONS} ; do
  SYSTEM_ID=$(echo $PARTITION | awk -F":" '{print }')
  DEVICE_ID=$(echo $PARTITION | awk -F":" '{print }')
  ID=$(echo $PARTITION | awk -F":" '{print }')
  maas ${PROFILE} partition delete ${SYSTEM_ID} ${DEVICE_ID} ${ID}
done

- & gt; 2a: nuova configurazione

questa è solo la mia configurazione, adattala per le tue esigenze:

ottieni gli ID dei dispositivi richiesti

ALL_BLOCKDEVICES=$(maas ${PROFILE} block-devices read ${HOST_ID})
P3600_ID=$(echo ${ALL_BLOCKDEVICES} | jq '.[] | select(.model|contains("SSDPEDME020T4D"))|.id')
P3700_ID=$(echo ${ALL_BLOCKDEVICES} | jq '.[] | select(.model|contains("SSDPEDMD020T4D"))|.id')
ALL_HDDS=$(echo ${ALL_BLOCKDEVICES} | jq '.[] | select(.tags[]|contains("rotary"))| .id')
BCACHE_CACHE_DEVICE_1_ID=$(maas ${PROFILE} bcache-cache-sets create ${HOST_ID} cache_device=${P3600_ID} | jq '. .id')

crea partizioni di sistema e dispositivi bcache

declare -i MY_COUNTER=0
RAID_BOOT_IDS=""
RAID_ROOT_IDS=""
for MY_HDD in ${ALL_HDDS} ; do
  if [[ ${MY_COUNTER} -lt 2 ]] ; then
    ## the first two devices will be mixed used for system _and_ OSD
    BOOT_PART_ID=$(maas ${PROFILE} partitions create ${HOST_ID} ${MY_HDD} size=2G bootable=yes | jq '. .id')
    RAID_BOOT_IDS="${RAID_BOOT_IDS} ${BOOT_PART_ID}"
    SYSTEM_PART_ID=$(maas ${PROFILE} partitions create ${HOST_ID} ${MY_HDD} size=400G | jq '. .id')
    RAID_ROOT_IDS="${RAID_ROOT_IDS} ${SYSTEM_PART_ID}"
    MAX_SIZE=$(maas ${PROFILE} block-device read ${HOST_ID} ${MY_HDD} | jq '. .available_size')
    MY_BCACHE_PART_ID=$(maas ${PROFILE} partitions create ${HOST_ID} ${MY_HDD} size=${MAX_SIZE} | jq '. .id')
    maas ${PROFILE} bcaches create ${HOST_ID} cache_set=${BCACHE_CACHE_DEVICE_1_ID} backing_partition=${MY_BCACHE_PART_ID} cache_mode=writeback name=bcache${MY_COUNTER}
  else
    ## all others will be OSD only devices
    maas ${PROFILE} bcaches create ${HOST_ID} cache_set=${BCACHE_CACHE_DEVICE_1_ID} backing_device=${MY_HDD} cache_mode=writeback name=bcache${MY_COUNTER}
  fi
  MY_COUNTER+=1
done

crea software-raid per l'avvio

BOOT_RAID_PARTITION_ID_1=$(awk '{print }' <<<${RAID_BOOT_IDS})
BOOT_RAID_PARTITION_ID_2=$(awk '{print }' <<<${RAID_BOOT_IDS})
RAID_BOOT_ID=$(maas ${PROFILE} raids create ${HOST_ID} name="md/boot" level=raid-1 partitions={${BOOT_RAID_PARTITION_ID_1},${BOOT_RAID_PARTITION_ID_2}} | jq ' . | .virtual_device | .id')
maas ${PROFILE} block-device format ${HOST_ID} ${RAID_BOOT_ID} fstype=ext4 label="boot"
maas ${PROFILE} block-device mount ${HOST_ID} ${RAID_BOOT_ID} mount_point="/boot"

crea software-raid per system-volume-group e logical-volume per "/"

ROOT_RAID_PARTITION_ID_1=$(awk '{print }' <<<${RAID_ROOT_IDS})
ROOT_RAID_PARTITION_ID_2=$(awk '{print }' <<<${RAID_ROOT_IDS})
RAID_ROOT_ID=$(maas ${PROFILE} raids create ${HOST_ID} name="md/root" level=raid-1 partitions={${ROOT_RAID_PARTITION_ID_1},${ROOT_RAID_PARTITION_ID_2}} | jq ' . | .virtual_device | .id')
HOST_NAME=$(maas ${PROFILE} machines read | jq '.[] | select(.system_id=="'$HOST_ID'") | .hostname'| sed 's/"//g')
VOL_GR_ID=$(maas ${PROFILE} volume-groups create ${HOST_ID} name=${HOST_NAME}_SYSTEM_VG uuid=$(uuidgen) block_devices=${RAID_ROOT_ID} | jq '. .id')
ROOT_LV_ID=$(maas ${PROFILE} volume-group create-logical-volume ${HOST_ID} ${VOL_GR_ID} name=root-lv size=200G uuid=$(uuidgen) | jq '. .id')
maas ${PROFILE} block-device format ${HOST_ID} ${ROOT_LV_ID} fstype=ext4 uuid=$(uuidgen) label="ROOT"
maas ${PROFILE} block-device mount ${HOST_ID} ${ROOT_LV_ID} mount_point="/"

####### Alternativ? #########################################
### without LV, only one root-device
# maas ${PROFILE} block-device format ${HOST_ID} ${RAID_ROOT_ID} fstype=ext4 label="root"
# maas ${PROFILE} block-device mount ${HOST_ID} ${RAID_ROOT_ID} mount_point="/"
#############################################################
    
risposta data Marcus 11.04.2018 - 20:07

Leggi altre domande sui tag