LoginSignup
0
2

More than 3 years have passed since last update.

Ansibleを使用して、CentOS 7にTerraformとterraform-provider-openstackをインストールする

Last updated at Posted at 2019-11-24

Ansibleを使用して、CentOS 7にTerraformとterraform-provider-openstackをインストールする

Terraformとは何ぞや?という方は下記を一読いただければと思います。
- Introduction to Terraform
- Terraform簡易チュートリアル on AWS
- 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 | []   |
+--------------------------------------+---------+--------------------------------+----------------------------------+------+

playbookの作成

収集した情報を基にblockinfileモジュールを使用して、ファイル作成します。

/etc/ansible/playbook/SetupTerraform.yml
- 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 a value:

という表示が出たら、[yes]と入力し、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 a value:

という表示が出たら、[yes]と入力し、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: 今回使用したモジュール

Terraform: 今回使用したモジュール

参考URL

参考: 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        |
|            |              |                                                                            |
+------------+--------------+----------------------------------------------------------------------------+
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2