diff options
| author | Steven Dake <stdake@cisco.com> | 2015-10-07 23:18:40 -0700 |
|---|---|---|
| committer | Steven Dake <stdake@cisco.com> | 2015-10-07 23:47:00 -0700 |
| commit | 3b92e8714fc9a2e10cdbd73e36c05c838ba55852 (patch) | |
| tree | bb6fbc7be2f6bd8faf578b64454ba16272998392 /dev | |
| parent | e4094152de209c1444b3ea26a4abcdf28e3d1fb2 (diff) | |
| download | kolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.tar.gz kolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.zip | |
Move around the development environments
THe top level dev directory is now used to store the heat and
vagrant development environments.
backport: liberty
TrivialFix
Change-Id: Ib0922b90eacaa8518aee09cdeb46f4ac0437e015
Diffstat (limited to 'dev')
| -rwxr-xr-x | dev/heat/get-image.sh | 41 | ||||
| -rw-r--r-- | dev/heat/kollacluster.yaml | 120 | ||||
| -rw-r--r-- | dev/heat/kollanode.yaml | 251 | ||||
| -rw-r--r-- | dev/heat/local.yaml.example | 5 | ||||
| -rw-r--r-- | dev/vagrant/Vagrantfile | 168 | ||||
| -rw-r--r-- | dev/vagrant/bootstrap.sh | 154 |
6 files changed, 739 insertions, 0 deletions
diff --git a/dev/heat/get-image.sh b/dev/heat/get-image.sh new file mode 100755 index 000000000..21166301e --- /dev/null +++ b/dev/heat/get-image.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# This script expects the following to be installed: +# curl, libguestfs-tools-c + +IMAGE_URL=http://archive.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64 +IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2 +TARGET_DIR=/var/lib/libvirt/images +TARGET=fedora-21-x86_64 +export LIBGUESTFS_BACKEND=direct + +if ! [ -f "$IMAGE" ]; then + echo "Downloading $IMAGE" + curl -L -O $IMAGE_URL/$IMAGE +fi + +echo "Copying $IMAGE to $TARGET" +cp "$IMAGE" $TARGET_DIR/$TARGET + + +TMPFILE=$(mktemp /tmp/kolla-ifcfg-eth1.XXXXXXXXXX) +cat > $TMPFILE <<EOF +DEVICE=eth1 +BOOTPROTO=none +ONBOOT=yes +DEFROUTE=no +EOF + + +virt-customize \ + --add $TARGET_DIR/$TARGET \ + --upload $TMPFILE:/etc/sysconfig/network-scripts/ifcfg-eth1 + +# SELinux relabeling requires virt-customize to have networking disabled +# https://bugzilla.redhat.com/show_bug.cgi?id=1122907 +virt-customize --add $TARGET_DIR/$TARGET --selinux-relabel --no-network + +rm -f $TMPFILE + +echo "Finished building image:" +ls -l $TARGET_DIR/$TARGET diff --git a/dev/heat/kollacluster.yaml b/dev/heat/kollacluster.yaml new file mode 100644 index 000000000..bfc7554cd --- /dev/null +++ b/dev/heat/kollacluster.yaml @@ -0,0 +1,120 @@ +heat_template_version: 2013-05-23 + +description: > + This template will boot a Kolla cluster with one or more + nodes (as specified by the number_of_nodes parameter, + which defaults to "1"). + +parameters: + # + # REQUIRED PARAMETERS + # + ssh_key_name: + type: string + description: name of ssh key to be provisioned on the Nova instances + + external_network_id: + type: string + description: uuid of a network to use for aaccessing Kolla hosts by floating ip address + + container_external_network_id: + type: string + description: uuid of a network to use for container floating ip addresses + + container_external_subnet_id: + type: string + description: uuid of a subnet to use for container floating ip addresses + + # + # OPTIONAL PARAMETERS + # + server_image: + type: string + default: fedora-21-x86_64 + description: glance image used to boot the Nova instance + + server_flavor: + type: string + default: m1.small + description: flavor to use when booting the Nova instance + + dns_nameserver: + type: string + description: address of a dns nameserver reachable in your environment + default: 8.8.8.8 + + number_of_nodes: + type: string + description: how many kolla nodes to spawn + default: 1 + + fixed_network_cidr: + type: string + description: network range for fixed ip network + default: 10.0.0.0/24 + +resources: + + ###################################################################### + # + # network resources. allocate a network and router for our server. + # it would also be possible to take advantage of existing network + # resources (and have the deployer provide network and subnet ids, + # etc, as parameters), but I wanted to minmize the amount of + # configuration necessary to make this go. + fixed_network: + type: "OS::Neutron::Net" + + # This is the subnet on which we will deploy our server eth0. + fixed_subnet: + type: "OS::Neutron::Subnet" + properties: + cidr: {get_param: fixed_network_cidr} + network_id: + get_resource: fixed_network + dns_nameservers: + - get_param: dns_nameserver + + # create a router attached to the external network provided as a + # parameter to this stack. + extrouter: + type: "OS::Neutron::Router" + properties: + external_gateway_info: + network: + get_param: external_network_id + + # attached fixed_subnet to our extrouter router. + extrouter_inside: + type: "OS::Neutron::RouterInterface" + properties: + router_id: + get_resource: extrouter + subnet_id: + get_resource: + fixed_subnet + + kolla_nodes: + type: "OS::Heat::ResourceGroup" + depends_on: + - extrouter_inside + properties: + count: {get_param: number_of_nodes} + resource_def: + type: kollanode.yaml + properties: + ssh_key_name: {get_param: ssh_key_name} + server_image: {get_param: server_image} + server_flavor: {get_param: server_flavor} + fixed_network_id: {get_resource: fixed_network} + fixed_subnet_id: {get_resource: fixed_subnet} + external_network_id: {get_param: external_network_id} + container_external_network_id: {get_param: container_external_network_id} + container_external_subnet_id: {get_param: container_external_subnet_id} +outputs: + + kolla_node_internal_ip: + value: {get_attr: [kolla_nodes, kolla_node_ip_eth0]} + + kolla_node_external_ip: + value: {get_attr: [kolla_nodes, kolla_node_external_ip]} diff --git a/dev/heat/kollanode.yaml b/dev/heat/kollanode.yaml new file mode 100644 index 000000000..ce809e4ed --- /dev/null +++ b/dev/heat/kollanode.yaml @@ -0,0 +1,251 @@ +heat_template_version: 2013-05-23 + +description: > + This is a nested stack that defines a single Kolla node, + based on a Fedora 21 cloud image. This stack is included by + a ResourceGroup resource in the parent template (kollacluster.yaml). + +parameters: + + server_image: + type: string + default: fedora-21-x86_64 + description: glance image used to boot the server + + server_flavor: + type: string + default: m1.small + description: flavor to use when booting the server + + ssh_key_name: + type: string + description: name of ssh key to be provisioned on our server + + external_network_id: + type: string + description: uuid of a network to use for kolla host floating ip addresses + + container_external_network_id: + type: string + description: uuid of a network to use for container floating ip addresses + + container_external_subnet_id: + type: string + description: uuid of a subnet to use for container floating ip addresses + + # The following are all generated in the parent template. + fixed_network_id: + type: string + description: Network from which to allocate fixed addresses. + fixed_subnet_id: + type: string + description: Subnet from which to allocate fixed addresses. + +resources: + + node_wait_handle: + type: "AWS::CloudFormation::WaitConditionHandle" + + node_wait_condition: + type: "AWS::CloudFormation::WaitCondition" + depends_on: + - kolla_node + properties: + Handle: + get_resource: node_wait_handle + Timeout: "6000" + + ###################################################################### + # + # security groups. we need to permit network traffic of various + # sorts. + # + secgroup_base: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: icmp + - protocol: tcp + port_range_min: 22 + port_range_max: 22 + + # Use by eth1 to permit all traffic to instances. + # Let the Neutron container apply security to this traffic. + secgroup_all_open: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: icmp + - protocol: tcp + - protocol: udp + + secgroup_kolla: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: tcp + port_range_min: 5672 + port_range_max: 5672 + - protocol: tcp + port_range_min: 3306 + port_range_max: 3306 + - protocol: tcp + port_range_min: 8773 + port_range_max: 8776 + - protocol: tcp + port_range_min: 6080 + port_range_max: 6080 + - protocol: tcp + port_range_min: 6081 + port_range_max: 6081 + - protocol: tcp + port_range_min: 35357 + port_range_max: 35357 + - protocol: tcp + port_range_min: 5000 + port_range_max: 5000 + - protocol: tcp + port_range_min: 9191 + port_range_max: 9191 + - protocol: tcp + port_range_min: 9292 + port_range_max: 9292 + - protocol: tcp + port_range_min: 9696 + port_range_max: 9696 + - protocol: tcp + port_range_min: 80 + port_range_max: 80 + - protocol: tcp + port_range_min: 443 + port_range_max: 443 + - protocol: tcp + port_range_min: 8000 + port_range_max: 8000 + - protocol: tcp + port_range_min: 8004 + port_range_max: 8004 + - protocol: tcp + port_range_min: 8003 + port_range_max: 8003 + - protocol: tcp + port_range_min: 8080 + port_range_max: 8080 + - protocol: tcp + port_range_min: 8777 + port_range_max: 8777 + + kolla_node: + type: "OS::Nova::Server" + properties: + image: + get_param: server_image + flavor: + get_param: server_flavor + key_name: + get_param: ssh_key_name + user_data_format: RAW + user_data: + str_replace: + template: | + #!/bin/bash + + # Latest packages + yum clean all + yum -y update + + # Remove network manager + yum -y remove NetworkManager + chkconfig network on + + # Install base packages + yum -y install wget ntp git tcpdump python-pip python-devel + + # Install Docker from binaries + curl -L https://get.docker.com/builds/Linux/x86_64/docker-1.7.0 -o /usr/local/sbin/docker + chmod +x /usr/local/sbin/docker && cd /usr/local/sbin/ + ./docker -d & + + # Install Compose with pid=host support + cd /root + git clone http://github.com/docker/compose.git + cd compose + pip install -e . + + # Pull the Kolla repo + cd /root + git clone https://github.com/openstack/kolla.git + + # Add vxlan kernel module for Neutron + modprobe vxlan + + # Start NTP + systemctl enable ntpd + systemctl start ntpd + + # Install mariadb-client + yum install -y mariadb + + # Install OpenStack Clients + yum install -y python-keystoneclient python-glanceclient \ + python-novaclient python-cinderclient \ + python-neutronclient python-heatclient + + # Disable firewalld per OpenStack documentation + service firewalld stop + chkconfig firewalld off + + # Install Magnum Client + git clone http://github.com/openstack/python-magnumclient + cd python-magnumclient + sudo pip install -e . + + # Send the CFN signal + cfn-signal -e0 --data 'OK' -r 'Setup complete' '$WAIT_HANDLE' + params: + "$WAIT_HANDLE": + get_resource: node_wait_handle + networks: + - port: + get_resource: kolla_node_eth0 + - port: + get_resource: kolla_node_eth1 + + kolla_node_eth0: + type: "OS::Neutron::Port" + properties: + network_id: + get_param: fixed_network_id + security_groups: + - get_resource: secgroup_base + - get_resource: secgroup_kolla + fixed_ips: + - subnet_id: + get_param: fixed_subnet_id + + kolla_node_eth1: + type: "OS::Neutron::Port" + properties: + network_id: + get_param: container_external_network_id + security_groups: + - get_resource: secgroup_all_open + fixed_ips: + - subnet_id: + get_param: container_external_subnet_id + + kolla_node_floating: + type: "OS::Neutron::FloatingIP" + properties: + floating_network_id: + get_param: external_network_id + port_id: + get_resource: kolla_node_eth0 + +outputs: + + kolla_node_ip_eth0: + value: {get_attr: [kolla_node_eth0, fixed_ips, 0, ip_address]} + + kolla_node_external_ip: + value: {get_attr: [kolla_node_floating, floating_ip_address]} diff --git a/dev/heat/local.yaml.example b/dev/heat/local.yaml.example new file mode 100644 index 000000000..8f76cd835 --- /dev/null +++ b/dev/heat/local.yaml.example @@ -0,0 +1,5 @@ +parameters: + ssh_key_name: <YOUR_NOVA_KEYPAIR> + external_network_id: <NEUTRON_EXTERNAL_NET_ID> + container_external_network_id: <NEUTRON_EXTERNAL_NET_ID2> + container_external_subnet_id: <NEUTRON_EXTERNAL_SUBNETNET_ID2> diff --git a/dev/vagrant/Vagrantfile b/dev/vagrant/Vagrantfile new file mode 100644 index 000000000..c2c1d7f68 --- /dev/null +++ b/dev/vagrant/Vagrantfile @@ -0,0 +1,168 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +require "ipaddr" + +# Either libvirt or virtualbox +PROVIDER = "libvirt" + +PROVIDER_DEFAULTS = { + libvirt: { + base_image: "centos/7", + bridge_interface: "virbr0", + vagrant_shared_folder: "/home/vagrant/sync", + sync_method: "nfs", + }, + virtualbox: { + base_image: "puppetlabs/centos-7.0-64-puppet", + bridge_interface: "wlp3s0b1", + vagrant_shared_folder: "/vagrant", + sync_method: "virtualbox", + }, +} + +# Whether to do Multi-node or All-in-One deployment +MULTINODE=false + +# The following is only used when deploying in Multi-nodes +NUMBER_OF_CONTROL_NODES=3 +NUMBER_OF_COMPUTE_NODES=1 +NUMBER_OF_STORAGE_NODES=1 +NUMBER_OF_NETWORK_NODES=1 + +# Configure a new SSH key and config so the operator is able to connect with +# the other cluster nodes. +unless File.file?("./vagrantkey") + system("ssh-keygen -f ./vagrantkey -N '' -C this-is-vagrant") +end + +def get_default(setting) + PROVIDER_DEFAULTS[PROVIDER.to_sym][setting] +end + +Vagrant.configure(2) do |config| + config.vm.box = get_default(:base_image) + + # Next to the hostonly NAT-network there is a host-only network with all + # nodes attached. Plus, each node receives a 3rd adapter connected to the + # outside public network. + config.vm.network "private_network", type: "dhcp" + config.vm.network "public_network", dev: get_default(:bridge_interface), mode: 'bridge', type: 'bridge' + + my_privatekey = File.read(File.join(File.dirname(__FILE__), "vagrantkey")) + my_publickey = File.read(File.join(File.dirname(__FILE__), "vagrantkey.pub")) + + config.vm.provision :shell, inline: <<-EOS + mkdir -p /root/.ssh + echo '#{my_privatekey}' > /root/.ssh/id_rsa + chmod 600 /root/.ssh/id_rsa + echo '#{my_publickey}' > /root/.ssh/authorized_keys + chmod 600 /root/.ssh/authorized_keys + echo '#{my_publickey}' > /root/.ssh/id_rsa.pub + chmod 644 /root/.ssh/id_rsa.pub + mkdir -p /home/vagrant/.ssh + echo '#{my_privatekey}' >> /home/vagrant/.ssh/id_rsa + chmod 600 /home/vagrant/.ssh/* + echo 'Host *' > ~vagrant/.ssh/config + echo StrictHostKeyChecking no >> ~vagrant/.ssh/config + chown -R vagrant: /home/vagrant/.ssh + EOS + + config.hostmanager.enabled = true + # Make sure hostmanager picks IP address of eth1 + config.hostmanager.ip_resolver = proc do |vm, resolving_vm| + case PROVIDER + when "libvirt" + if vm.name + `virsh -c qemu:///system net-dhcp-leases vagrant-private-dhcp | awk -F'[ /]+' '/#{vm.name} / {print $6}'`.chop + end + when "virtualbox" + if vm.id + `VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP"`.split()[1] + end + end + end + + # The operator controls the deployment + config.vm.define "operator" do |admin| + admin.vm.hostname = "operator.local" + admin.vm.provision :shell, path: "bootstrap.sh", args: "operator #{MULTINODE ? 'multinode' : 'aio'}" + admin.vm.synced_folder "..", "/home/vagrant/kolla", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder "storage/operator/", "/data/host", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + admin.vm.provider PROVIDER do |vm| + vm.memory = MULTINODE ? 1024 : 4096 + if PROVIDER == 'libvirt' + # This only works with libvirt provider. + # We should be able to do something similar for virtualbox + # http://askubuntu.com/questions/317338/how-can-i-increase-disk-size-on-a-vagrant-vm + vm.machine_virtual_size = 40 + end + end + admin.hostmanager.aliases = "operator" + end + + if MULTINODE + # Build compute nodes + (1..NUMBER_OF_COMPUTE_NODES).each do |i| + config.vm.define "compute0#{i}" do |compute| + compute.vm.hostname = "compute0#{i}.local" + compute.vm.provision :shell, path: "bootstrap.sh" + compute.vm.synced_folder "storage/compute/", "/data/host", create:"True", type: get_default(:sync_method) + compute.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + compute.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + compute.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + compute.hostmanager.aliases = "compute0#{i}" + end + end + + # Build storage nodes + (1..NUMBER_OF_STORAGE_NODES).each do |i| + config.vm.define "storage0#{i}" do |storage| + storage.vm.hostname = "storage0#{i}.local" + storage.vm.provision :shell, path: "bootstrap.sh" + storage.vm.synced_folder "storage/storage/", "/data/host", create:"True", type: get_default(:sync_method) + storage.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + storage.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + storage.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + storage.hostmanager.aliases = "storage0#{i}" + end + end + + # Build network nodes + (1..NUMBER_OF_NETWORK_NODES).each do |i| + config.vm.define "network0#{i}" do |network| + network.vm.hostname = "network0#{i}.local" + network.vm.provision :shell, path: "bootstrap.sh" + network.vm.synced_folder "storage/network/", "/data/host", create:"True", type: get_default(:sync_method) + network.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + network.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + network.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + network.hostmanager.aliases = "network0#{i}" + end + end + + # Build control nodes + (1..NUMBER_OF_CONTROL_NODES).each do |i| + config.vm.define "control0#{i}" do |control| + control.vm.hostname = "control0#{i}.local" + control.vm.provision :shell, path: "bootstrap.sh" + control.vm.synced_folder "storage/control/", "/data/host", create:"True", type: get_default(:sync_method) + control.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + control.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + control.vm.provider PROVIDER do |vm| + vm.memory = 2048 + end + control.hostmanager.aliases = "control0#{i}" + end + end + end + +end diff --git a/dev/vagrant/bootstrap.sh b/dev/vagrant/bootstrap.sh new file mode 100644 index 000000000..889942922 --- /dev/null +++ b/dev/vagrant/bootstrap.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# +# Bootstrap script to configure all nodes. +# + +export http_proxy= +export https_proxy= + +if [ $2 = 'aio' ]; then + # Run registry on port 4000 since it may collide with keystone when doing AIO + REGISTRY_PORT=4000 + SUPPORT_NODE=operator +else + REGISTRY_PORT=5000 + SUPPORT_NODE=support01 +fi +REGISTRY=operator.local:${REGISTRY_PORT} + +# Install common packages and do some prepwork. +function prep_work { + systemctl stop firewalld + systemctl disable firewalld + + # This removes the fqdn from /etc/hosts's 127.0.0.1. This name.local will + # resolve to the public IP instead of localhost. + sed -i -r "s/^(127\.0\.0\.1\s+)(.*) `hostname` (.+)/\1 \3/" /etc/hosts + + yum install -y http://mirror.nl.leaseweb.net/epel/7/x86_64/e/epel-release-7-5.noarch.rpm + yum install -y MySQL-python vim-enhanced python-pip python-devel gcc openssl-devel libffi-devel libxml2-devel libxslt-devel && yum clean all + pip install --upgrade docker-py +} + +# Install and configure a quick&dirty docker daemon. +function install_docker { + # Allow for an externally supplied docker binary. + if [ -f "/data/docker" ]; then + cp /vagrant/docker /usr/bin/docker + chmod +x /usr/bin/docker + else + cat >/etc/yum.repos.d/docker.repo <<-EOF +[dockerrepo] +name=Docker Repository +baseurl=https://yum.dockerproject.org/repo/main/centos/7 +enabled=1 +gpgcheck=1 +gpgkey=https://yum.dockerproject.org/gpg +EOF + # Also upgrade device-mapper here because of: + # https://github.com/docker/docker/issues/12108 + yum install -y docker-engine device-mapper + + # Despite it shipping with /etc/sysconfig/docker, Docker is not configured to + # load it from it's service file. + sed -i -r "s,(ExecStart)=(.+),\1=/usr/bin/docker -d --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}," /usr/lib/systemd/system/docker.service + + systemctl daemon-reload + systemctl enable docker + systemctl start docker + fi + + usermod -aG docker vagrant +} + +function resize_partition { + fdisk /dev/vda <<EOF +n +p + + +t + +8e +w +EOF + partprobe + pvcreate /dev/vda4 + vgextend VolGroup00 /dev/vda4 + lvextend /dev/VolGroup00/LogVol00 /dev/vda4 + resize2fs /dev/VolGroup00/LogVol00 +} + +function configure_kolla { + # Use local docker registry + sed -i -r "s,^[# ]*namespace.+$,namespace = ${REGISTRY}/lokolla," /etc/kolla/kolla-build.conf + sed -i -r "s,^[# ]*docker_registry:.+$,docker_registry: \"${REGISTRY}\"," /etc/kolla/globals.yml + sed -i -r "s,^[# ]*docker_namespace:.+$,docker_namespace: \"lokolla\"," /etc/kolla/globals.yml + sed -i -r "s,^[# ]*docker_insecure_registry:.+$,docker_insecure_registry: \"True\"," /etc/kolla/globals.yml + # Set network interfaces + sed -i -r "s,^[# ]*network_interface:.+$,network_interface: \"eth1\"," /etc/kolla/globals.yml + sed -i -r "s,^[# ]*neutron_external_interface:.+$,neutron_external_interface: \"eth2\"," /etc/kolla/globals.yml +} + +# Configure the operator node and install some additional packages. +function configure_operator { + yum install -y git mariadb && yum clean all + pip install --upgrade ansible python-openstackclient + + pip install ~vagrant/kolla + + # Note: this trickery requires a patched docker binary. + if [ "$http_proxy" = "" ]; then + su - vagrant sh -c "echo BUILDFLAGS=\\\"--build-env=http_proxy=$http_proxy --build-env=https_proxy=$https_proxy\\\" > ~/kolla/.buildconf" + fi + + cp -r ~vagrant/kolla/etc/kolla/ /etc/kolla + mkdir -p /usr/share/kolla + chown -R vagrant: /etc/kolla /usr/share/kolla + + configure_kolla + + # Make sure Ansible uses scp. + cat > ~vagrant/.ansible.cfg <<EOF +[defaults] +forks=100 + +[ssh_connection] +scp_if_ssh=True +EOF + chown vagrant: ~vagrant/.ansible.cfg + + # The openrc file. + cat > ~vagrant/openrc <<EOF +export OS_AUTH_URL="http://${SUPPORT_NODE}:35357/v2.0" +export OS_USERNAME=admin +export OS_PASSWORD=password +export OS_TENANT_NAME=admin +export OS_VOLUME_API_VERSION=2 +EOF + chown vagrant: ~vagrant/openrc + + + # Launch a local registry (and mirror) to speed up pulling images. + # 0.9.1 is actually the _latest_ tag. + if [[ ! $(docker ps -a -q -f name=registry) ]]; then + docker run -d \ + --name registry \ + --restart=always \ + -p $REGISTRY_PORT:5000 \ + -e STANDALONE=True \ + -e MIRROR_SOURCE=https://registry-1.docker.io \ + -e MIRROR_SOURCE_INDEX=https://index.docker.io \ + -e STORAGE_PATH=/var/lib/registry \ + -v /data/host/registry-storage:/var/lib/registry \ + registry:0.9.1 + fi +} + +prep_work +install_docker + +if [ "$1" = "operator" ]; then + resize_partition + configure_operator +fi |
