[Share] Automated Installation & Initialization of MicroCloud

Hi Teams !
I’m trying to do automate MicroCloud installation and initialization.

The first step,
Installing packages, configuring IP addresses, and doing other provisioning and configuration tasks at the OS level. Using Metal-As-A-Service (MaaS) is strongly advised in order to expedite the procedure.

Next action,
During the cluster joining procedure, at the MicroCloud services level.
The use of “preseed.yaml” is strongly advised, and the “Command Loop” significantly reduces the time to run command on each node individually.

Executing the “microcloud preseed” command on all nodes, it seems we can do automation to make it faster, using the following command loop:

# SCP File preseed.yml to All Node
$ for i in {01,02,03}; do scp preseed.yaml root@MicroCloud-${i}:/root/; done

## RUN Preseed command to All Node 
$ for i in {01,02,03}; do ssh root@MicroCloud-${i} "hostname && \
cat preseed.yaml | microcloud preseed > initialize-output.txt"& done

## Read output instalation 
$ for i in {01,02,03}; do ssh root@MicroCloud-${i} "hostname && \
tail initialize-output.txt"; done

Anyone, please feel free if you have any ideas to discuss to efficient the process of installation

Best Regards
Rdw

Thanks for putting up an example using SSH.

One thing to consider in this scenario is to choose a session_timeout value inside the preseed file that accomodates the time it takes for all nodes to be ready and run microcloud preseed command. In your example this should not be a problem as you first distribute the preseed.yaml to all nodes (which requires them to be all up).

The initiator will wait until the session_timeout for all the joiners to reach out. Depending on how long the bootstrapping of the machines take, this value might need to be tweaked. However it already defaults to 60 minutes if not set.

Hi @jpelizaeus
Thanks for the reply,

yaps, session_timeout
will be the challenge, but no worries

When were execute this command :

This command will execute commands simultaneously without waiting for other commands.
because this command is using & done

is different with this command, this one is using ; done
This means that the commands are executed alternately and wait until the previous command is finished.

Best Regards
Rdw