Adds a simple way to provision the VM from within the VM by letting Vagrant install Ansible and run it locally.
This commit is contained in:
parent
9216a85f10
commit
22c84f6122
3 changed files with 20 additions and 5 deletions
23
Vagrantfile
vendored
23
Vagrantfile
vendored
|
@ -38,12 +38,12 @@ Vagrant.configure(2) do |config|
|
||||||
#vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 1, "--nonrotational", "on"]
|
#vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 1, "--nonrotational", "on"]
|
||||||
|
|
||||||
# Set to true, if you intent to use a GUI
|
# Set to true, if you intent to use a GUI
|
||||||
vbox.gui = false
|
vbox.gui = true
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define "jbdev" do |dev|
|
config.vm.define "jbdev" do |dev|
|
||||||
dev.vm.hostname = "jbdev.local"
|
dev.vm.hostname = "jbdev.local"
|
||||||
|
|
||||||
# If you have installed the Vagrant::Hostsupdate plugin, you can add additional domains
|
# If you have installed the Vagrant::Hostsupdate plugin, you can add additional domains
|
||||||
# that should be mapped to the VM.
|
# that should be mapped to the VM.
|
||||||
#dev.hostsupdater.aliases = ["jenkins.jbdev.local", "grafana.jbdev.local"]
|
#dev.hostsupdater.aliases = ["jenkins.jbdev.local", "grafana.jbdev.local"]
|
||||||
|
@ -54,11 +54,26 @@ Vagrant.configure(2) do |config|
|
||||||
# https://www.virtualbox.org/manual/ch06.html#network_nat_service
|
# https://www.virtualbox.org/manual/ch06.html#network_nat_service
|
||||||
dev.vm.network :private_network, ip: "192.168.6.65"
|
dev.vm.network :private_network, ip: "192.168.6.65"
|
||||||
|
|
||||||
dev.vm.provision :ansible do |ansible|
|
# Provision the VM from the Vagrant host.
|
||||||
|
# The host has to have Ansible installed and will connect to the VM via SSH
|
||||||
|
# dev.vm.provision :ansible do |ansible|
|
||||||
|
# #ansible.verbose = "vvv"
|
||||||
|
# ansible.compatibility_mode = "2.0"
|
||||||
|
# ansible.playbook = "provisioning/playbook.yml"
|
||||||
|
# ansible.inventory_path = "provisioning/inventory"
|
||||||
|
# ansible.become = true
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Provision by running Ansible from within the VM.
|
||||||
|
# Vagrant will try to install Ansible automatically using pip
|
||||||
|
# Advantage: Ansible doesn't have to be installed on the Vagrant host
|
||||||
|
dev.vm.provision "ansible_local" do |ansible|
|
||||||
#ansible.verbose = "vvv"
|
#ansible.verbose = "vvv"
|
||||||
ansible.compatibility_mode = "2.0"
|
ansible.compatibility_mode = "2.0"
|
||||||
|
ansible.install_mode = "pip"
|
||||||
|
ansible.version = "2.10.3"
|
||||||
ansible.playbook = "provisioning/playbook.yml"
|
ansible.playbook = "provisioning/playbook.yml"
|
||||||
ansible.inventory_path = "provisioning/inventory"
|
#ansible.inventory_path = "provisioning/inventory"
|
||||||
ansible.become = true
|
ansible.become = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- hosts: jbdev
|
- hosts: all
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue