aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat/infra-openstack/vagrant/Vagrantfile
diff options
context:
space:
mode:
Diffstat (limited to 'deployment/noheat/infra-openstack/vagrant/Vagrantfile')
-rw-r--r--deployment/noheat/infra-openstack/vagrant/Vagrantfile26
1 files changed, 25 insertions, 1 deletions
diff --git a/deployment/noheat/infra-openstack/vagrant/Vagrantfile b/deployment/noheat/infra-openstack/vagrant/Vagrantfile
index f797675ae..c3b5d9819 100644
--- a/deployment/noheat/infra-openstack/vagrant/Vagrantfile
+++ b/deployment/noheat/infra-openstack/vagrant/Vagrantfile
@@ -1,6 +1,8 @@
# -*- mode: ruby -*-
# -*- coding: utf-8 -*-
+host_folder_ansible = "../ansible"
+synced_folder_ansible = "/ansible"
synced_folder_main = "/vagrant"
synced_folder_config = "#{synced_folder_main}/config"
os_config = "#{synced_folder_config}/local.conf"
@@ -33,6 +35,8 @@ devstack = {
all = [] << operation << devstack
+operation_post_msg = "Run: \"vagrant provision #{operation[:name]} --provision-with=run_playbook_create\" to complete infrastructure deployment"
+
$enable_ipv6 = <<-SCRIPT
sed -i'' 's/net.ipv6.conf.all.disable_ipv6.*$/net.ipv6.conf.all.disable_ipv6 = 0/' /etc/sysctl.conf
sysctl -p
@@ -53,7 +57,7 @@ $setup_py = <<-SCRIPT
curl -fsSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo -H python3 get-pip.py
- pip install python-openstackclient
+ pip install ansible python-openstackclient
mkdir -p #{os_clouds_dir}
SCRIPT
@@ -64,6 +68,13 @@ $link_file = <<-SCRIPT
ln -sf "$src" "$dst"
SCRIPT
+$run_playbook = <<-SCRIPT
+ PLAYBOOK="$1"
+ export OS_CLOUD=openstack
+ cd #{synced_folder_ansible}
+ ansible-playbook "$PLAYBOOK"
+SCRIPT
+
Vagrant.configure("2") do |config|
all.each do |machine|
config.vm.define machine[:name] do |config|
@@ -95,6 +106,7 @@ Vagrant.configure("2") do |config|
if machine[:name] == 'operator'
config.vm.synced_folder ".", synced_folder_main, type: "rsync", rsync__exclude: "Vagrantfile"
+ config.vm.synced_folder host_folder_ansible, synced_folder_ansible, type: "rsync"
config.vm.provision "setup_openstacksdk", type: :shell, privileged: false, inline: $setup_py
config.vm.provision "link_os_clouds", type: :shell, run: "always" do |s|
@@ -102,6 +114,18 @@ Vagrant.configure("2") do |config|
s.inline = $link_file
s.args = [os_clouds, os_clouds_dir]
end
+
+ config.vm.post_up_message = operation_post_msg
+ config.vm.provision "run_playbook_create", type: :shell, run: "never" do |s|
+ s.privileged = false
+ s.inline = $run_playbook
+ s.args = "create.yml"
+ end
+ config.vm.provision "run_playbook_destroy", type: :shell, run: "never" do |s|
+ s.privileged = false
+ s.inline = $run_playbook
+ s.args = "destroy.yml"
+ end
end
end
end