将设为首页浏览此站
开启辅助访问 天气与日历 收藏本站联系我们切换到窄版

易陆发现论坛

 找回密码
 开始注册
查看: 57|回复: 0
收起左侧

ubuntu或者debina 使用kolla-ansible 安装yoga版本

[复制链接]
发表于 2022-6-21 11:30:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?开始注册

x
1、为 Debian 或者 Ubuntu, update 相关系统包.
- |: v# a: u  Z8 `6 ^  i7 V* \1 g2 e5 y9 ]1 M) i4 \
sudo apt update
% |& N+ Q5 S2 Z, {8 H* N! [# I/ b) N* g! k
2、安装python3的环境
6 y6 I! C4 T) l  h6 L1 g, b2 R在 Debian 或者 Ubuntu, 执行:
5 F6 l% M4 f7 H8 P8 n
* i% V1 `; A: ?& ?- M

/ p9 B3 C, ~! k4 I& R* @  I$ O" \0 R8 [2 V3 e
sudo apt install python3-dev libffi-dev gcc libssl-dev
# E/ F+ I7 E* [* `0 O4 k! g: v# [. S: `
) U( Z8 m' {  @  Z/ i9 Y
Install dependencies using a virtual environment
If not installing Kolla Ansible in a virtual environment, skip this section.
" f0 n) p& G& J
Debian 或者 Ubuntu, 执行
  m: T  u0 a, |3 @! A
sudo apt install python3-venv
7 V. i! s% o' @- }- u. {
Create a virtual environment and activate it:

1 T/ F; u$ P+ b$ ]4 ^4 p+ J+ ?
python3 -m venv /path/to/venv
source /path/to/venv/bin/activate
The virtual environment should be activated before running any commands that depend on packages installed in it.

, X9 L% R+ P. I; e0 _% S
Ensure the latest version of pip is installed:

+ S9 {, m  q/ |4 ~1 O2 Q
pip install -U pip
Install Ansible. Kolla Ansible requires at least Ansible 4 and supports up to 5.
5 r  I! _, B5 j+ f& U
pip install 'ansible>=4,<6'
5 Y# K8 j$ r1 i1 ~# n
5 z: E4 \2 i: m+ n  {
Install dependencies not using a virtual environment¶
If installing Kolla Ansible in a virtual environment, skip this section.
3 M8 l# Q- q, R- h2 ~8 `
Install pip.
; w8 f6 a, j2 X2 e
" W1 v, `: R& Q1 N" g7 E
For Debian or Ubuntu, run:

. m8 K7 _) N4 E' V3 [
sudo apt install python3-pip
Ensure the latest version of pip is installed:

: |6 ~: h1 q2 ]4 X* [) @
sudo pip3 install -U pip
Install Ansible. Kolla Ansible requires at least Ansible 4 and supports up to 5.
/ m% i! I+ q( J  Z6 Z
6 Z+ }6 F9 @) @+ T1 A* _1 f& q, T! B

- ~7 \" M5 G5 K  A% a/ h* \

9 j& I5 A7 Q+ N' ]; u* n
For openEuler, run:
0 ~0 z( C6 I/ ]+ o$ ]
sudo pip install ansible

+ {+ Q- U' k+ N" O
& W  [  }% z6 E9 w
For Debian or Ubuntu, run:
1 l) E% b3 S5 |2 O1 X( ~' j9 k
sudo apt install ansible
( `( O! ^9 v* K6 z. d" W5 v
Note

5 M4 I/ D9 D3 a
If the installed Ansible version does not meet the requirements, one can use pip: sudo pip install -U 'ansible>=4,<6'. Beware system package upgrades might interfere with that so it is recommended to uninstall the system package first. One might be better off with the virtual environment method to avoid this pitfall.
5 F1 T  u! P3 K5 R
Install Kolla-ansible¶
Install Kolla-ansible for deployment or evaluation¶
Install kolla-ansible and its dependencies using pip.

: b, N$ B" K8 g
If using a virtual environment:
' `3 W* V! ~+ p$ v, T5 d
If not using a virtual environment:
1 {9 ^7 E- i* `! c  q9 E- E
Create the /etc/kolla directory.

" R+ Y4 ?& [' u
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
Copy globals.yml and passwords.yml to /etc/kolla directory.

% j  z$ H' R+ Q. [6 ?3 H3 M
If using a virtual environment:
7 o2 w1 ^" M. ~' f
cp -r /path/to/venv/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
If not using a virtual environment, run:

2 ?- r) H0 m4 T- z. n% [) |  ^+ N
cp -r /usr/local/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
Copy all-in-one and multinode inventory files to the current directory.
- W9 a: k6 }( y5 F0 B
If using a virtual environment:

5 H) }/ R6 S8 Q' I9 h+ T
cp /path/to/venv/share/kolla-ansible/ansible/inventory/* .
For all-in-one scenario in virtual environment add the following to the very beginning of the inventory:

0 I7 `3 w7 J) c6 m2 Z  r
localhost ansible_python_interpreter=python
If not using a virtual environment, run:
6 e; p4 V, P! T, c9 V
cp /usr/local/share/kolla-ansible/ansible/inventory/* .
Install Kolla for development¶
Clone kolla-ansible repository from git.
4 b4 A, @2 K" E3 Q* N
git clone --branch stable/yoga https://opendev.org/openstack/kolla-ansible
Install requirements of kolla and kolla-ansible:

$ ~9 R; T1 \. a
If using a virtual environment:
5 @* L5 ]/ |) p5 y
pip install ./kolla-ansible
If not using a virtual environment:

! W6 W5 H9 f( D; l1 Z3 v0 U0 O
sudo pip3 install ./kolla-ansible
Create the /etc/kolla directory.

, p' M9 J2 {: [/ V9 n
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
Copy the configuration files to /etc/kolla directory. kolla-ansible holds the configuration files ( globals.yml and passwords.yml) in etc/kolla.

, I/ _% w+ i  m
cp -r kolla-ansible/etc/kolla/* /etc/kolla
Copy the inventory files to the current directory. kolla-ansible holds inventory files ( all-in-one and multinode) in the ansible/inventory directory.

5 z' t  R4 s  a# |. A
cp kolla-ansible/ansible/inventory/* .

% |3 i" {: S# r1 _$ j! K  K/ I; x
7 h0 [$ g9 M1 A
Install Ansible Galaxy requirements¶
Install Ansible Galaxy dependencies (Yoga release onwards):
& i  Z9 m/ ?; ~% ^
kolla-ansible install-deps

" C  t) G6 T& I3 M8 l- D
Configure Ansible¶
For best results, Ansible configuration should be tuned for your environment. For example, add the following options to the Ansible configuration file /etc/ansible/ansible.cfg:
% s$ c3 D% o! h) K$ z1 `
[defaults]
host_key_checking=False
pipelining=True
forks=100
Further information on tuning Ansible is available here.
9 j7 G8 u+ J* V
Prepare initial configuration¶
Inventory¶
The next step is to prepare our inventory file. An inventory is an Ansible file where we specify hosts and the groups that they belong to. We can use this to define node roles and access credentials.
) X4 w) D  m% {% U! A/ q
Kolla Ansible comes with all-in-one and multinode example inventory files. The difference between them is that the former is ready for deploying single node openstack on localhost. If you need to use separate host or more than one node, edit multinode inventory:
! j. o& K1 P8 e/ @) N7 {# z# R8 M
Edit the first section of multinode with connection details of your environment, for example:

# F/ X$ ?' m+ ]3 u
[control]
10.0.0.[10:12] ansible_user=ubuntu ansible_password=foobar ansible_become=true
# Ansible supports syntax like [10:12] - that means 10, 11 and 12.
# Become clause means "use sudo".
& j; H. i4 K1 k9 A, Q6 B. ~$ i; I
[network:children]
control
# when you specify group_name:children, it will use contents of group specified.
" t2 ]0 ~4 a4 W) h7 r) ?* o
[compute]
10.0.0.[13:14] ansible_user=ubuntu ansible_password=foobar ansible_become=true

- O0 ]  H' e7 u8 D8 z. m* A: u
[monitoring]
10.0.0.10
# This group is for monitoring node.
# Fill it with one of the controllers' IP address or some others.

/ U: M% d. a9 V  N
[storage:children]
compute

7 a$ e) P5 f5 d2 M9 s
[deployment]
localhost       ansible_connection=local become=true
# use localhost and sudo
To learn more about inventory files, check Ansible documentation.
( ~" G7 V( m7 g
Check whether the configuration of inventory is correct or not, run:

, h1 t+ [; W1 s( I% g2 o
ansible -i multinode all -m ping
Note

) x) I( R) s& l% I3 D1 O, a8 R
Distributions might not come with Python pre-installed. That will cause errors in the ping module. To quickly install Python with Ansible you can run: for Debian or Ubuntu: ansible -i multinode all -m raw -a "apt -y install python3", and for CentOS, RHEL or openEuler: ansible -i multinode all -m raw -a "dnf -y install python3".

: A8 T/ `# `2 z3 R0 I; Y+ J3 o5 ?
Kolla passwords¶
Passwords used in our deployment are stored in /etc/kolla/passwords.yml file. All passwords are blank in this file and have to be filled either manually or by running random password generator:

2 f' u2 S" s1 S" z
For deployment or evaluation, run:
& J- [8 s: C/ o% N1 K
kolla-genpwd
For development, run:

; j- a$ _7 A# ~& y! R, [4 v: x% _/ Y
cd kolla-ansible/tools
./generate_passwords.py
Kolla globals.yml¶
globals.yml is the main configuration file for Kolla Ansible. There are a few options that are required to deploy Kolla Ansible:
& s1 X) a7 v, }0 o( }' X
Image options
& z  y1 x, C9 E9 B
User has to specify images that are going to be used for our deployment. In this guide Quay.io-provided, pre-built images are going to be used. To learn more about building mechanism, please refer Building Container Images.
$ U  Q( @% \9 P& P6 u
Kolla provides choice of several Linux distributions in containers:
  D5 p1 u0 h  o+ C1 s3 G
! @# J' ~5 m( V5 ]1 C1 d1 b
Ubuntu (ubuntu)
, y. L& r. {8 k# x: u/ t& B
Debian (debian)

5 I1 ]/ b" j/ }9 k% a0 l

7 Z1 B- g; p" }5 S; M9 D- b2 D3 N
For newcomers, we recommend to use Ubuntu 20.04.
# S- z( u' q/ l: Z8 H
kolla_base_distro: "ubuntu"
Next “type” of installation needs to be configured. Choices are:
  i9 d* X* |7 C+ u
binary
using repositories like apt or dnf

' G- M7 w/ p. {
source (default)
using raw source archives, git repositories or local source directory
" I$ Z8 b1 U2 c3 U
Note

7 d: q) V9 H4 b
This only affects OpenStack services. Infrastructure services are always “binary”.
  E# @  L/ p5 M. ], S
Note

% C- G. a3 J5 }' f" h0 }" v0 N  K! |
Source builds are proven to be slightly more reliable than binary.
. y" v+ @3 j2 F" V0 R
kolla_install_type: "source"
Networking

  K. a+ D6 Y% ^* c
Kolla Ansible requires a few networking options to be set. We need to set network interfaces used by OpenStack.

$ \9 S5 z, v. K( M6 C
First interface to set is “network_interface”. This is the default interface for multiple management-type networks.
4 n% A; F  Z3 M
network_interface: "eth0"
Second interface required is dedicated for Neutron external (or public) networks, can be vlan or flat, depends on how the networks are created. This interface should be active without IP address. If not, instances won’t be able to access to the external networks.

  n- b( a6 }  m0 y: J1 {& E  {2 U
neutron_external_interface: "eth1"
To learn more about network configuration, refer Network overview.

( ~, u+ g, I/ u
Next we need to provide floating IP for management traffic. This IP will be managed by keepalived to provide high availability, and should be set to be not used address in management network that is connected to our network_interface.
3 m4 S& E/ j% w9 p; G4 W+ L3 F: C9 i
kolla_internal_vip_address: "10.1.0.250"
Enable additional services
5 H) r) j" o$ g$ X
By default Kolla Ansible provides a bare compute kit, however it does provide support for a vast selection of additional services. To enable them, set enable_* to “yes”. For example, to enable Block Storage service:

% k0 b& u" Y$ j6 G
enable_cinder: "yes"
Kolla now supports many OpenStack services, there is a list of available services. For more information about service configuration, Please refer to the Services Reference Guide.

2 z, S, z# n$ I, \% M( V
Multiple globals files
2 Z7 y2 T- N# ^+ C7 `4 N+ z/ i; C
For a more granular control, enabling any option from the main globals.yml file can now be done using multiple yml files. Simply, create a directory called globals.d under /etc/kolla/ and place all the relevant *.yml files in there. The kolla-ansible script will, automatically, add all of them as arguments to the ansible-playbook command.
. c9 x; e& }& V( \
An example use case for this would be if an operator wants to enable cinder and all its options, at a later stage than the initial deployment, without tampering with the existing globals.yml file. That can be achieved, using a separate cinder.yml file, placed under the /etc/kolla/globals.d/ directory and adding all the relevant options in there.
5 e# E/ H8 p' o( [
Virtual environment

2 q2 K1 e! N: x$ u7 S
It is recommended to use a virtual environment to execute tasks on the remote hosts. This is covered Virtual Environments.
; {) o" Y0 l' t  N2 o
Deployment¶
After configuration is set, we can proceed to the deployment phase. First we need to setup basic host-level dependencies, like docker.
) q- `6 B8 t" Z6 F5 m
Kolla Ansible provides a playbook that will install all required services in the correct versions.

. a% |( p6 \' P4 G
The following assumes the use of the multinode inventory. If using a different inventory, such as all-in-one, replace the -i argument accordingly.

, Q7 d; D) ~7 ]5 l2 |; e
For deployment or evaluation, run:
3 k3 ?" W+ Q  H0 h4 h4 H
Bootstrap servers with kolla deploy dependencies:
3 U* I5 d7 [- R. C& H! k! s5 p: X
kolla-ansible -i ./multinode bootstrap-servers
Do pre-deployment checks for hosts:

5 ]  E$ W& z! y- N8 R7 o
kolla-ansible -i ./multinode prechecks
Finally proceed to actual OpenStack deployment:
1 d/ k5 z: L1 o
kolla-ansible -i ./multinode deploy
For development, run:

, J8 s+ o0 r1 D! \. E6 N8 m' i
Bootstrap servers with kolla deploy dependencies:
7 ?  r/ D9 f' Y/ [
cd kolla-ansible/tools
./kolla-ansible -i ../../multinode bootstrap-servers
Do pre-deployment checks for hosts:

; ]# B0 U" Z; S  Z+ K$ c- i" A/ c
./kolla-ansible -i ../../multinode prechecks
Finally proceed to actual OpenStack deployment:

0 U" o8 o( J9 U9 l7 ~/ U, q3 |
./kolla-ansible -i ../../multinode deploy
When this playbook finishes, OpenStack should be up, running and functional! If error occurs during execution, refer to troubleshooting guide.

% ]. H5 Y# @6 l1 S% p% A0 [
Using OpenStack¶
Install the OpenStack CLI client:
* \8 L/ \) @: e& Z6 ]5 H
pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/yoga
OpenStack requires an openrc file where credentials for admin user are set. To generate this file:

2 C& a# _" f! o+ k( x# d) l
For deployment or evaluation, run:

' b& V9 ^, S7 Z: a
kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
For development, run:
+ ^3 n4 z3 y' d
cd kolla-ansible/tools
./kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
Depending on how you installed Kolla Ansible, there is a script that will create example networks, images, and so on.

, X/ a2 V1 V" e2 k; U
Warning

* X! X2 B* Z9 v7 r- Q! Z- D7 Y
You are free to use the following init-runonce script for demo purposes but note it does not have to be run in order to use your cloud. Depending on your customisations, it may not work, or it may conflict with the resources you want to create. You have been warned.

: d" a2 O# I- g& d
For deployment or evaluation, run:
4 g, T) D. k+ h' r7 W1 b6 |
If using a virtual environment:

9 h$ T% Q  {& @7 W2 H$ v
/path/to/venv/share/kolla-ansible/init-runonce
If not using a virtual environment:
. a$ L* |# u, W7 K& v" S
/usr/local/share/kolla-ansible/init-runonce
For development, run:
7 ?3 T5 |* g" t9 t/ I
kolla-ansible/tools/init-runonce

; I5 W) M# T7 l' L0 y6 ]

; K* E. o- s' n

; c! u5 x" w3 d& c+ Y  U# Z- S" r+ g
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

如有购买积分卡请联系497906712

QQ|返回首页|Archiver|手机版|小黑屋|易陆发现 点击这里给我发消息

GMT+8, 2022-7-4 10:13 , Processed in 0.056751 second(s), 22 queries .

Powered by LR.LINUX.cloud bbs168x X3.2 Licensed

© 2012-2022 Comsenz Inc.

快速回复 返回顶部 返回列表