Introduce vagrant for devstack

This update is for providing a dedicated devstack installer for Tacker.
It is configurable for supporting several usecases, such as multiple
nodes configuration. It's also supports both of default distros in
OpenStack, Ubuntu 20.04 (focal) and CentOS Stream 8 currently.
You can find usages in the contributor guide `Devstack Installation
with Vagrant`.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
Implements: bp intro-tacker-installer
Change-Id: I2f9fcf0811c41d9278df79b5a7e60d608d23cd76
This commit is contained in:
Yasufumi Ogawa 2022-02-25 02:46:20 +09:00
parent 163d8040d0
commit 9c9a31e4f5
47 changed files with 1836 additions and 0 deletions

View File

@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="176mm"
height="160mm"
viewBox="0 0 176 160"
version="1.1"
id="svg8"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="vagrant-devstack.svg">
<defs
id="defs2">
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0"
refX="0"
id="Arrow1Send"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path4829"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#ffa300;fill-opacity:1;fill-rule:evenodd;stroke:#ffa300;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Sstart"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path4844"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(0.3,0,0,0.3,-0.69,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0"
refX="0"
id="marker5154"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path5152"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.8,0,0,0.8,10,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lstart"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path4814"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.8,0,0,0.8,10,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lstart"
style="overflow:visible"
inkscape:isstock="true">
<path
id="path4832"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0"
refX="0"
id="Arrow1Send-9"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4829-8"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
style="fill:#ffa300;fill-opacity:1;fill-rule:evenodd;stroke:#ffa300;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(-0.2,0,0,-0.2,-1.2,0)" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.49497475"
inkscape:cx="304.8945"
inkscape:cy="285.65626"
inkscape:document-units="mm"
inkscape:current-layer="layer5"
showgrid="false"
inkscape:window-width="1848"
inkscape:window-height="1016"
inkscape:window-x="72"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="background"
inkscape:groupmode="layer"
id="layer1"
style="display:inline"
transform="translate(0,-137)">
<rect
style="fill:#fefff9;fill-opacity:1;stroke:#000000;stroke-width:0.47126091;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4563"
width="166.59186"
height="150.34195"
x="4.961967"
y="142.53836" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="servers"
style="display:inline"
transform="translate(0,-137)">
<rect
id="rect4538"
width="109.02974"
height="71.047653"
x="33.642315"
y="156.63867"
style="fill:#d1f5f9;fill-opacity:1;stroke:#000000;stroke-width:0.39287427;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="repos"
style="display:inline"
transform="translate(0,-137)">
<rect
style="fill:#f4f9ff;fill-opacity:1;stroke:#000000;stroke-width:0.29142606;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4618"
width="118.44099"
height="13.863992"
x="26.711658"
y="272.39877" />
<rect
style="fill:#f4f9ff;fill-opacity:1;stroke:#000000;stroke-width:0.44882673;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4618-6"
width="75.787743"
height="51.391594"
x="50.260628"
y="169.40025" />
<rect
style="fill:#ffd9d8;fill-opacity:1;stroke:#000000;stroke-width:0.17194323;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4705"
width="44.489826"
height="15.633057"
x="33.650661"
y="252.97849"
ry="5.9911447" />
<rect
style="display:inline;fill:#ffd9d8;fill-opacity:1;stroke:#000000;stroke-width:0.17194323;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4705-5"
width="44.489826"
height="15.633057"
x="95.598396"
y="252.97849"
ry="5.9911451" />
<path
style="fill:none;stroke:#ffa300;stroke-width:2.14662099;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Send)"
d="M 67.568397,250.02499 V 234.42506"
id="path4812"
inkscape:connector-curvature="0" />
<path
style="display:inline;fill:none;stroke:#ffa300;stroke-width:1.989182;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Send-9)"
d="M 111.16053,250.58422 V 225.60084"
id="path4812-4"
inkscape:connector-curvature="0" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="fonts"
transform="translate(0,-137)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="10.077556"
y="150.88284"
id="text4572"><tspan
sodipodi:role="line"
id="tspan4570"
x="10.077556"
y="150.88284"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">host</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="39.523827"
y="165.75533"
id="text4572-7"><tspan
sodipodi:role="line"
id="tspan4570-7"
x="39.523827"
y="165.75533"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">VM</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="32.280151"
y="281.51773"
id="text4572-3"><tspan
sodipodi:role="line"
id="tspan4570-9"
x="32.280151"
y="281.51773"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">/path/to/tacker/vagrant/devstack</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="54.079391"
y="177.88329"
id="text4572-4"><tspan
sodipodi:role="line"
id="tspan4570-8"
x="54.079391"
y="177.88329"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">/opt/stack/devstack</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="87.50042"
y="186.8896"
id="text4572-4-1"><tspan
sodipodi:role="line"
id="tspan4570-8-2"
x="87.50042"
y="186.8896"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">tacker</tspan><tspan
sodipodi:role="line"
x="87.50042"
y="195.59059"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
id="tspan4697">nova</tspan><tspan
sodipodi:role="line"
x="87.50042"
y="204.29158"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
id="tspan4699">neutron</tspan><tspan
sodipodi:role="line"
x="87.50042"
y="212.99257"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
id="tspan4701">....</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="42.858124"
y="262.18088"
id="text4572-39"><tspan
sodipodi:role="line"
id="tspan4570-0"
x="42.858124"
y="262.18088"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">vagrant</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="105.7557"
y="262.59879"
id="text4572-39-8"><tspan
sodipodi:role="line"
id="tspan4570-0-8"
x="105.7557"
y="262.59879"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">ansible</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="22.144638"
y="243.18124"
id="text4572-39-0"><tspan
sodipodi:role="line"
id="tspan4570-0-9"
x="22.144638"
y="243.18124"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"> Manage VMs</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="114.56652"
y="240.20192"
id="text4572-39-6"><tspan
sodipodi:role="line"
id="tspan4810"
x="114.56652"
y="240.20192">Install required</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="114.68044"
y="247.20377"
id="text4572-39-6-8"><tspan
style="stroke-width:0.26458332"
sodipodi:role="line"
id="tspan4810-1"
x="114.68044"
y="247.20377">packages in VM</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -30,6 +30,7 @@ Developer Info
api_extensions.rst
tacker_functional_test.rst
dashboards.rst
vagrant_devstack.rst
Code Documentation
------------------

View File

@ -0,0 +1,209 @@
..
Copyright (C) 2022 Nippon Telegraph and Telephone Corporation
All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Devstack Installation with Vagrant
==================================
This documentation is for introducing a deployment tool for Tacker.
You can find a :doc:`basic installation </install/devstack>` for deploying
OpenStack environment using ``devstack`` as a part of
:doc:`Tacker Installation Guide</install/index>`.
This guide expects you have already setup your VMs and installed all
packages required to run OpenStack.
However, it's something annoying for beginners, or developers frequently
cleanup their environment. You may want to use a tool to shortcut such a
tasks. This tool enables you to deploy several usecases with minimal effort.
How to Use
----------
Install Required Tools
~~~~~~~~~~~~~~~~~~~~~~
This installer consists of ``vagrant`` and ``ansible``.
Please follow instructions on official sites for installation.
* `vagrant <https://learn.hashicorp.com/tutorials/vagrant/getting-started-install>`_
* `ansible <https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html>`_
.. note::
In this documentation, it's supposed you use
`VirtualBox <https://www.virtualbox.org/>`_, but you can use any other
hypervisor supported by ``vagrant``.
.. figure:: ../_images/vagrant-devstack.svg
:scale: 55
You should install plugin ``vagrant-disksize`` before launching your VMs
to enable to expand size of volume of VMs. It is because the default size
of box is fixed and not enough for deploying Tacker.
.. code-block:: console
$ vagrant plugin install vagrant-disksize
Setup Configuration File
~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
Create your ssh key before running this tool to enable to direct login
with auto-generated ssh config although you can still do two step login
starts from ``vagrant ssh``. You can login to ``controller`` host with
auto-generated config ``ssh_config`` as below.
.. code-block:: console
$ ssh -F ssh_config controller
Setup ``machines.yml`` which is a config file defines parameters of each
VM you deploy.
You can find some templates of ``machines.yml`` in ``samples`` directory.
This config file should be placed at ``/path/to/tacker/vagrant/devstack``
while running ``vagrant up``, or failed to run the command.
.. code-block:: console
$ cd /path/to/tacker/vagrant/devstack
$ cp samples/machines.yml ./
$ YOUR_FAVORITE_EDITOR machines.yml
As named as ``machines.yml``, it defines parameters of each VMs.
There are two top sections in the file, ``global`` and ``machines``.
The former one defines common parameters among the VMs, and later one
is for each VM.
.. note::
``global`` is optional currently and only one parameter under the section
is ``ssh_pub_key`` for specifying its location explicitly. You don't need
to use it if your public key is ``$HOME/.ssh/id_rsa.pub``.
Here is an example of ``machine.yml``. It's is for single node usecase
and ``machines`` has only one entry.
.. literalinclude:: ../../../vagrant/devstack/samples/machines.yml
:language: yaml
There are several parameters for each VM supported in this tool.
.. list-table::
:widths: 30 125
:header-rows: 1
* - Attribute
- Description
* - hostname
- Any hostname for convenience, such as ``controller`` or ``compute``.
* - provider
- Vagrant box provider.
* - box
- Name of the box.
* - nof_cpus
- The number of CPUs assigned to the VM.
* - mem_size
- The size of memory assigned to the VM.
* - disk_size
- The size of disk assigned to the VM.
* - private_ips
- Series of private IPs.
* - public_ips
- Series of public IPs.
* - fwd_port_list
- Series of combination of ``guest`` and ``host`` ports for port
forwarding.
You also update entries of IP addresses in the inventory file
``hosts`` as you defined each ``private_ips`` in ``machines.yml``.
Now, you are ready to fire up the VMs and deploying OpenStack with
``ansible``.
Deploy OpenStack with Devstack
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run ``vagrant up`` so that launches VMs and create ``stack`` user on them.
.. code-block:: console
$ vagrant up
If ``vagrant up`` is completed successfully, you can login to the VMs as
``stack`` user with your ssh public key.
This tool provides ``ansible`` playbooks for setting up ``devstack``
installation. You don't need to modify the playbooks usually, but
configurable in ``group_vars/all.yml``. See :ref:`optional_config`
describing how you configure the file.
.. code-block:: console
$ ansible-playbook -i hosts site.yml
After finished all tasks, you can login to the launched VMs. So, login to
controller node and run ``stack.sh`` for installing OpenStack.
You will find out that ``local.conf`` is already prepared for your
environment.
See instruction how to configure ``local.conf`` described in
`DevStack Quick Start <https://docs.openstack.org/devstack/latest/>`_
if you customize it furthermore by yourself.
.. code-block:: console
$ ssh stack@192.168.33.11
$ cd devstack
$ YOUR_FAVORITE_EDITOR local.conf
$ ./stack.sh
.. _optional_config:
Options Configuration
~~~~~~~~~~~~~~~~~~~~~
There some parameters in ``group_vars/all.yml`` such as password on
devstack or optional configurations. You don't need to update it usually.
.. literalinclude:: ../../../vagrant/devstack/group_vars/all.yml
:language: yaml
Developer Tools
---------------
In the playbools, installation of vim and some extra packages is included
for developers. If you exclude such a developer tools, modify
``group_vars/all.yml`` before running ``ansible-playbook`` command.
.. list-table::
:widths: 30 125
:header-rows: 1
* - Parameter
- Description
* - use_vim_latest
- (Only for ubuntu) ``true`` or ``false`` for using the latest vim.
* - use_vim_extra_plugins
- ``true`` or ``false`` for installing vim packages including
language servers for python and bash.
* - use_extra_tools
- | ``true`` or ``false`` for using extra packages bellow.
| - jq
| - htop (Ubuntu only)
| - lnav (Ubuntu only)

9
vagrant/devstack/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
/machines.yml
/helper/git_setup.sh
/.vagrant/*
*.log
# except auto-generated file.
roles/**/controller/templates/gitconfig.j2
ssh_config

View File

@ -0,0 +1,83 @@
# vagrant-devstack
## What is this
Deployment tool for devstack for testing multi-VM OpenStack environment,
consists of vagrant and ansible.
It only supports Ubuntu on VirtualBox currently.
## How to use
### Requirements
You need to install required software before running this tool. Please follow
instructions on official sites for installation.
* [VirtualBox](https://www.virtualbox.org/)
* [vagrant](https://www.vagrantup.com/)
* [ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
Before launching your VMs, you should should install plugin `vagrant-disksize`
for expanding size of volume of VM. It is because the default size of box
provided from Ubuntu, 10GB or so, is not enough for deploying devstack
environment. It's required for expanding the volume size.
```sh
$ vagrant plugin install vagrant-disksize
```
### Configure and Fire Up VMs
Before launching VMs with vagrant, configure `machines.yml`, which defines
parameters of each VM you deploy. It should be placed at project root, or failed
to run `vagrant up`. You can use template files in `samples` directory.
```sh
$ cp samples/machines.yml .
$ YOUR_FAVORITE_EDITOR machines.yml
```
You should take care about `private_ips` which is used in `hosts` for
`ansible-playbook` as explained later.
You should confirm you have a SSH public key before you run vagrant. If your key
is different from `~/.ssh/id_rsa.pub`, update `ssh_pub_key` in `machines.yml`.
Run `vagrant up` after configurations are done. It launches VMs and create a
user `stack` on them.
```sh
$ vagrant up
```
If `vagrant up` is completed successfully, you are ready to login to VMs as
`stack` user with your SSH public key.
### Setup Devstack
This tool provides ansible playbooks for setting up devstack. You should update
entries of IP addresses in `hosts` as you defined `private_ips` in
`machines.yml`.
There are some parameters in `group_vars/all.yml` such as password on devstack
or optional configurations. You don't need to update it usually.
```sh
$ ansible-playbook -i hosts site.yml
```
After finished ansible's tasks, you can login to launched VMs. So, login to
controller node and run `stack.sh` for installing OpenStack. You will find that
`local.conf` is prepared for your environment by using its example.
See instruction how to configure `local.conf` described in
[DevStack Quick Start](https://docs.openstack.org/devstack/latest/)
if you customize it by yourself.
```sh
$ ssh stack@192.168.33.11
$ cd devstack
$ YOUR_FAVORITE_EDITOR local.conf
$ ./stack.sh
```

119
vagrant/devstack/Vagrantfile vendored Normal file
View File

@ -0,0 +1,119 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
require "yaml"
load "lib/machine.rb"
load "lib/vd_utils.rb"
vd_config = YAML.load(open("machines.yml"))
ssh_pub_key = VdUtils.ssh_pub_key(vd_config)
machines = Machines.new(vd_config["machines"])
# Check if you have already downloaded target box.
box_list = []
`vagrant box list`.each_line {|l|
box_list << l.split(" ")[0]
}
# If you don't have the box, download it.
machines.each do |m|
if not (box_list.include? m.box)
puts "There is no box '#{m.box}' for '#{m.provider}'"
puts "Run 'vagrant box add #{m.box}' first"
end
end
Vagrant.configure("2") do |config|
machines.each do |machine|
config.vm.define machine.hostname do |server|
server.vm.box = machine.box
server.vm.hostname = machine.hostname
# server.vm.box_check_update = false
machine.private_ips.each do |ipaddr|
server.vm.network "private_network", ip: ipaddr
end
if machine.public_ips != nil
machine.public_ips.each do |ipaddr|
server.vm.network "public_network", ip: ipaddr
end
end
if machine.fwd_port_list != nil
machine.fwd_port_list.each do |fp|
["tcp", "udp"].each do |prot|
server.vm.network "forwarded_port",
guest: fp["guest"], host: fp["host"],
auto_correct: true, protocol: prot
end
end
end
if Vagrant.has_plugin?("vagrant-proxyconf")
server.proxy.http = ENV["http_proxy"]
server.proxy.https = ENV["https_proxy"]
if ENV["no_proxy"] != ""
server.proxy.no_proxy = ENV["no_proxy"] +
"," + machine.private_ips.join(",")
end
end
if Vagrant.has_plugin?("vagrant-disksize")
server.disksize.size = "#{machine.disk_size}GB"
end
# TODO(yasufum) This configuration reported in [1] is required to avoid
# timeout for ssh login to focal64 because of setting up public key in the
# VM. This issue is only happened on focal, and not for bionic and xenial.
# Remove this config after the problem is fixed in the focal image.
# [1] https://bugs.launchpad.net/cloud-images/+bug/1829625
if machine.box == "ubuntu/focal64"
server.vm.provider 'virtualbox' do |v|
v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
v.customize ["modifyvm", :id, "--uartmode1", "file", "./ttyS0.log"]
end
end
if machine.ssh_forward_x11 == true
server.ssh.forward_x11 = true
end
server.vm.provider machine.provider do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
#vb.customize ["modifyhd", "disk id", "--resize", "size in megabytes"]
vb.cpus = "#{machine.nof_cpus}"
vb.memory = "#{machine.mem_size * 1024}"
end
# NOTE: remove `python3-launchpadlib` which causes many warinings, and
# run autoremove to clean related packages.
server.vm.provision "shell", inline: <<-SHELL
useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
# Permission of `stack` directory is 0700 on CentOS 8, but it cause an
# error in a sanity check for the permission while running devstack
# installatino.
chmod 755 /opt/stack
mkdir -p /opt/stack/.ssh
echo "#{ssh_pub_key}" >> /opt/stack/.ssh/authorized_keys
chown -R stack:stack /opt/stack/.ssh
SHELL
VdUtils.setup_git_config
VdUtils.setup_ssh_config(vd_config)
end
end
end

View File

@ -0,0 +1,5 @@
[defaults]
deprecation_warnings = False
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

View File

@ -0,0 +1,28 @@
---
# 1. Devstack params
# common
admin_password: devstack
database_password: devstack
rabbit_password: devstack
service_password: devstack
# controller
service_token: devstack
# compute nodes
service_host: 192.168.33.11
floating_range: 192.168.33.128/25
fixed_range: 10.4.128.0/20
# 2. Configure optional tools on controller node
# Use the latest vim on `ppa:jonathonf/vim`, and use plugins with
# vim-plug.
use_vim_latest: true
use_vim_extra_plugins: true
# Clone tacker in addition to devstack.
use_tacker: true
# Use tools useful for developing.
use_extra_tools: true

View File

@ -0,0 +1,7 @@
#!/bin/sh
sudo apt-get build-dep vagrant ruby-libvirt -y
sudo apt-get install qemu libvirt-bin ebtables dnsmasq-base -y
sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev -y
vagrant plugin install vagrant-libvirt

9
vagrant/devstack/hosts Normal file
View File

@ -0,0 +1,9 @@
[ubuntu-focal.controller]
192.168.33.11
[ubuntu-focal.compute]
#192.168.33.12
#192.168.33.13
[centos-stream8.controller]
#192.168.33.11

View File

@ -0,0 +1,38 @@
require "yaml"
class Machines < Array
class Machine
attr_reader :hostname, :provider, :box, :nof_cpus, :mem_size, :disk_size,
:private_ips, :public_ips, :ssh_forward_x11, :fwd_port_list
def initialize(
hostname="controller", provider="virtualbox", box="ubuntu/focal64",
nof_cpus=2, mem_size=4, disk_size=10,
private_ips=["192.168.33.11"], public_ips=nil, ssh_forward_x11=false,
fwd_port_list=nil)
@hostname = hostname
@provider = provider
@box = box
@nof_cpus = nof_cpus
@mem_size = mem_size
@disk_size = disk_size
@private_ips = private_ips
@public_ips = public_ips
@ssh_forward_x11 = ssh_forward_x11
@fwd_port_list = fwd_port_list
end
end
def initialize(machines_attr)
machines_attr.each_with_index do |m, idx|
self[idx] = Machine.new(
m["hostname"], m["provider"], m["box"],
m["nof_cpus"], m["mem_size"], m["disk_size"],
m["private_ips"], m["public_ips"],
m["ssh_forward_x11"],
m["fwd_port_list"])
end
end
end

View File

@ -0,0 +1,13 @@
boxes:
ubuntu:
"20.04":
virtualbox: ubuntu/focal64
"18.04":
virtualbox: ubuntu/bionic64
libvirt: generic/ubuntu1804
"16.04":
virtualbox: ubuntu/xenial64
libvirt: yk0/ubuntu-xenial
centos:
stream8:
virtualbox: centos/stream8

View File

@ -0,0 +1,79 @@
# Util method in vagrant-devstack
require "fileutils"
module VdUtils
# Get the contents of SSH public key to upload it to VMs.
def ssh_pub_key(config)
default_key_path = "~/.ssh/id_rsa.pub"
if config["global"] != nil
if config["global"]["ssh_pub_key"]
key_path = File.expand_path(
config["global"]["ssh_pub_key"].gsub("$HOME", "~"))
end
end
key_path = File.expand_path(default_key_path) if key_path == nil
begin
ssh_pub_key = open(key_path).read.chomp
rescue => e
puts e
end
return ssh_pub_key
end
def setup_git_config()
src = "~/.gitconfig"
Dir.glob("roles/**/controller").each do |target_dir|
dst = "#{target_dir}/templates/gitconfig.j2"
gitconfig = File.expand_path src
if File.exists? gitconfig
FileUtils.copy(gitconfig, dst)
end
end
end
# Generate local ssh config file used by ssh with `-F` option.
def setup_ssh_config(config)
dst = File.expand_path "#{__dir__}/../ssh_config"
if config["machines"] != nil
entries = []
config["machines"].each do |m|
entries << {"Host" => m["hostname"],
"HostName" => m["private_ips"][0],
"User" => "stack"}
end
str = ""
entries.each do |ent|
ent.each do |k, v|
if k == "Host"
str += "#{k} #{v}\n"
else
str += " #{k} #{v}\n"
end
end
end
str.chomp
str += "Host *\n" +
" StrictHostKeyChecking no\n" +
" UserKnownHostsFile=/dev/null\n"
open(dst, "w+") {|f|
f.write(str)
}
end
end
module_function :ssh_pub_key, :setup_git_config, :setup_ssh_config
end

View File

@ -0,0 +1,6 @@
---
- include: basic_pkgs.yml
tags: basic_pkgs
- include: devstack.yml
tags: devstack

View File

@ -0,0 +1,22 @@
[[local|localrc]]
HOST_IP={{ ansible_host }}
FIXED_RANGE={{ fixed_range }}
FLOATING_RANGE={{ floating_range }}
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD={{ admin_password }}
DATABASE_PASSWORD={{ database_password }}
RABBIT_PASSWORD={{ rabbit_password }}
SERVICE_PASSWORD={{ service_password }}
DATABASE_TYPE=mysql
SERVICE_HOST={{ service_host }}
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
ENABLED_SERVICES=n-cpu,q-agt,c-vol,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_lite.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN

View File

@ -0,0 +1,14 @@
---
- name: install basic packages
become: yes
yum: name={{ item }} update_cache=yes
with_items:
- python3
- python3-devel
- python3-pip
- git
- vim
- name: install git-review with pip
become: yes
pip: name=git-review

View File

@ -0,0 +1,22 @@
---
- name: update git config
git_config:
scope: global
name: 'url.https://.insteadOf'
value: 'git://'
- name: git clone devstack
git:
repo=https://opendev.org/openstack/devstack.git
dest={{ ansible_env.HOME }}/devstack
- name: install os-testr
become: yes
pip:
name: os-testr
state: latest
- name: install tox
become: yes
pip:
name: tox

View File

@ -0,0 +1,6 @@
---
- name: install extra packages
become: yes
yum: name={{ item }}
with_items:
- jq

View File

@ -0,0 +1,4 @@
---
- name: copy .gitconfig on host to VM
template: src=templates/gitconfig.j2 dest={{ ansible_env.HOME }}/.gitconfig
mode=664

View File

@ -0,0 +1,10 @@
---
- name: put yum repo for k8s
become: yes
template: src=templates/kubernetes.repo.j2
dest=/etc/yum.repos.d/kubernetes.repo
mode=755
- name: install k8s
become: yes
dnf: name=kubeadm update_cache=yes

View File

@ -0,0 +1,21 @@
---
- include: basic_pkgs.yml
- include: set_path_env.yml
- include: git_config.yml
- include: python3_specific_vers.yml
- include: vim_extra_plugins.yml
when: use_vim_extra_plugins == true
- include: kubernetes.yml
- include: ovn.yml
- include: devstack.yml
- include: setup_tacker.yml
when: use_tacker == true
- include: extra_tools.yml
when: use_extra_tools == true

View File

@ -0,0 +1,24 @@
---
- name: install ovn via centos-openstack
become: yes
yum: name={{ item }} update_cache=yes
with_items:
- centos-release-openstack-victoria
- name: install ovn
become: yes
yum: name={{ item }} update_cache=yes
with_items:
- openvswitch
- openvswitch-ovn-common
- openvswitch-ovn-central
- openvswitch-ovn-host
- name: activate ovs and ovn
become: yes
systemd: enabled=yes state=started name={{ item }}
with_items:
- ovn-northd.service
- ovn-controller.service
- ovs-vswitchd.service
- ovsdb-server.service

View File

@ -0,0 +1,9 @@
---
- name: install python3 other than default version
become: yes
yum: name={{ item }}
with_items:
- python38
- python38-devel
- python39
- python39-devel

View File

@ -0,0 +1,5 @@
---
- name: set PATH for '.local/bin'
lineinfile:
line="export PATH=$HOME/.local/bin:$PATH:/sbin"
dest={{ ansible_env.HOME }}/.bashrc

View File

@ -0,0 +1,65 @@
---
- name: git clone tacker
git:
repo=https://opendev.org/openstack/tacker.git
dest={{ ansible_env.HOME }}/tacker
- name: copy local.conf
shell: cp {{ ansible_env.HOME }}/tacker/devstack/{{ item }} \
{{ ansible_env.HOME }}/devstack/{{ item }}
with_items:
- local.conf.example
- local.conf.kubernetes
- name: update HOST_IP in devstack/local.conf.example
lineinfile:
path={{ ansible_env.HOME }}/devstack/{{ item }}
line='HOST_IP={{ ansible_host }}'
regexp='^HOST_IP=127\.0\.0\.1'
with_items:
- local.conf.example
- local.conf.kubernetes
- name: update other params in devstack/local.conf.example
lineinfile:
path={{ ansible_env.HOME }}/devstack/local.conf.example
line={{ item.line }}
regexp={{ item.regexp }}
with_items:
- line: 'ADMIN_PASSWORD={{ admin_password }}'
regexp: '^ADMIN_PASSWORD=devstack'
- line: 'MYSQL_PASSWORD={{ database_password }}'
regexp: '^MYSQL_PASSWORD=devstack'
- line: 'RABBIT_PASSWORD={{ rabbit_password }}'
regexp: '^RABBIT_PASSWORD=devstack'
- line: 'SERVICE_PASSWORD={{ service_password }}'
regexp: '^SERVICE_PASSWORD=\$ADMIN_PASSWORD'
- line: 'SERVICE_TOKEN={{ service_token }}'
regexp: '^SERVICE_TOKEN=devstack'
- name: update HOST_IP in devstack/local.conf.kubernetes
lineinfile:
path={{ ansible_env.HOME }}/devstack/local.conf.kubernetes
line='HOST_IP={{ service_host }}'
regexp='^HOST_IP=127\.0\.0\.1'
- name: update other params in devstack/local.conf.kubernetes
lineinfile:
path={{ ansible_env.HOME }}/devstack/local.conf.kubernetes
line={{ item.line }}
regexp={{ item.regexp }}
with_items:
- line: 'ADMIN_PASSWORD={{ admin_password }}'
regexp: '^ADMIN_PASSWORD=devstack'
- line: 'MYSQL_PASSWORD={{ database_password }}'
regexp: '^MYSQL_PASSWORD=devstack'
- line: 'RABBIT_PASSWORD={{ rabbit_password }}'
regexp: '^RABBIT_PASSWORD=devstack'
- line: 'SERVICE_PASSWORD={{ service_password }}'
regexp: '^SERVICE_PASSWORD=\$ADMIN_PASSWORD'
- line: 'SERVICE_TOKEN={{ service_token }}'
regexp: '^SERVICE_TOKEN=devstack'
- name: use local.conf.example as local.conf
shell: cp {{ ansible_env.HOME }}/devstack/local.conf.example \
{{ ansible_env.HOME }}/devstack/local.conf

View File

@ -0,0 +1,35 @@
---
- name: create dir for plug.vim
file: path={{ ansible_env.HOME }}/.vim/autoload state=directory
- name: download plug.vim
get_url: url=https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest={{ ansible_env.HOME }}/.vim/autoload/plug.vim
- name: vimrc
template: src=templates/vimrc.j2 dest={{ ansible_env.HOME }}/.vimrc
mode=664
- name: install exuberant-ctags
become: yes
yum: name=ctags
- name: install npm
become: yes
yum: name=npm
- name: install bash-language-server
become: yes
npm:
name: bash-language-server
global: yes
# required for python-language-server
- name: install gcc-c++
become: yes
yum: name=gcc-c++
- name: install python-language-server
become: yes
pip:
name: python-language-server[all]

View File

@ -0,0 +1,7 @@
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

View File

@ -0,0 +1,159 @@
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
"Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
"Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
Plug 'nsf/gocode'
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
let g:fzf_command_prefix = 'Fzf'
" Unmanaged plugin (manually installed and updated)
"Plug '~/my-prototype-plugin'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'thinca/vim-quickrun'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'flazz/vim-colorschemes'
Plug 'thinca/vim-quickrun'
Plug 'jpo/vim-railscasts-theme'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
let g:vim_markdown_folding_disabled = 1
Plug 'dense-analysis/ale'
Plug 'vim-scripts/taglist.vim'
let Tlist_Use_Right_Window = 1
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'natebosch/vim-lsc'
Plug 'thomasfaingnaert/vim-lsp-snippets'
Plug 'thomasfaingnaert/vim-lsp-ultisnips'
let g:lsp_async_completion = 1
Plug 'tyru/current-func-info.vim'
Plug 'yasufum/vim-os-unittestr'
" Initialize plugin system
call plug#end()
syntax on
set number
set relativenumber
set shiftwidth=4
set tabstop=4
set expandtab
set showcmd
set showmatch
set hlsearch
set laststatus=2
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8
set autoindent
set scrolloff=4
set smartcase
set textwidth=80
set colorcolumn=+1
set visualbell t_vb=
set noerrorbells
set path+=**
set wildmenu
colorscheme delek
"colorscheme railscasts
autocmd FileType python set textwidth=79
autocmd FileType gitcommit set textwidth=72
nnoremap ; <CR>
nnoremap <C-n> :NERDTreeToggle<CR>
" enable line numbers
let NERDTreeShowLineNumbers=1
" make sure relative line number is used
autocmd FileType nerdtree setlocal relativenumber
""" Open vimrc from ':Conf' command.
function! s:open_vimrc() abort
new ~/.vimrc
endfunction
command! Conf call s:open_vimrc()
function! s:configure_lsp() abort
setlocal omnifunc=lsp#complete
nnoremap <buffer> <C-]> :<C-u>LspDefinition<CR>
nnoremap <buffer> <C-h> :<C-u>LspHover<CR>
"nnoremap <buffer> <C-@> <C-t>
nnoremap <buffer> <C-l>d :<C-u>LspDefinition<CR>
nnoremap <buffer> <C-l>r :<C-u>LspReferences<CR>
nnoremap <buffer> <C-l>t :<C-u>LspTypeDefinition<CR>
nnoremap <buffer> <C-l>s :<C-u>LspDocumentSymbol<CR>
nnoremap <buffer> <C-l>S :<C-u>LspWorkspaceSymbol<CR>
nnoremap <buffer> <C-l>f :<C-u>LspDocumentFormat<CR>
vnoremap <buffer> <C-l>f :<C-u>LspDocumentRangeFormat<CR>
nnoremap <buffer> <C-l>h :<C-u>LspHover<CR>
nnoremap <buffer> <C-l>i :<C-u>LspImplementation<CR>
nnoremap <buffer> <C-l>e :<C-u>LspNextError<CR>
nnoremap <buffer> <C-l>E :<C-u>LspPreviousError<CR>
nnoremap <buffer> <C-l>N :<C-u>LspRename<CR>
endfunction
" Do ALE diagnostic
let g:lsp_diagnostics_enabled = 0
if executable('pyls')
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': { server_info -> ['pyls'] },
\ 'whitelist': ['python'],
\ 'workspace_config': {'pyls': {'plugins': {
\ 'pycodestyle': {'enabled': v:false},
\ 'jedi_definition': {'follow_imports': v:true, 'follow_builtin_imports': v:true},}}}
\})
"autocmd BufWritePre *.py LspDocumentFormatSync
autocmd FileType python call s:configure_lsp()
endif
if executable('bash-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'bash-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'bash-language-server start']},
\ 'whitelist': ['sh'],
\ })
"autocmd BufWritePre *.sh LspDocumentFormatSync
autocmd FileType sh call s:configure_lsp()
endif

View File

@ -0,0 +1,6 @@
---
- name: install basic packages
become: yes
apt: name={{ item }} update_cache=yes
with_items:
- git

View File

@ -0,0 +1,15 @@
---
- name: update git config
git_config:
scope: global
name: 'url.https://.insteadOf'
value: 'git://'
- name: git clone devstack
git:
repo=https://opendev.org/openstack/devstack.git
dest={{ ansible_env.HOME }}/devstack
- name: put local.conf
template: src=templates/local.conf.j2 dest={{ ansible_env.HOME }}/devstack/local.conf
mode=665

View File

@ -0,0 +1,6 @@
---
- include: basic_pkgs.yml
tags: basic_pkgs
- include: devstack.yml
tags: devstack

View File

@ -0,0 +1,22 @@
[[local|localrc]]
HOST_IP={{ ansible_host }}
FIXED_RANGE={{ fixed_range }}
FLOATING_RANGE={{ floating_range }}
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD={{ admin_password }}
DATABASE_PASSWORD={{ database_password }}
RABBIT_PASSWORD={{ rabbit_password }}
SERVICE_PASSWORD={{ service_password }}
DATABASE_TYPE=mysql
SERVICE_HOST={{ service_host }}
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
ENABLED_SERVICES=n-cpu,c-vol,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_lite.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN

View File

@ -0,0 +1,16 @@
---
- name: install basic packages
become: yes
apt: name={{ item }} update_cache=yes
with_items:
- python3
- python3-dev
- python3-pip
- bridge-utils
- git
- git-review
- name: upgrade apt packages
become: yes
apt:
upgrade: safe

View File

@ -0,0 +1,20 @@
---
- name: update git config
git_config:
scope: global
name: 'url.https://.insteadOf'
value: 'git://'
- name: git clone devstack
git:
repo=https://opendev.org/openstack/devstack.git
dest={{ ansible_env.HOME }}/devstack
- name: install os-testr
pip:
name: os-testr
state: latest
- name: install tox
pip:
name: tox

View File

@ -0,0 +1,8 @@
---
- name: install extra packages
become: yes
apt: name={{ item }}
with_items:
- jq
- htop
- lnav

View File

@ -0,0 +1,4 @@
---
- name: copy .gitconfig on host to VM
template: src=templates/gitconfig.j2 dest={{ ansible_env.HOME }}/.gitconfig
mode=664

View File

@ -0,0 +1,23 @@
---
# Without removing this package, failed to install while running scripts.
- include: remove_useless_pkgs.yml
- include: basic_pkgs.yml
- include: set_path_env.yml
- include: git_config.yml
- include: python3_specific_vers.yml
- include: vim_latest.yml
when: use_vim_latest == true
- include: vim_extra_plugins.yml
when: use_vim_extra_plugins == true
- include: devstack.yml
- include: setup_tacker.yml
when: use_tacker == true
- include: extra_tools.yml
when: use_extra_tools == true

View File

@ -0,0 +1,9 @@
---
- name: install python3 other than default version
become: yes
apt: name={{ item }}
with_items:
- python3.8
- python3.8-dev
- python3.9
- python3.9-dev

View File

@ -0,0 +1,11 @@
---
- name: remove useless python3-launchpadlib
become: yes
apt: