This is a minimal reproduction of an issue I am seeing when provisioning hosts with Saltstack and Packer. More specifically, running salt-call --local saltutil.sync_all
in a script uploaded by packer does not function as expected (no files/modules are sync'd).
Note that saltutil.sync_all
works fine on the new host when run manually from the shell directly.
- Download and install packer to your
$PATH
from https://www.packer.io/downloads.html - Create a new directory and copy the
setup_salt.sh
,base-host.json
, andconfig.json
files from this gist to that new directory - This build uses AWS, so you'll need an existing VPC and subnet. Grab the VPC and Subnet ID, and put those in
config.json
. - Update
config.json
with an Access Key ID and Secret Key you can use. - Run
packer build -var-file=config.json build.json
- If everything works, you'd see the
foobar.py
script sync withsaltutil.sync_all
, and you'll see salt run thefoobar.test
module withhello test
printed to stdout. If it fails, you won't seefoobar.py
sync'd, and you'll seeModule 'foobar' is not available
as output.