使用Ansible,在CentOS 7上安装Terraform和terraform-provider-openstack

使用Ansible在CentOS 7上安装Terraform和terraform-provider-openstack。

如果你对Terraform还不太了解的话,我建议你阅读以下内容:
– Terraform简介
– 在AWS上进行Terraform简易教程
– Terraform入门日语翻译

作出的背景

    • Terraformとterraform-provider-openstackを手動でインストールするのが面倒なので、自動化したかったため。

 

    Terraformを実行するために必要な各ディレクトリ/ファイルの作成を手動で行うのが面倒だったため。

采用OpenStack的原因

    • AWSアカウントを作成しなくてもよいため

 

    • 無料で触れるため

 

    触り慣れているため

关于OpenStack的安装方法请参见本文的最后部分。

目标群体

    • CentOS 7 に、Terraformをインストールしたい方

 

    OpenStack環境を使用して、Terraform のハンズオンをやってみたい方

前提条件

    • Ansible、OpenStackはインストール済みであるとする

 

    • config、inventoryの設定は完了済みであるとする

 

    • 鍵生成、鍵交換、疎通確認は完了済みであるとする

 

    proxy環境下ではないものとする

运行环境

# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
# ansible --version
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

这份playbook所执行的工作概要

    • Terraformのインストールに必要なパッケージのインストール

 

    • Terraform, terraform-provider-openstackのインストール

 

    • ディレクトリの作成

 

    • variables.tfファイルの作成

 

    • config.tfvarsファイルの作成

 

    main.tfファイルの作成

有关Terraform的目录结构

etc
┗ terraform
    ┗ create_instance
        ┣ variables.tf    # 変数について記述したファイル
        ┣ config.tfvars   # OpenStack環境について記述したファイル
        ┗ main.tf         # 実際に設定を流し込むファイル

收集创建Terraform文件所需的信息。

将所需的信息事先获取到config.tfvars和main.tf文件中。需要信息的项目由★标记出来。

[root@localhost ~(keystone_admin)]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
    export OS_USERNAME=admin                        ★
    export OS_PASSWORD='XXXXXXXXXXXXXXXX'           ★
    export OS_REGION_NAME=RegionOne                 ★
    export OS_AUTH_URL=http://10.0.2.15:5000/v3     ★
    export PS1='[\u@\h \W(keystone_admin)]\$ '

export OS_PROJECT_NAME=admin                        ★
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
[root@localhost playbook(keystone_admin)]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 3740fbf0-8a76-436c-b6c6-cd5911b075c0 | cirros | active |  ★
+--------------------------------------+--------+--------+
[root@localhost playbook(keystone_admin)]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1  | m1.tiny   |   512 |    1 |         0 |     1 | True      |
| 2  | m1.small  |  2048 |   20 |         0 |     1 | True      |
| 3  | m1.medium |  4096 |   40 |         0 |     2 | True      |   ★
| 4  | m1.large  |  8192 |   80 |         0 |     4 | True      |
| 5  | m1.xlarge | 16384 |  160 |         0 |     8 | True      |
+----+-----------+-------+------+-----------+-------+-----------+
[root@localhost playbook(keystone_admin)]# openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 0565b7af-e2df-4e4c-bc36-029644a7a264 | public  | 7ea01a72-a1ea-4d16-8f27-94b8cead354b |   ★
| fbf715d6-1a9b-481d-8502-a47d4d14f972 | private | 024d5fda-15a0-401b-81ae-c4f2d5a6f012 |
+--------------------------------------+---------+--------------------------------------+
[root@localhost playbook(keystone_admin)]# openstack security group list
+--------------------------------------+---------+--------------------------------+----------------------------------+------+
| ID                                   | Name    | Description                    | Project                          | Tags |
+--------------------------------------+---------+--------------------------------+----------------------------------+------+
| 108af9da-8362-404f-afe0-c7d9f104560f | default | デフォルトセキュリティグループ    |                                  | []   |
| 338f9c48-be68-4c2b-9b8d-6b71c8be8d65 | default | デフォルトセキュリティグループ    | 7e5e37477f8d4eb89fec3676f387f576 | []   |
| 65e22d65-11d1-48f8-87fb-3c51d191136c | default | デフォルトセキュリティグループ    | 7cd74def839441039d70421318eddc7b | []   |
+--------------------------------------+---------+--------------------------------+----------------------------------+------+

创建剧本

根据收集的信息,使用blockinfile模块来创建文件。

- name: Setup Terraform
  hosts: localhost
  vars:
    download_files:
    - https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
    - https://releases.hashicorp.com/terraform-provider-openstack/1.24.0/terraform-provider-openstack_1.24.0_linux_amd64.zip
    terraform_directory:
    - /etc/terraform
    - /etc/terraform/create_instance
  tasks:
  - name: Install a list of packages
    yum:
      name:
        - wget
        - unzip
      state: latest

  - name: Unarchive a file that needs to be downloaded
    unarchive:
      src: "{{ item }}"
      dest: /usr/local/bin
      mode: '0755'
      remote_src: yes
    with_items: "{{ download_files }}"

  - name: Create a directory
    file:
      path: "{{ item }}"
      owner: root
      group: root
      state: directory
    with_items: "{{ terraform_directory }}"

  - name: Insert/Update variables.tf in /etc/terraform/create_instance
    blockinfile:
      path: /etc/terraform/create_instance/variables.tf
      create: yes
      marker: ""
      block: |
        variable "openstack_project_name" { description = "Project Name" }
        variable "openstack_user_name" { description = "OpenStack User Name" }
        variable "openstack_password" { description = "OpenStack Password" }
        variable "openstack_auth_url" { description = "Auth URL" }
        variable "openstack_region" { description = "Region" }

  - name: Insert/Update config.tfvars in /etc/terraform/create_instance
    blockinfile:
      path: /etc/terraform/create_instance/config.tfvars
      create: yes
      marker: ""
      block: |
        openstack_project_name = "admin"
        openstack_user_name    = "admin"
        openstack_password     = "XXXXXXXXXXXXXXXX"
        openstack_auth_url     = "http://10.0.2.15:5000/v3"
        openstack_region       = "RegionOne"

  - name: Insert/Update main.tf /etc/terraform/create_instance
    blockinfile:
      path: /etc/terraform/create_instance/main.tf
      create: yes
      marker: ""
      block: |
        provider "openstack" {
          tenant_name = "${var.openstack_project_name}"
          user_name   = "${var.openstack_user_name}"
          password    = "${var.openstack_password}"
          auth_url    = "${var.openstack_auth_url}"
          region      = "${var.openstack_region}"
        }

        resource "openstack_compute_instance_v2" "tr-test-server" {
          name            = "tf-test-server"
          image_id        = "3740fbf0-8a76-436c-b6c6-cd5911b075c0"
          flavor_id       = "3"
          key_pair        = ""
          security_groups = ["default"]
          network {
            name = "public"
          }
        }

执行ansible-playbook

[root@localhost playbook(keystone_admin)]# ansible-playbook SetupTerraform.yml -v
Using /etc/ansible/ansible.cfg as config file

PLAY [Setup Terraform] ************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************
ok: [127.0.0.1]

TASK [Install a list of packages] *************************************************************************************************
ok: [127.0.0.1] => changed=false 
  changes:
    installed: []
    updated: []
  msg: ''
  rc: 0
  results:
  - All packages providing wget are up to date
  - All packages providing unzip are up to date
  - ''

TASK [Unarchive a file that needs to be downloaded] *******************************************************************************
changed: [127.0.0.1] => (item=https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip) => changed=true 
  ansible_loop_var: item
  dest: /usr/local/bin
  extract_results:
    cmd:
    - /usr/bin/unzip
    - -o
    - /root/.ansible/tmp/ansible-tmp-1574622972.18-110314242626059/terraform_0.11.13_linux_amd64SUHBBn.zip
    - -d
    - /usr/local/bin
    err: ''
    out: |-
      Archive:  /root/.ansible/tmp/ansible-tmp-1574622972.18-110314242626059/terraform_0.11.13_linux_amd64SUHBBn.zip
        inflating: /usr/local/bin/terraform
    rc: 0
  gid: 0
  group: root
  handler: ZipArchive
  item: https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
  mode: '0755'
  owner: root
  size: 23
  src: /root/.ansible/tmp/ansible-tmp-1574622972.18-110314242626059/terraform_0.11.13_linux_amd64SUHBBn.zip
  state: directory
  uid: 0
changed: [127.0.0.1] => (item=https://releases.hashicorp.com/terraform-provider-openstack/1.24.0/terraform-provider-openstack_1.24.0_linux_amd64.zip) => changed=true 
  ansible_loop_var: item
  dest: /usr/local/bin
  extract_results:
    cmd:
    - /usr/bin/unzip
    - -o
    - /root/.ansible/tmp/ansible-tmp-1574622975.68-82254114753181/terraform-provider-openstack_1.24.0_linux_amd64xWWjwL.zip
    - -d
    - /usr/local/bin
    err: ''
    out: |-
      Archive:  /root/.ansible/tmp/ansible-tmp-1574622975.68-82254114753181/terraform-provider-openstack_1.24.0_linux_amd64xWWjwL.zip
        inflating: /usr/local/bin/terraform-provider-openstack_v1.24.0_x4
    rc: 0
  gid: 0
  group: root
  handler: ZipArchive
  item: https://releases.hashicorp.com/terraform-provider-openstack/1.24.0/terraform-provider-openstack_1.24.0_linux_amd64.zip
  mode: '0755'
  owner: root
  size: 70
  src: /root/.ansible/tmp/ansible-tmp-1574622975.68-82254114753181/terraform-provider-openstack_1.24.0_linux_amd64xWWjwL.zip
  state: directory
  uid: 0

TASK [Create a directory] *********************************************************************************************************
changed: [127.0.0.1] => (item=/etc/terraform) => changed=true 
  ansible_loop_var: item
  gid: 0
  group: root
  item: /etc/terraform
  mode: '0755'
  owner: root
  path: /etc/terraform
  size: 6
  state: directory
  uid: 0
changed: [127.0.0.1] => (item=/etc/terraform/create_instance) => changed=true 
  ansible_loop_var: item
  gid: 0
  group: root
  item: /etc/terraform/create_instance
  mode: '0755'
  owner: root
  path: /etc/terraform/create_instance
  size: 6
  state: directory
  uid: 0

TASK [Insert/Update variables.tf in /etc/terraform/create_instance] ***************************************************************
changed: [127.0.0.1] => changed=true 
  msg: File created

TASK [Insert/Update config.tfvars in /etc/terraform/create_instance] **************************************************************
changed: [127.0.0.1] => changed=true 
  msg: File created

TASK [Insert/Update main.tf /etc/terraform/create_instance] ***********************************************************************
changed: [127.0.0.1] => changed=true 
  msg: File created

PLAY RECAP ************************************************************************************************************************
127.0.0.1                  : ok=7    changed=5    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

让我们通过执行ansible-playbook来完成Terraform的安装并创建执行Terraform所需的文件。首先,我们来确认一下Terraform的版本。

查看Terraform的版本

[root@localhost playbook(keystone_admin)]# terraform -v
Terraform v0.11.13

Your version of Terraform is out of date! The latest version
is 0.12.16. You can update by downloading from www.terraform.io/downloads.html

确认已安装v0.11.13版本。现在请切换目录并尝试进行Terraform的初始化。

初始化Terraform

[root@localhost playbook(keystone_admin)]# cd /etc/terraform/create_instance/
[root@localhost create_instance(keystone_admin)]# ls
config.tfvars  main.tf  variables.tf
[root@localhost create_instance(keystone_admin)]# terraform init

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.openstack: version = "~> 1.24"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

成功进行了初始化。现在我们将使用 ansible-playbook 创建的文件来执行 Terraform,并在 OpenStack 上创建一个实例。

执行Terraform

[root@localhost create_instance(keystone_admin)]# terraform apply --var-file=config.tfvars

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + openstack_compute_instance_v2.tr-test-server
      id:                         <computed>
      access_ip_v4:               <computed>
      access_ip_v6:               <computed>
      all_metadata.%:             <computed>
      all_tags.#:                 <computed>
      availability_zone:          <computed>
      flavor_id:                  "3"
      flavor_name:                <computed>
      force_delete:               "false"
      image_id:                   "3740fbf0-8a76-436c-b6c6-cd5911b075c0"
      image_name:                 <computed>
      name:                       "tf-test-server"
      network.#:                  "1"
      network.0.access_network:   "false"
      network.0.fixed_ip_v4:      <computed>
      network.0.fixed_ip_v6:      <computed>
      network.0.floating_ip:      <computed>
      network.0.mac:              <computed>
      network.0.name:             "public"
      network.0.port:             <computed>
      network.0.uuid:             <computed>
      power_state:                "active"
      region:                     <computed>
      security_groups.#:          "1"
      security_groups.3814588639: "default"
      stop_before_destroy:        "false"


Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value:

请输入一个值:

当出现该显示时,输入“是”并按下Enter键。

  Enter a value: yes

openstack_compute_instance_v2.tr-test-server: Creating...
  access_ip_v4:               "" => "<computed>"
  access_ip_v6:               "" => "<computed>"
  all_metadata.%:             "" => "<computed>"
  all_tags.#:                 "" => "<computed>"
  availability_zone:          "" => "<computed>"
  flavor_id:                  "" => "3"
  flavor_name:                "" => "<computed>"
  force_delete:               "" => "false"
  image_id:                   "" => "3740fbf0-8a76-436c-b6c6-cd5911b075c0"
  image_name:                 "" => "<computed>"
  name:                       "" => "tf-test-server"
  network.#:                  "" => "1"
  network.0.access_network:   "" => "false"
  network.0.fixed_ip_v4:      "" => "<computed>"
  network.0.fixed_ip_v6:      "" => "<computed>"
  network.0.floating_ip:      "" => "<computed>"
  network.0.mac:              "" => "<computed>"
  network.0.name:             "" => "public"
  network.0.port:             "" => "<computed>"
  network.0.uuid:             "" => "<computed>"
  power_state:                "" => "active"
  region:                     "" => "<computed>"
  security_groups.#:          "" => "1"
  security_groups.3814588639: "" => "default"
  stop_before_destroy:        "" => "false"
openstack_compute_instance_v2.tr-test-server: Still creating... (10s elapsed)
openstack_compute_instance_v2.tr-test-server: Still creating... (20s elapsed)
openstack_compute_instance_v2.tr-test-server: Still creating... (30s elapsed)
openstack_compute_instance_v2.tr-test-server: Still creating... (40s elapsed)
openstack_compute_instance_v2.tr-test-server: Still creating... (50s elapsed)
openstack_compute_instance_v2.tr-test-server: Creation complete after 54s (ID: 2da65d5d-f8ba-4e5a-88cf-43186e981661)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Terraform执行成功。让我们去确认实例是否已经创建。

检查Terraform的状态

[root@localhost create_instance(keystone_admin)]# terraform show
openstack_compute_instance_v2.tr-test-server:
  id = 2da65d5d-f8ba-4e5a-88cf-43186e981661
  access_ip_v4 = 172.24.4.22
  access_ip_v6 = 
  all_metadata.% = 0
  all_tags.# = 0
  availability_zone = nova
  flavor_id = 3
  flavor_name = m1.medium
  force_delete = false
  image_id = 3740fbf0-8a76-436c-b6c6-cd5911b075c0
  image_name = cirros
  key_pair = 
  name = tf-test-server
  network.# = 1
  network.0.access_network = false
  network.0.fixed_ip_v4 = 172.24.4.22
  network.0.fixed_ip_v6 = 
  network.0.floating_ip = 
  network.0.mac = fa:16:3e:95:9e:f7
  network.0.name = public
  network.0.port = 
  network.0.uuid = 0565b7af-e2df-4e4c-bc36-029644a7a264
  power_state = active
  region = RegionOne
  security_groups.# = 1
  security_groups.3814588639 = default
  stop_before_destroy = false
  tags.# = 0

确认 Terraform 创建的实例是否存在

[root@localhost create_instance(keystone_admin)]# openstack server list
+--------------------------------------+----------------+--------+--------------------+--------+-----------+
| ID                                   | Name           | Status | Networks           | Image  | Flavor    |
+--------------------------------------+----------------+--------+--------------------+--------+-----------+
| 2da65d5d-f8ba-4e5a-88cf-43186e981661 | tf-test-server | ACTIVE | public=172.24.4.22 | cirros | m1.medium |
+--------------------------------------+----------------+--------+--------------------+--------+-----------+

确认已经使用指定的名称、网络、镜像和配置创建了该实例。既然已经确认了,请尝试删除该实例。

删除由Terraform创建的实例。

[root@localhost create_instance(keystone_admin)]# terraform destroy --var-file=config.tfvars
openstack_compute_instance_v2.tr-test-server: Refreshing state... (ID: 2da65d5d-f8ba-4e5a-88cf-43186e981661)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  - openstack_compute_instance_v2.tr-test-server


Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value:

输入一个值:

当屏幕显示此信息时,请输入“是”并按下Enter键。

  Enter a value: yes

openstack_compute_instance_v2.tr-test-server: Destroying... (ID: 2da65d5d-f8ba-4e5a-88cf-43186e981661)
openstack_compute_instance_v2.tr-test-server: Still destroying... (ID: 2da65d5d-f8ba-4e5a-88cf-43186e981661, 10s elapsed)
openstack_compute_instance_v2.tr-test-server: Destruction complete after 11s

Destroy complete! Resources: 1 destroyed.

使用Terraform创建的实例是否已被删除。

[root@localhost create_instance(keystone_admin)]# openstack server list

确认到使用terraform apply命令创建的实例已被删除。

总结

借助Ansible,我成功在CentOS 7上安装了Terraform和terraform-provider-openstack,并创建了所需的每个目录/文件,以便执行Terraform。这使得我能够立即开始使用Terraform进行操作。现在,我想使用Terraform创建网络、子网和路由器。

Ansible: 用于本次使用的模块。

    • 【doc.ansible.com】yum – Manages packages with the yum package manager

 

    • 【doc.ansible.com】unarchive – Unpacks an archive after (optionally) copying it from the local machine

 

    • 【doc.ansible.com】file – Manage files and file properties

 

    【doc.ansible.com】blockinfile – Insert/update/remove a text block surrounded by marker lines

Terraform:本次使用的模块。

    • OpenStack Provider

 

    openstack_compute_instance_v2

请参考以下网址

    • Terraform – CentOS 7 に Terraform をインストールして AWS へ接続

 

    • TerraformのGetting Startedをやってみた 〜インストールから作成、変更、削除まで〜

 

    • 北大OpenStack環境でTerraformを使用して仮想マシンを高速デプロイする

 

    OpenStack Rocky : Openstack Packstack

参考:OpenStack的安装

这次我们使用packstack来准备OpenStack环境。如果你有兴趣的话,也可以尝试使用kolla-ansible等来进行安装。

[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# yum -y install centos-release-openstack-rocky epel-release
[root@localhost ~]# yum -y install openstack-packstack python-pip
[root@localhost ~]# packstack --allinone
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20191124-231626-zUn1Gk/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Preparing Nova Compute entries                       [ DONE ]
Preparing Nova Scheduler entries                     [ DONE ]
Preparing Nova VNC Proxy entries                     [ DONE ]
Preparing OpenStack Network-related Nova entries     [ DONE ]
Preparing Nova Common entries                        [ DONE ]
Preparing Neutron LBaaS Agent entries                [ DONE ]
Preparing Neutron API entries                        [ DONE ]
Preparing Neutron L3 entries                         [ DONE ]
Preparing Neutron L2 Agent entries                   [ DONE ]
Preparing Neutron DHCP Agent entries                 [ DONE ]
Preparing Neutron Metering Agent entries             [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Swift builder entries                      [ DONE ]
Preparing Swift proxy entries                        [ DONE ]
Preparing Swift storage entries                      [ DONE ]
Preparing Gnocchi entries                            [ DONE ]
Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 10.0.2.15_controller.pp
10.0.2.15_controller.pp:                             [ DONE ]
Applying 10.0.2.15_network.pp
10.0.2.15_network.pp:                                [ DONE ]
Applying 10.0.2.15_compute.pp
10.0.2.15_compute.pp:                                [ DONE ]
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** Installation completed successfully ******

Additional information:
 * A new answerfile was created in: /root/packstack-answers-20191124-231628.txt
 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
 * Warning: NetworkManager is active on 10.0.2.15. OpenStack networking currently does not work on systems that have the Network Manager service enabled.
 * File /root/keystonerc_admin has been created on OpenStack client host 10.0.2.15. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://10.0.2.15/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * The installation log file is available at: /var/tmp/packstack/20191124-231626-zUn1Gk/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20191124-231626-zUn1Gk/manifests
[root@localhost ~]# source keystonerc_admin
[root@localhost ~(keystone_admin)]# openstack user list
+----------------------------------+------------+
| ID                               | Name       |
+----------------------------------+------------+
| 05b219f99b5341d5b6e2995308d83da7 | placement  |
| 0ede6abc3efb4437a1f2e53c8b2abf4f | aodh       |
| 45a6abb49b984fc1bb38f5466368f118 | glance     |
| 4d7dd54aaa06433db9ba74a6e184dc93 | demo       |
| bcc56f25cf4146f7a65acecc327fd89c | neutron    |
| bceab0973bb14501b2e2a15ff8f4c911 | swift      |
| be62b7fb449843eb86a2204dcb46c264 | nova       |
| e066727688bc47d8a3cecaae1c50609e | cinder     |
| f52801ef6d3c4ca18a92cdc6fbda84d2 | ceilometer |
| f739ce72284b4410a2209ef6a0310371 | gnocchi    |
| ffd9f6c03e264757b32a8db4fbfdac91 | admin      |
+----------------------------------+------------+
[root@localhost ~(keystone_admin)]# openstack project list
+----------------------------------+----------+
| ID                               | Name     |
+----------------------------------+----------+
| 3a82ceafe38a4fbe86a1bc8c1f141e85 | services |
| 7cd74def839441039d70421318eddc7b | demo     |
| 7e5e37477f8d4eb89fec3676f387f576 | admin    |
+----------------------------------+----------+
[root@localhost ~(keystone_admin)]# openstack service list
+----------------------------------+------------+--------------+
| ID                               | Name       | Type         |
+----------------------------------+------------+--------------+
| 09840a597b9f4c90ab7f882f8c296f36 | keystone   | identity     |
| 0d18b82787414f04ae301c719e441940 | ceilometer | metering     |
| 5b995c9d12b3484c99b942e935f8189b | glance     | image        |
| 5e1224c01cf245588216469714dfbc58 | neutron    | network      |
| 7e55ae3bdcd84e569354821b10786fff | placement  | placement    |
| 7eff14d6b48141c79299f230817285c4 | nova       | compute      |
| 8f5ac866191f4fe585a92228c11b3fcc | gnocchi    | metric       |
| 9dc9e65c90ce42fdba014947f78418e3 | cinderv2   | volumev2     |
| a34395df69184a22ac4b827b8c86f189 | aodh       | alarming     |
| b73e3f17ae104775b9996e2bb1ccb7df | cinderv3   | volumev3     |
| be888bebe047460ea95b7a7f9514e488 | swift      | object-store |
| ddf3a36d27864bb891ba32f223c6df6a | cinder     | volume       |
+----------------------------------+------------+--------------+
[root@localhost ~(keystone_admin)]# openstack catalog list
+------------+--------------+----------------------------------------------------------------------------+
| Name       | Type         | Endpoints                                                                  |
+------------+--------------+----------------------------------------------------------------------------+
| keystone   | identity     | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:5000/v3                                         |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:35357/v3                                         |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:5000/v3                                       |
|            |              |                                                                            |
| ceilometer | metering     | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8777                                          |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8777                                             |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8777                                            |
|            |              |                                                                            |
| glance     | image        | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:9292                                          |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:9292                                            |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:9292                                             |
|            |              |                                                                            |
| neutron    | network      | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:9696                                            |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:9696                                             |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:9696                                          |
|            |              |                                                                            |
| placement  | placement    | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8778/placement                                |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8778/placement                                   |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8778/placement                                  |
|            |              |                                                                            |
| nova       | compute      | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8774/v2.1/7e5e37477f8d4eb89fec3676f387f576      |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8774/v2.1/7e5e37477f8d4eb89fec3676f387f576       |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8774/v2.1/7e5e37477f8d4eb89fec3676f387f576    |
|            |              |                                                                            |
| gnocchi    | metric       | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8041                                            |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8041                                          |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8041                                             |
|            |              |                                                                            |
| cinderv2   | volumev2     | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8776/v2/7e5e37477f8d4eb89fec3676f387f576      |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8776/v2/7e5e37477f8d4eb89fec3676f387f576        |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8776/v2/7e5e37477f8d4eb89fec3676f387f576         |
|            |              |                                                                            |
| aodh       | alarming     | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8042                                            |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8042                                          |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8042                                             |
|            |              |                                                                            |
| cinderv3   | volumev3     | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8776/v3/7e5e37477f8d4eb89fec3676f387f576      |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8776/v3/7e5e37477f8d4eb89fec3676f387f576        |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8776/v3/7e5e37477f8d4eb89fec3676f387f576         |
|            |              |                                                                            |
| swift      | object-store | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8080/v1/AUTH_7e5e37477f8d4eb89fec3676f387f576    |
|            |              | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8080/v1/AUTH_7e5e37477f8d4eb89fec3676f387f576 |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8080/v1/AUTH_7e5e37477f8d4eb89fec3676f387f576   |
|            |              |                                                                            |
| cinder     | volume       | RegionOne                                                                  |
|            |              |   internal: http://10.0.2.15:8776/v1/7e5e37477f8d4eb89fec3676f387f576      |
|            |              | RegionOne                                                                  |
|            |              |   admin: http://10.0.2.15:8776/v1/7e5e37477f8d4eb89fec3676f387f576         |
|            |              | RegionOne                                                                  |
|            |              |   public: http://10.0.2.15:8776/v1/7e5e37477f8d4eb89fec3676f387f576        |
|            |              |                                                                            |
+------------+--------------+----------------------------------------------------------------------------+
广告
将在 10 秒后关闭
bannerAds