From dbe49b2d6eeddc3726270c1cdd0ce93848bbac5c Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Wed, 30 Dec 2020 12:45:38 +0100
Subject: Add Ubuntu Bionic image to the DevStack instance
Image "cirros-0.5.1-x86_64-disk" will no longer be suitable for testing
ONAP infrastructure deployment because it lacks Python interpreter.
Python is required for provisioning ONAP infrastructure VMs using
Ansible.
Issue-ID: INT-1601
Change-Id: I68aa4d941350b1abf32b4d2bc00cbee489af6587
Signed-off-by: Pawel Wieczorek
---
.../infra-openstack/ansible/group_vars/all.yml.sample | 4 ++--
deployment/noheat/infra-openstack/vagrant/Vagrantfile | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
(limited to 'deployment')
diff --git a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample
index 07488aa57..5a7defeec 100644
--- a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample
+++ b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample
@@ -12,8 +12,8 @@ securitygroup:
hosts:
- name: "operator0"
- image: "cirros-0.5.1-x86_64-disk"
- flavor: "cirros256"
+ image: "Ubuntu_18.04"
+ flavor: "m1.tiny"
keypair: *keypair_name
network: *network_name
securitygroup: *securitygroup_name
diff --git a/deployment/noheat/infra-openstack/vagrant/Vagrantfile b/deployment/noheat/infra-openstack/vagrant/Vagrantfile
index 3bb009338..96f640e95 100644
--- a/deployment/noheat/infra-openstack/vagrant/Vagrantfile
+++ b/deployment/noheat/infra-openstack/vagrant/Vagrantfile
@@ -11,6 +11,8 @@ os_clouds_dir = "${HOME}/.config/openstack"
os_clouds_config = "#{os_clouds_dir}/clouds.yaml"
os_admin = "admin"
os_user = "demo"
+image_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
+image_name = "Ubuntu_18.04"
vm_cpu = 1
vm_cpus = 4
@@ -40,7 +42,7 @@ devstack = {
all = [] << operation << devstack
-operation_post_msg = "Run: \"vagrant provision #{operation[:name]} --provision-with=run_playbook_create\" to complete infrastructure deployment"
+operation_post_msg = "Run: \"vagrant provision #{operation[:name]} --provision-with=add_os_image,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
@@ -81,6 +83,15 @@ $create_os_clouds = <<-SCRIPT
OS_USERNAME="$user" envsubst < "$template" > "$config"
SCRIPT
+$add_os_image = <<-SCRIPT
+ url="$1"
+ name="$2"
+ image="$(mktemp)"
+ wget --quiet --output-document="$image" "$url"
+ export OS_CLOUD=openstack
+ openstack image create "$name" --public --disk-format qcow2 --container-format bare --file "$image"
+SCRIPT
+
$run_playbook = <<-SCRIPT
PLAYBOOK="$1"
export OS_CLOUD=openstack
@@ -136,6 +147,10 @@ Vagrant.configure("2") do |config|
end
config.vm.post_up_message = operation_post_msg
+ config.vm.provision "add_os_image", type: :shell, run: "never" do |s|
+ s.inline = $add_os_image
+ s.args = [image_url, image_name]
+ end
config.vm.provision "run_playbook_create", type: :shell, run: "never" do |s|
s.privileged = false
s.inline = $run_playbook
--
cgit