personalizando o maas curtin (fastpath) preseed install

4

Eu tenho tentado, sem sucesso, encontrar documentação / exemplos sobre como personalizar várias coisas usando o instalador do atalho.

Este documento oferece uma alta Visão geral do nível.

Um exemplo mais prático para modificar a configuração de rede.

Eu estou olhando para personalizar o layout da partição (o padrão não tem swap e 100% para a partição raiz).

Alguém?

    
por kyleo 07.08.2014 / 21:31

2 respostas

2

Recentemente, enfrentei a mesma pergunta e, além da URL citada acima, não encontrei muito mais.

Com a ajuda do desenvolvedor de Maas e Curtin, consegui criar um cenário de trabalho que descrevi neste blog post .

Espero que ele possa ajudá-lo em outras pessoas que enfrentam a mesma pergunta.

    
por louis-bouchard 03.07.2015 / 16:23
0

Se está tudo bem para você via linha de comando, eu faço assim:

- > preparar

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

- > 1º: limpeza

excluir todos os LVs

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

excluir todos os grupos de volumes

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

excluir todos os dispositivos 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 $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
#

excluir todas as partições

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

delete todos os dispositivos 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

excluir todos os conjuntos de 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

excluir todas as partições

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

- > 2ª: nova configuração

esta é apenas a minha configuração, adapte-a às suas necessidades:

obter IDs dos dispositivos necessários

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')

crie partições do sistema e dispositivos 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

criar software-raid para inicialização

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"

crie o software-raid para system-volume-group e logical-volume para "/"

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="/"
#############################################################
    
por Marcus 11.04.2018 / 20:07

Tags