A ./plunder config deployment > deployment.json
will create a blank deployment configuration that can be pre-populated in order to create specific deployments.
A configured deployment should resemble something like the example below:
{
"globalConfig": {
"adapter": "ens192",
"gateway": "192.168.0.1",
"subnet": "255.255.255.0",
"nameserver": "192.168.0.1",
"ntpserver": "192.168.0.1",
"username": "user",
"password": "pass",
"repoaddress": "192.168.0.1",
"mirrordir": "/ubuntu",
"sshkeypath": "/home/deploy/.ssh/id_pub.rsa",
"sshkey": "ssh-rsa AABBCCDDEE1122334455",
"packages": "nginx openssh-server"
},
"deployments": [
{
"mac": "00:11:22:33:44:55",
"bootConfigName": "default",
"bootConfig": {
"configName": "",
"kernelPath": "",
"initrdPath": "",
"cmdline": ""
},
"config": {
"address": "192.168.0.2",
"hostname": "Server01"
}
}
]
}
The globalConfig is the configuration that is inherited by any of the deployment configurations where that information has been omitted, typically a lot of networking information, keys or package information will be shared amongst deployments.
Placing the same information into an actual deployment will override the configuration inherited from the globalConfig
.
gateway
- The gateway a server will be configured to use as default routersubnet
- The network range server will be configured to usenameserver
- DNS server to resolve hostnamesntpserver
- The address of a timeserveradapter
- Which specific adapter will be configuredswapEnabled
- Build the Operating system without swap being createdusername
- A default user that will be createdpassword
- A password for the above userrepoaddress
- The hostname/ip address of the server where the OS packages residesshkeypath
- The path to an ssh key that will be added to the image for authenticating
address
- A unique network address that will be added to the serverhostname
- A unique hostname to be added to the provisioned server
As mentioned above, a lot of fields can be ignored and the entry from the globalConfig
will be used.
The deployment contains things that will make a server unique!
-
mac
- The unqique HW mac address of a server to configure -
kernelPath
- If a specific kernel should be used (for things like LinuxKit) -
initrdPath
- If a specific init ramdisk should be used -
cmdline
- Any arguments that should be passed to the kernel ramdisk
The deployment
specifies how the server will be provisioned, there are three options:
preseed
Ubuntu/Debian pressed deploymentkickstart
CentOS/RHEL deploymentreboot
This is for servers that need to be kept on a reboot loop.
The remaining config
allows updates or overrides to the global confgiguration detailed above.
The webserver exposes a /deployment
end point that can be used to provide an online update of the configuration, this has the following benefits:
- Allows automation of updates, through things like an API call
- Provides no-downtime, stopping and starting the server to load a new configuration can result in a broken installation as the network connection will be broken during restart
Retrieve the existing configuration
The currently active configuration can be retrieved through a simple get on the /deployment
endpoint
e.g.
curl -vX <IP ADDRESS>/deployment
Updating the configuration
The configuration can be updated by POST
ing the configuration JSON to the same URL.
e.g.
curl -vX POST deploy01/deployment -d @deployment.json --header "Content-Type: application/json"
With configuration for both the services and the deployments completed, they can both be passed to plunder
in order for servers to be built.
As shown below:
sudo ./plunder server --config ./config.json --deployment ./deployment.json --logLevel 5
[sudo] password for dan:
INFO[0000] Reading configuration from [./config.json]
INFO[0000] Starting Remote Boot Services, press CTRL + c to stop
DEBU[0000]
Server IP: 192.168.1.1
Adapter: ens192
Start Address: 192.168.1.2
Pool Size: 100
INFO[0000] RemoteBoot => Starting DHCP
INFO[0000] RemoteBoot => Starting TFTP
DEBU[0000]
Server IP: 192.168.1.1
PXEFile: undionly.kpxe
INFO[0000] Opening and caching undionly.kpxe
INFO[0000] RemoteBoot => Starting HTTP
INFO[0286] DCHP Message: Discover
Servers that have their mac addresses in the deployment
file will be passed the correct bootloader and they will ultimately be provisioned with the networking information as part of the configuration, they also will be provisioned with the credentials and specified ssh key.
For provisioning applications or a platform details are here.