Wow looks really interesting! I guess that is I was looking for, the way to
put some scripts there…
"scripts": [
"update.sh",
"supervisor.sh",
"git.sh",
"node.sh",
"global_node_modules.sh",
"ssh.sh"
]
I guess that part in addition with the libraries, specially the
config_virtualbox
# Run provisioning scripts
# Global
server["host_scripts"].each do |script, key|
instance.vm.provision :host_shell do |host_shell|
host_shell.inline = './host_scripts/' + script
end
end
So thanks a million for your reply!
Gracias!
JC
2016-03-31 3:57 GMT+01:00 Alvaro Miranda Aguilera <[email protected]>:
> Hello,
>
> There are lots of example in the internet around what you can do.
> Basically because Vagrantfile is ruby :D
>
> ie.
>
> http://bitcubby.com/configuring-vagrant-json-ruby/
>
> Have a look at the end there is a link to a github project.
>
> If you check projects that distribute vagrantfiles with them, you will
> find nice examples of things you can incorporate later.
>
> Alvaro
>
>
> On Thu, Mar 31, 2016 at 2:56 AM, Juan Carlos Pérez Pardo <
> [email protected]> wrote:
>
>> Hi there!
>>
>> I was thinking is maybe is possible to use several shell scripts to
>> provision the machine.
>>
>> I mean, instead to have a big one, use different ones, with the concept
>> from configuration management.
>>
>> I have a nodes. json definition as this one:
>>
>> {
>>
>> "nodes": {
>>
>> "vagrant.domain": {
>>
>> ":ip": "192.168.32.5",
>>
>> "ports": [],
>>
>> ":memory": 2048,
>>
>> "bootstrap": ["bootstrap-hosts.sh","bootstrap-centos.sh"]
>>
>> }
>>
>> }
>>
>> }
>>
>>
>>
>> And I was trying something like this in my vagrant file ….
>>
>> # vi: set ft=ruby :
>>
>>
>>
>> # Builds Puppet Master and multiple Puppet Agent Nodes using JSON config
>> file
>>
>> # Author: Gary A. Stafford
>>
>>
>>
>> # read vm and chef configurations from JSON files
>>
>> nodes_config = (JSON.parse(File.read("nodes.json")))['nodes']
>>
>>
>>
>> VAGRANTFILE_API_VERSION = "2"
>>
>>
>>
>> Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
>>
>> config.vm.box = "centos/7"
>>
>>
>>
>> nodes_config.each do |node|
>>
>> node_name = node[0] # name of node
>>
>> node_values = node[1] # content of node
>>
>>
>>
>> config.vm.define node_name do |config|
>>
>> # configures all forwarding ports in JSON array
>>
>> ports = node_values['ports']
>>
>> ports.each do |port|
>>
>> config.vm.network :forwarded_port,
>>
>> host: port[':host'],
>>
>> guest: port[':guest'],
>>
>> id: port[':id'],
>>
>> auto_correct: true
>>
>> end
>>
>>
>>
>> config.vm.hostname = node_name
>>
>> config.vm.network :private_network, ip: node_values[':ip']
>>
>>
>>
>> config.vm.provider :virtualbox do |vb|
>>
>> vb.customize ["modifyvm", :id, "--memory", node_values[':memory']]
>>
>> vb.customize ["modifyvm", :id, "--name", node_name]
>>
>> end
>>
>>
>>
>> # config.vm.provision :shell, :path => node_values[':bootstrap']
>>
>> valores = node_values['bootstrap']
>>
>> valores.each do |v|
>>
>> #puts v.upcase
>>
>> config.vm.provision :shell, path=> v.upcase
>>
>> end
>>
>> end
>>
>> end
>>
>> end
>>
>>
>>
>> Thanks!
>>
>>
>>
>>
>>
>>
>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>> IRC: #vagrant on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Vagrant" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/vagrant-up/1bea458f-88df-44eb-8f5c-feff5d2f4bf9%40googlegroups.com
>> <https://groups.google.com/d/msgid/vagrant-up/1bea458f-88df-44eb-8f5c-feff5d2f4bf9%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Vagrant" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vagrant-up/CNoO9toLiJo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezA-ajD7Vvvc22KOoizQ6Ke420VAoi_NXBUeXAU%3DnTA6w%40mail.gmail.com
> <https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezA-ajD7Vvvc22KOoizQ6Ke420VAoi_NXBUeXAU%3DnTA6w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
-----------------------------------------------------------
Juan Carlos Pérez
-----------------------------------------------------------
http://about.me/perezpardojc
-----------------------------------------------------------
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/CANRvtQWN3EMTmVT%2BRwDj%3DYARP%2B9HsE5tTak4%2BQ4-3J4b8nbsNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.