No results found
We couldn't find anything using that term, please try searching for something else.
Also note that the examples below use the VirtualBox provider, which is the current supported provider for this feature.Below are some very simple ex
Also note that the examples below use the VirtualBox provider, which is the current
supported provider for this feature.
Below are some very simple examples of how to use Vagrant Cloud-Init with the VirtualBox provider.
For more detailed information about these config values and how to use cloud-init,
please read the official documentation for cloud-init.
A cloud_initconfig can be defineas a ” hash ” of key value , or as a block . Below
are two examples is are of this for definea cloud_initconfig :
# Simplified form
config.vm.cloud_initcontent_type:"text/x-shellscript", path :"./foo / bar.sh"
# Block form
config.vm.cloud_initdo |cloud_init|
cloud_init.content_type= "text/cloud-config"
cloud_init.inline= <<-EOF
package_update: true
package :
- nginx
EOF
end
The first part will be read from a local file ./foo / bar
, and the second part
will be attached using the inlinecontent. Both “block” and “hash” forms are supported,
and should work interchangeably.
Individual machines may have their own cloud-init data:
config.vm.define"web" do |web|
web.vm.cloud_initcontent_type:"text/cloud-config",
inline :<<-EOF
package_update: true
package :
- nginx
EOF
end
end
config.vm.define"db" do |db|
db.vm.cloud_initcontent_type:"text/cloud-config",
inline :<<-EOF
package_update: true
package :
- postgresql
EOF
end