J'ai essayé, sans succès, de trouver de la documentation/des exemples sur la manière de personnaliser diverses choses à l'aide du programme d'installation de Fastpath.
Ce document donne un aperçu de haut niveau.
Un plus pratique exemple pour modifier la configuration du réseau.
Je cherche à personnaliser la disposition de la partition (la valeur par défaut ne contient ni échange ni 100% de la partition racine).
N'importe qui?
Je me trouvais récemment face à la même question et, mis à part l'URL citée ci-dessus, je n'en ai pas trouvé beaucoup plus.
Avec l'aide du développeur de Maas et Curtin, j'ai pu créer un scénario de travail que j'ai décrit dans ce blog post .
J'espère que cela pourra vous aider les autres à faire face à la même question.
Si ça vous convient via ligne de commande, je le fais comme ceci:
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
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 $1}')
THIS_LV_ID=$(echo ${THIS_LV} | awk -F":" '{print $2}')
maas ${PROFILE} block-device unmount ${THIS_Host_ID} ${THIS_LV_ID}
maas ${PROFILE} block-device delete ${THIS_Host_ID} ${THIS_LV_ID}
done
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
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 $1}')
DEVICE_ID=$(echo $PARTITION | awk -F":" '{print $2}')
ID=$(echo $PARTITION | awk -F":" '{print $3}')
maas ${PROFILE} raid delete ${Host_ID} ${MD_DEVICE}
done
#
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 $1}')
DEVICE_ID=$(echo $PARTITION | awk -F":" '{print $2}')
ID=$(echo $PARTITION | awk -F":" '{print $3}')
maas ${PROFILE} partition delete ${SYSTEM_ID} ${DEVICE_ID} ${ID}
done
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
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
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 $1}')
DEVICE_ID=$(echo $PARTITION | awk -F":" '{print $2}')
ID=$(echo $PARTITION | awk -F":" '{print $3}')
maas ${PROFILE} partition delete ${SYSTEM_ID} ${DEVICE_ID} ${ID}
done
ceci est juste ma configuration, adaptez-la à vos besoins:
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')
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
BOOT_RAID_PARTITION_ID_1=$(awk '{print $1}' <<<${RAID_BOOT_IDS})
BOOT_RAID_PARTITION_ID_2=$(awk '{print $2}' <<<${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"
ROOT_RAID_PARTITION_ID_1=$(awk '{print $1}' <<<${RAID_ROOT_IDS})
ROOT_RAID_PARTITION_ID_2=$(awk '{print $2}' <<<${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="/"
#############################################################