Attempting to add an inline reboot command based on this
https://discuss.hashicorp.com/t/best-practice-for-applying-updates-and-kernel-patches/3300/2 but playing around today to build new AWS AMIs, I seem to get errors. This is also sort of documented on
packer.io https://www.packer.io/docs/provisioners/shell/#handling-reboots. I was trying to do inline to keep it simply
I am mainly trying to add the reboot as trying to get kernel and associated packages up to date prior to installing this awful Symantec Endpoint agent that was thrust upon me from above. It compiles some autoprotect feature based on the kernel, so want to update my kernel and associated pacakges first, inline reboot, then proceed with ansible playbooks that include the Symantec agent and thus at least i can ensure the base AMI kernel is functioning ok at build/install.
- packer 1.5.5 is what I am currently using
- I was testing redhat7 and centos7 today
{
"type": "shell",
"inline": "sudo reboot",
"expect_disconnect": true,
"pause_before": "30s",
"timeout": "5m"
},
Ive tried variations of commands
- putting my inline in [ ] for array
- sudo shutdown -now
- sudo /usr/sbin/reboot (or shutdown)
- sudo systemctl reboot
but packer always throws an error similar to
amazon-ebs: /tmp/script_5489.sh: line 16: REBOOT: command not found
amazon-ebs: /tmp/script_5489.sh: line 16: REBOOT: command not found
What am I overlooking in the docs here?