Commit ef1f5a91 authored by Rafael Monnerat's avatar Rafael Monnerat

packer: Allow pass tokens and names via command line to auto-configure the VM

  This will generate an image for a ready to use and configured node on SlapOS Node
parent 53a01dd4
......@@ -5,7 +5,10 @@
"domain": "",
"disk_size": "6",
"name": "image",
"custom_script": "scripts/"
"custom_script": "scripts/",
"re6st_token": "{{env `RE6STTOKEN`}}",
"computer_token": "{{env `COMPUTERTOKEN`}}"
"computer_name": "{{env `COMPUTERNAME`}}"
......@@ -55,12 +58,13 @@
"type": "shell",
"execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"environment_vars": ["re6st_token={{ user `re6st_token` }}", "computer_name={{user `computer_name`}}", "computer_token={{ user `computer_token` }}"],
"scripts": [
"{{ user `custom_script` }}"
......@@ -12,4 +12,15 @@ pip2 install --exists-action=i requests
pip2 install --exists-action=i slapcache
wget -O /root/run-vifib-base
bash /root/run-vifib-base
bash /root/run-vifib-base
re6st-conf --registry --token $RE6STTOKEN -r title $RE6STTOKEN -d /etc/re6stnet
slapos node register --token $COMPUTERTOKEN --interface-name lo $COMPUTERNAME
# Re-run after the register to finish up the configuration
bash /root/run-vifib-base
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment