はじめに
OpenNebulaは、オープンソースのクラウド基盤管理ソフトウェアです。今回、ProxmoxVE 8.3上にNested構成でOpenNebula環境を構築してみました。
本記事では、公式ドキュメント「OneDeploy Tutorial: Local Datastore」を参考に、実際に試行錯誤しながら構築した手順を共有します。
環境
- ホストOS: ProxmoxVE 8.3
- ゲストOS: Ubuntu Server 24.04 LTS
- OpenNebula: 7.0
- 構成: Nested仮想化環境
- Frontend: 1台
- Node: 2台
前提条件
重要: VM のクローンは使用しない
本記事では、各 VM を個別にインストールすることを前提とします。 ProxmoxVE の VM クローン機能を使用すると、以下の識別子が重複し、予期しない問題が発生します:
-
machine-idの重複 → ブリッジの MAC アドレス重複、OpenNebula のネットワーク障害 - SSH ホストキーの重複 → セキュリティ警告
- DHCP クライアント識別子の重複 → IP アドレス競合
クローンを使用した場合の対処法は、記事末尾の「参考: Proxmox でクローンした場合の対処法」を参照してください。
その他の前提条件
- ProxmoxVE上でNested仮想化が有効になっていること
- 各仮想マシンがネットワーク接続できること
構築手順
1. 各ホストの準備
今回、以下の3台の仮想マシンを個別にインストールして用意しました。
| ホスト名 | IPアドレス | 役割 |
|---|---|---|
| nebula-f1 | 192.168.11.110 | Frontend |
| nebula-n1 | 192.168.11.111 | Node 1 |
| nebula-n2 | 192.168.11.112 | Node 2 |
作業用ユーザーの作成
OSインストール時に作成していれば本行程はスキップしてください。
各ホストで、作業用ユーザー(今回はflathill)を作成し、sudo権限を付与します。
# 各ホストで実行
sudo adduser flathill
sudo usermod -aG sudo flathill
パスワードなしでsudoを実行できるようにします。
echo "flathill ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/flathill
sudo chmod 440 /etc/sudoers.d/flathill
固定IPアドレスの設定
OSインストール時に固定IPアドレスを設定していれば本行程はスキップしてください。
各ホストで、Netplanを使用して固定IPアドレスを設定します。
# ネットワークインターフェース名を確認
ip a
Netplan設定ファイルを編集します(インターフェース名は環境に合わせて変更してください)。
sudo nano /etc/netplan/50-cloud-init.yaml
以下はnebula-f1(192.168.11.110)の設定例です:
network:
version: 2
ethernets:
enp6s18: # インターフェース名は環境に合わせて変更
dhcp4: false
dhcp6: false
addresses:
- 192.168.11.110/24
routes:
- to: default
via: 192.168.11.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
nebula-n1は192.168.11.111、nebula-n2は192.168.11.112に変更して同様に設定します。
設定を適用します。
sudo netplan apply
IPアドレスを確認します。
ip a
flathill@nebula-f1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether bc:24:11:09:31:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.110/24 brd 192.168.11.255 scope global enp6s18
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:fe09:3101/64 scope link
valid_lft forever preferred_lft forever
flathill@nebula-n1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether bc:24:11:ff:65:42 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.111/24 brd 192.168.11.255 scope global enp6s18
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:feff:6542/64 scope link
valid_lft forever preferred_lft forever
flathill@nebula-n2:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether bc:24:11:54:f0:d8 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.112/24 brd 192.168.11.255 scope global enp6s18
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:fe54:f0d8/64 scope link
valid_lft forever preferred_lft forever
ホスト名の設定
OSインストール時に正規のホスト名を設定していれば本行程はスキップしてください。
各ホストでホスト名を設定します。
# nebula-f1の場合
sudo hostnamectl set-hostname nebula-f1
# nebula-n1の場合
sudo hostnamectl set-hostname nebula-n1
# nebula-n2の場合
sudo hostnamectl set-hostname nebula-n2
各ホストで/etc/hostsファイルを編集し、すべてのホストを登録します。
sudo vi /etc/hosts
以下の内容を追加します:
192.168.11.110 nebula-f1
192.168.11.111 nebula-n1
192.168.11.112 nebula-n2
2. Ansible実行ホスト(Frontend)の準備
Frontendホスト(nebula-f1)で作業を行います。
必要なパッケージのインストール
sudo apt update
sudo apt install python3-pip pipx git
flathill@nebula-f1:~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:2 http://jp.archive.ubuntu.com/ubuntu noble InRelease
Hit:3 http://jp.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:4 http://jp.archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
37 packages can be upgraded. Run 'apt list --upgradable' to see them.
flathill@nebula-f1:~$ sudo apt install python3-pip pipx git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.43.0-1ubuntu7.3).
git set to manually installed.
The following additional packages will be installed:
省略
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
OneDeployのクローン
cd ~
git clone https://github.com/OpenNebula/one-deploy.git
flathill@nebula-f1:~$ git clone https://github.com/OpenNebula/one-deploy.git
Cloning into 'one-deploy'...
remote: Enumerating objects: 1739, done.
remote: Counting objects: 100% (380/380), done.
remote: Compressing objects: 100% (200/200), done.
remote: Total 1739 (delta 275), reused 185 (delta 180), pack-reused 1359 (from 3)
Receiving objects: 100% (1739/1739), 387.04 KiB | 4.72 MiB/s, done.
Resolving deltas: 100% (789/789), done.
Python仮想環境の作成
hatchをインストールします。
pipx install hatch
pipx ensurepath
source ~/.bashrc
flathill@nebula-f1:~$ pipx install hatch
installed package hatch 1.16.1, installed using Python 3.12.3
These apps are now globally available
- hatch
⚠️ Note: '/home/flathill/.local/bin' is not on your PATH environment variable. These apps will not be globally accessible
until your PATH is updated. Run `pipx ensurepath` to automatically add it, or manually modify your PATH in your shell's
config file (i.e. ~/.bashrc).
done! ✨ 🌟 ✨
flathill@nebula-f1:~$ pipx ensurepath
Success! Added /home/flathill/.local/bin to the PATH environment variable.
Consider adding shell completions for pipx. Run 'pipx completions' for instructions.
You will need to open a new terminal or re-login for the PATH changes to take effect.
Otherwise pipx is ready to go! ✨ 🌟 ✨
flathill@nebula-f1:~$ source ~/.bashrc
hatchを使用して仮想環境を作成し、必要なパッケージをインストールします。
# 仮想環境の作成と有効化、依存関係のインストールを一括実行
cd one-deploy
make requirements
flathill@nebula-f1:~$ cd one-deploy
make requirements
/home/flathill/.local/bin/hatch env create default
/home/flathill/.local/bin/hatch env run -e default -- ansible-galaxy collection install --requirements-file /home/flathill/one-deploy/requirements.yml --collections-path /home/flathill/one-deploy/ansible_collections
Starting galaxy collection install process
Process install dependency map
Cloning into '/home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/ansible-config_templatewgrghv_c'...
remote: Enumerating objects: 1995, done.
remote: Counting objects: 100% (382/382), done.
remote: Compressing objects: 100% (153/153), done.
remote: Total 1995 (delta 348), reused 229 (delta 229), pack-reused 1613
Receiving objects: 100% (1995/1995), 403.05 KiB | 801.00 KiB/s, done.
Resolving deltas: 100% (1072/1072), done.
Note: switching to '1.2.1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 7422a09 Move config_template to plugins/action
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-libvirt-2.0.0.tar.gz to /home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/community-libvirt-2.0.0-w5sf429z
Installing 'openstack.config_template:1.2.1' to '/home/flathill/one-deploy/ansible_collections/openstack/config_template'
Created collection for openstack.config_template:1.2.1 at /home/flathill/one-deploy/ansible_collections/openstack/config_template
openstack.config_template:1.2.1 was installed successfully
Installing 'community.libvirt:2.0.0' to '/home/flathill/one-deploy/ansible_collections/community/libvirt'
community.libvirt:2.0.0 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-posix-2.1.0.tar.gz to /home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/ansible-posix-2.1.0-ejwgdlfl
Installing 'ansible.posix:2.1.0' to '/home/flathill/one-deploy/ansible_collections/ansible/posix'
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-utils-6.0.0.tar.gz to /home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/ansible-utils-6.0.0-406cei56
ansible.posix:2.1.0 was installed successfully
Installing 'ansible.utils:6.0.0' to '/home/flathill/one-deploy/ansible_collections/ansible/utils'
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-crypto-3.0.5.tar.gz to /home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/community-crypto-3.0.5-2ub1xdfb
ansible.utils:6.0.0 was installed successfully
Installing 'community.crypto:3.0.5' to '/home/flathill/one-deploy/ansible_collections/community/crypto'
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-12.1.0.tar.gz to /home/flathill/.ansible/tmp/ansible-local-28801grijjgr/tmp5i7_dk04/community-general-12.1.0-n7usfytm
community.crypto:3.0.5 was installed successfully
Installing 'community.general:12.1.0' to '/home/flathill/one-deploy/ansible_collections/community/general'
community.general:12.1.0 was installed successfully
これにより、pyproject.tomlに定義された依存関係が自動的にインストールされ、仮想環境が有効化されます。
仮想環境の確認
作成した仮想環境を確認します。
hatch env show
flathill@nebula-f1:~/one-deploy$ hatch env show
Standalone
┌───────────┬──────────┬──────────────────────┐
│ Name │ Type │ Dependencies │
├───────────┼──────────┼──────────────────────┤
│ default │ virtual │ ansible-core<2.17 │
│ │ │ ansible-lint │
│ │ │ molecule │
│ │ │ netaddr │
│ │ │ pyone │
├───────────┼──────────┼──────────────────────┤
│ ceph │ virtual │ ansible-core<2.16 │
│ │ │ molecule │
│ │ │ netaddr │
│ │ │ pyone │
│ │ │ setuptools │
└───────────┴──────────┴──────────────────────┘
デフォルト仮想環境への切り替え
hatch shell
flathill@nebula-f1:~/one-deploy$ hatch shell
You are about to enter a new shell, exit as you usually would e.g. by typing `exit` or pressing `ctrl+d`...
flathill@nebula-f1:~/one-deploy$ source "/home/flathill/.local/share/hatch/env/virtual/one-deploy/_iO46lt7/one-deploy/bin/activate"
(one-deploy) flathill@nebula-f1:~/one-deploy$
3. OneDeployの設定
作業ディレクトリの作成
mkdir -p ~/one-deploy/my-one
cd ~/one-deploy/my-one
インベントリファイル(example.yml)の作成
環境に合わせてインベントリファイルを作成します。
公式ドキュメントからの重要な修正点:
-
ansible_user: flathill(root ではなく一般ユーザー) -
ansible_become: true(sudo を使用) -
ensure_keys: true(SSH 鍵の自動配布) -
features:セクションの追加 -
ds.mode: sshの明示的な指定 -
PHYDEV: enp6s18(Ubuntu 24.04 の実際のインターフェース名)
cat << 'EOF' > example.yml
---
all:
vars:
ansible_user: flathill
ansible_become: true
ansible_become_method: sudo
one_version: '7.0'
one_pass: opennebulapass
ensure_hosts: true
ensure_keys: true
features:
evpn: false
evpn_greedy: false
ds:
mode: ssh
vn:
admin_net:
managed: true
template:
VN_MAD: bridge
PHYDEV: enp6s18
BRIDGE: br0
AR:
TYPE: IP4
IP: 192.168.11.128
SIZE: 48
NETWORK_ADDRESS: 192.168.11.0
NETWORK_MASK: 255.255.255.0
GATEWAY: 192.168.11.1
DNS: 1.1.1.1
frontend:
hosts:
nebula-f1: { ansible_host: 192.168.11.110 }
node:
hosts:
nebula-n1: { ansible_host: 192.168.11.111 }
nebula-n2: { ansible_host: 192.168.11.112 }
EOF
ポイント:
-
PHYDEV: 実際の物理ネットワークインターフェース名に合わせて変更 - IPアドレス範囲は環境に合わせて調整
ansible.cfgの作成
cat << 'EOF' > ansible.cfg
[defaults]
inventory=./example.yml
gathering=explicit
host_key_checking=false
display_skipped_hosts=true
retry_files_enabled=false
any_errors_fatal=true
timeout=30
collections_path=/home/flathill/one-deploy/ansible_collections
[ssh_connection]
pipelining=true
ssh_args=-q -o ControlMaster=auto -o ControlPersist=60s
[privilege_escalation]
become = true
become_method = sudo
become_user = root
EOF
公式ドキュメントからの重要な修正点:
-
collections_path: 単数形を使用(警告回避) -
stdout_callback=yamlの行は削除(非推奨プラグイン回避) -
become_user = root: sudo時にroot権限を取得
4. SSH鍵認証の設定
Ansible実行ホストから各ターゲットホストへSSH鍵認証で接続できるようにします。
# SSH鍵の生成
ssh-keygen -t ed25519 -C "ansible"
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh-keygen -t ed25519 -C "ansible"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/flathill/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/flathill/.ssh/id_ed25519
Your public key has been saved in /home/flathill/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:C1uIenEOzOhvdyavpCzOrk0OedX6fAdpipv9J6X7Leo ansible
The key's randomart image is:
+--[ED25519 256]--+
| |
| |
| |
| + o . |
| . B = S. |
| o o * ++.. |
|o = o.+o.+ |
| B.+oB+ * +. |
|.+*o*o=XEB... |
+----[SHA256]-----+
# 各ホストへ公開鍵をコピー
ssh-copy-id flathill@192.168.11.110
ssh-copy-id flathill@192.168.11.111
ssh-copy-id flathill@192.168.11.112
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh-copy-id flathill@192.168.11.110
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/flathill/.ssh/id_ed25519.pub"
The authenticity of host '192.168.11.110 (192.168.11.110)' can't be established.
ED25519 key fingerprint is SHA256:+ndk/hy4iOuiouMZ8i2TOmkvu6BgDBSZhLDLgTYbJkQ.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
flathill@192.168.11.110's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'flathill@192.168.11.110'"
and check to make sure that only the key(s) you wanted were added.
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh-copy-id flathill@192.168.11.111
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/flathill/.ssh/id_ed25519.pub"
The authenticity of host '192.168.11.111 (192.168.11.111)' can't be established.
ED25519 key fingerprint is SHA256:ofzZvGwNpKdg8JIV+KkGZDGWYmCtemKAnc0jB7MOS0Q.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
flathill@192.168.11.111's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'flathill@192.168.11.111'"
and check to make sure that only the key(s) you wanted were added.
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh-copy-id flathill@192.168.11.112
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/flathill/.ssh/id_ed25519.pub"
The authenticity of host '192.168.11.112 (192.168.11.112)' can't be established.
ED25519 key fingerprint is SHA256:c425ug88TMa99IZXxILn4Z2RtqLhdeUsV2hNs1LakyM.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
flathill@192.168.11.112's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'flathill@192.168.11.112'"
and check to make sure that only the key(s) you wanted were added.
SSH接続のテストを行います。
ssh flathill@192.168.11.110
ssh flathill@192.168.11.111
ssh flathill@192.168.11.112
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh flathill@192.168.11.110
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-88-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Dec 4 01:37:44 AM UTC 2025
System load: 0.0 Processes: 145
Usage of /: 7.4% of 96.37GB Users logged in: 1
Memory usage: 4% IPv4 address for enp6s18: 192.168.11.110
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
32 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Thu Dec 4 01:17:42 2025 from 10.8.0.6
flathill@nebula-f1:~$
logout
Connection to 192.168.11.110 closed.
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh flathill@192.168.11.111
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-88-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Dec 4 01:37:50 AM UTC 2025
System load: 0.0 Processes: 136
Usage of /: 6.8% of 96.37GB Users logged in: 1
Memory usage: 3% IPv4 address for enp6s18: 192.168.11.111
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
32 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Thu Dec 4 01:18:10 2025 from 10.8.0.6
flathill@nebula-n1:~$
logout
Connection to 192.168.11.111 closed.
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ssh flathill@192.168.11.112
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-88-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Dec 4 01:37:57 AM UTC 2025
System load: 0.0 Processes: 137
Usage of /: 6.8% of 96.37GB Users logged in: 1
Memory usage: 2% IPv4 address for enp6s18: 192.168.11.112
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
32 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Thu Dec 4 01:22:22 2025 from 10.8.0.6
flathill@nebula-n2:~$
logout
Connection to 192.168.11.112 closed.
重要: ここで躓いたポイントとして、最初rootユーザーでAnsibleを実行していましたが、rootユーザーは直接SSH接続できない設定だったため失敗しました。一般ユーザー(flathill)で実行することで解決しました。
5. Ansible接続テスト
Ansibleで各ホストへ接続できるか確認します。
hatch shell
cd ~/one-deploy/my-one
ansible -i example.yml all -m ping
成功すると、以下のような出力が表示されます。
nebula-f1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
nebula-n1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
nebula-n2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ansible -i example.yml all -m ping
nebula-n1 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
nebula-f1 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
nebula-n2 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
6. OpenNebulaのデプロイ
いよいよOpenNebulaのデプロイを実行します。
hatch shell
cd ~/one-deploy/my-one
ansible-playbook opennebula.deploy.main
デプロイには数分から十数分かかります。
完了すると、以下のようなサマリーが表示されます。
(one-deploy) flathill@nebula-f1:~/one-deploy/my-one$ ansible-playbook opennebula.deploy.main
[WARNING]: Collection community.crypto does not support Ansible version 2.16.14
[WARNING]: Could not match supplied host pattern, ignoring: bastion
PLAY [bastion] ******************************************************************************************************************
skipping: no hosts matched
[WARNING]: Could not match supplied host pattern, ignoring: router
[WARNING]: Could not match supplied host pattern, ignoring: grafana
[WARNING]: Could not match supplied host pattern, ignoring: mons
[WARNING]: Could not match supplied host pattern, ignoring: mgrs
[WARNING]: Could not match supplied host pattern, ignoring: osds
省略
PLAY RECAP **********************************************************************************************************************
nebula-f1 : ok=89 changed=29 unreachable=0 failed=0 skipped=93 rescued=0 ignored=0
nebula-n1 : ok=55 changed=14 unreachable=0 failed=0 skipped=81 rescued=0 ignored=0
nebula-n2 : ok=55 changed=14 unreachable=0 failed=0 skipped=72 rescued=0 ignored=0
7. ネットワークブリッジの手動設定
重要: OneDeploy は自動的にネットワークブリッジ (br0) を作成しますが、Ubuntu 24.04 環境では正しく設定されない場合があります。以下の手順で手動設定が必要です。
各ホストでブリッジ設定を確認
ip a show br0
flathill@nebula-f1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether bc:24:11:09:31:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.110/24 brd 192.168.11.255 scope global enp6s18
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:fe09:3101/64 scope link
valid_lft forever preferred_lft forever
flathill@nebula-n1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether bc:24:11:ff:65:42 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether bc:24:11:ff:65:42 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.111/24 brd 192.168.11.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:feff:6542/64 scope link
valid_lft forever preferred_lft forever
flathill@nebula-n2:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether bc:24:11:54:f0:d8 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether bc:24:11:54:f0:d8 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.112/24 brd 192.168.11.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:fe54:f0d8/64 scope link
valid_lft forever preferred_lft forever
設定確認(/etc/netplan/50-cloud-init.yaml)
flathill@nebula-f1:~$ sudo cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
enp6s18:
addresses:
- "192.168.11.110/24"
nameservers:
addresses:
- 1.1.1.1
search: []
routes:
- to: "default"
via: "192.168.11.1"
flathill@nebula-n1:~$ sudo cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
enp6s18:
dhcp4: false
dhcp6: false
flathill@nebula-n1:~$ sudo cat /etc/netplan/70-netplan-set.yaml
network:
version: 2
bridges:
br0:
addresses:
- "192.168.11.111/24"
nameservers:
addresses:
- 1.1.1.1
search: []
macaddress: "bc:24:11:ff:65:42"
interfaces:
- enp6s18
routes:
- to: "default"
via: "192.168.11.1"
flathill@nebula-n2:~$ sudo cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
enp6s18:
dhcp4: false
dhcp6: false
flathill@nebula-n2:~$ sudo cat /etc/netplan/70-netplan-set.yaml
network:
version: 2
bridges:
br0:
addresses:
- "192.168.11.112/24"
nameservers:
addresses:
- 1.1.1.1
search: []
macaddress: "bc:24:11:54:f0:d8"
interfaces:
- enp6s18
routes:
- to: "default"
via: "192.168.11.1"
もし br0 が存在しない、または正しく設定されていない場合は、次の手順で設定します。
Netplan でブリッジを設定
nebula-f1 の例:
sudo vi /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
enp6s18:
dhcp4: false
dhcp6: false
sudo vi /etc/netplan/70-netplan-set.yaml
network:
version: 2
bridges:
br0:
addresses:
- "192.168.11.110/24"
nameservers:
addresses:
- 1.1.1.1
search: []
# enp6s18インタフェースのMACアドレス
macaddress: "bc:24:11:09:31:01"
interfaces:
- enp6s18
routes:
- to: "default"
via: "192.168.11.1"
今回のケースでは、nebula-f1 のみ設定を行いますが、必要に応じて nebula-n1 と nebula-n2 でも、それぞれの IP アドレス (192.168.11.111, 192.168.11.112) に合わせて設定します。
設定の適用
各ホストで:
sudo netplan apply
ip a show br0
brctl show br0
flathill@nebula-f1:~$ sudo netplan apply
flathill@nebula-f1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether bc:24:11:09:31:01 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether bc:24:11:09:31:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.110/24 brd 192.168.11.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::be24:11ff:fe09:3101/64 scope link
valid_lft forever preferred_lft forever
接続確認
ping -c 1 192.168.11.1 # ゲートウェイ
ping -c 1 192.168.11.110 # nebula-f1
ping -c 1 192.168.11.111 # nebula-n1
ping -c 1 192.168.11.112 # nebula-n2
flathill@nebula-f1:~$ ping -c 1 192.168.11.1
PING 192.168.11.1 (192.168.11.1) 56(84) bytes of data.
64 bytes from 192.168.11.1: icmp_seq=1 ttl=64 time=1.98 ms
--- 192.168.11.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.978/1.978/1.978/0.000 ms
flathill@nebula-f1:~$ ping -c 1 192.168.11.110
PING 192.168.11.110 (192.168.11.110) 56(84) bytes of data.
64 bytes from 192.168.11.110: icmp_seq=1 ttl=64 time=0.010 ms
--- 192.168.11.110 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.010/0.010/0.010/0.000 ms
flathill@nebula-f1:~$ ping -c 1 192.168.11.111
PING 192.168.11.111 (192.168.11.111) 56(84) bytes of data.
64 bytes from 192.168.11.111: icmp_seq=1 ttl=64 time=0.107 ms
--- 192.168.11.111 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.107/0.107/0.107/0.000 ms
flathill@nebula-f1:~$ ping -c 1 192.168.11.112
PING 192.168.11.112 (192.168.11.112) 56(84) bytes of data.
64 bytes from 192.168.11.112: icmp_seq=1 ttl=64 time=0.138 ms
--- 192.168.11.112 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.138/0.138/0.138/0.000 ms
8. データストア設定の検証と修正
oneadmin ユーザーへの切り替え
nebula-f1 で:
sudo -i -u oneadmin
flathill@nebula-f1:~$ sudo -i -u oneadmin
データストアの確認
onedatastore show 0
onedatastore show 1
oneadmin@nebula-f1:~$ onedatastore show 0
DATASTORE 0 INFORMATION
ID : 0
NAME : system
USER : oneadmin
GROUP : oneadmin
CLUSTERS : 0
TYPE : SYSTEM
DS_MAD : -
TM_MAD : ssh
BASE PATH : /var/lib/one//datastores/0
DISK_TYPE : FILE
STATE : READY
DATASTORE CAPACITY
TOTAL: : -
FREE: : -
USED: : -
LIMIT: : -
PERMISSIONS
OWNER : um-
GROUP : u--
OTHER : ---
DATASTORE TEMPLATE
ALLOW_ORPHANS="YES"
DISK_TYPE="FILE"
DS_MIGRATE="YES"
PERSISTENT_SNAPSHOTS="YES"
RESTRICTED_DIRS="/"
SAFE_DIRS="/var/tmp"
SHARED="NO"
TM_MAD="ssh"
TYPE="SYSTEM_DS"
IMAGES
oneadmin@nebula-f1:~$ onedatastore show 1
DATASTORE 1 INFORMATION
ID : 1
NAME : default
USER : oneadmin
GROUP : oneadmin
CLUSTERS : 0
TYPE : IMAGE
DS_MAD : fs
TM_MAD : ssh
BASE PATH : /var/lib/one//datastores/1
DISK_TYPE : FILE
STATE : READY
DATASTORE CAPACITY
TOTAL: : 96.4G
FREE: : 82.9G
USED: : 8.5G
LIMIT: : -
PERMISSIONS
OWNER : um-
GROUP : u--
OTHER : ---
DATASTORE TEMPLATE
ALLOW_ORPHANS="YES"
CLONE_TARGET="SYSTEM"
DISK_TYPE="FILE"
DS_MAD="fs"
LN_TARGET="SYSTEM"
PERSISTENT_SNAPSHOTS="YES"
RESTRICTED_DIRS="/"
SAFE_DIRS="/var/tmp"
TM_MAD="ssh"
TYPE="IMAGE_DS"
IMAGES
TM_MAD の値を確認します。Frontend と Node が分離した構成では、TM_MAD は ssh である必要があります。
もし TM_MAD: local になっている場合は、以下の手順で修正します。
TM_MAD の修正(必要な場合のみ)
onedatastore update 0
エディタが開くので、TM_MAD="local" を TM_MAD="ssh" に変更して保存します。
onedatastore update 1
同様に、TM_MAD="local" を TM_MAD="ssh" に変更します。
確認:
onedatastore show 0 | grep TM_MAD
onedatastore show 1 | grep TM_MAD
両方とも TM_MAD : ssh となっていることを確認します。
9. OpenNebulaへのアクセス
インストール確認
OpenNebulaサービスが稼働していることを確認します。
systemctl status opennebula.service
oneadmin@nebula-f1:~$ systemctl status opennebula.service
● opennebula.service - OpenNebula Cloud Controller Daemon
Loaded: loaded (/usr/lib/systemd/system/opennebula.service; enabled; preset: enabled)
Active: active (running) since Thu 2025-12-04 01:50:32 UTC; 17min ago
Main PID: 1034 (oned)
Tasks: 80 (limit: 9391)
Memory: 392.3M (peak: 469.3M)
CPU: 4.766s
CGroup: /system.slice/opennebula.service
tq1034 /usr/bin/oned -f
tq1061 ruby /usr/lib/one/mads/one_hm.rb -p 2101 -l 2102 -b 127.0.0.1
tq1085 ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 kvm -p
tq1102 ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 lxc
tq1119 ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 kvm
tq1138 ruby /usr/lib/one/mads/one_tm.rb -t 15 -d dummy,lvm,shared,fs_lvm,fs_lvm_ssh,qcow2,ssh,local,ceph,dev,iscsi_libvirt,netapp
tq1161 ruby /usr/lib/one/mads/one_auth_mad.rb --authn ssh,x509,ldap,server_cipher,server_x509
tq1176 ruby /usr/lib/one/mads/one_datastore.rb -t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,restic,rsync,netapp -s dummy,shared,ssh,local,ceph,fs_lvm,fs_lvm_ssh,qcow2,netapp
tq1193 ruby /usr/lib/one/mads/one_market.rb -t 15 -m http,s3,one,linuxcontainers
tq1210 ruby /usr/lib/one/mads/one_ipam.rb -t 1 -i dummy,aws,equinix,vultr,scaleway
tq1224 ruby /usr/lib/one/mads/one_sched.rb -t 15 -p rank -o one_drs
tq1255 /usr/lib/one/mads/onemonitord "-c monitord.conf"
tq1272 ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 kvm
tq1285 ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 lxc
mq1298 ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 qemu
クラウドリソース確認
クラウドリソースが稼働していることを確認します。
onehost list
onedatastore list
onevnet list
oneadmin@nebula-f1:~$ onehost list
] ID NAME CLUSTER TVM ALLOCATED_CPU ALLOCATED_MEM STAT
1 192.168.11.111 default 0 0 / 400 (0%) 0K / 7.7G (0%) on
0 192.168.11.112 default 0 0 / 400 (0%) 0K / 7.7G (0%) on
oneadmin@nebula-f1:~$ onedatastore list
ID NAME SIZE AVA CLUSTERS IMAGES TYPE DS TM STAT
2 files 96.4G 86% 0 0 fil fs ssh on
1 default 96.4G 86% 0 0 img fs ssh on
0 system - - 0 0 sys - ssh on
oneadmin@nebula-f1:~$ onevnet list
ID USER GROUP NAME CLUSTERS BRIDGE STATE LEASES OUTD ERRO
0 oneadmin oneadmin admin_net 0 br0 rdy 0 0 0
Sunstone Web UI
デプロイが完了したら、WebブラウザからOpenNebulaのWebインターフェース(Sunstone)にアクセスします。
http://192.168.11.110:2616/
ログイン情報:
- ユーザー名:
oneadmin - パスワード:
example.ymlで設定したone_pass(今回はopennebulapass)
10. 動作確認
ホストの確認
Sunstoneで「Infrastructure」→「Hosts」から、登録されたノードを確認します。
ネットワークの確認
「Network」→「Virtual Networks」から、admin_netが作成されていることを確認します。
ハマったポイントと解決方法
1. Ansibleの接続エラー
問題: ansible -i example.yml all -m pingで全ホストがUNREACHABLE
原因: rootユーザーでAnsibleを実行していたが、rootユーザーは直接SSH接続できない設定だった
解決:
- 一般ユーザー(flathill)でAnsibleを実行
-
example.ymlでansible_user: flathillを指定 -
ansible_become: trueでsudo権限を使用
2. Playbookのコールバックプラグインエラー
問題: community.general.yaml has been removedエラー
原因: ansible.cfgで使用していたstdout_callback=yamlが非推奨
解決: ansible.cfgからstdout_callback=yamlの行を削除
3. features セクション未定義エラー
問題: The conditional check 'features.evpn | bool is true' failed. The error was: 'features' is undefined
原因: example.ymlにfeatures:セクションが定義されていない
解決: example.ymlに以下を追加:
features:
evpn: false
evpn_greedy: false
4. VM が PROLOG_FAILURE で失敗
問題: VM インスタンス化時に PROLOG_FAILURE エラーが発生
原因:
- データストアの
TM_MADがlocalになっている(Frontend と Node が分離した構成ではsshが必要) - oneadmin ユーザーの SSH 鍵認証が設定されていない
解決:
-
TM_MADをsshに変更 -
example.ymlにensure_keys: trueを追加し、Playbook を再実行
5. VM が BOOT_FAILURE で失敗
問題: VM インスタンス化時に BOOT_FAILURE エラーが発生
原因: ネットワークブリッジ (br0) が正しく設定されていない
解決: 各ホストで Netplan を使用してブリッジを手動設定
6. ブリッジは存在するが ping が通らない
問題: br0 は作成されているが、物理インターフェースがブリッジに追加されていない
確認方法:
brctl show br0
interfaces 列に enp6s18 が表示されることを確認します。表示されない場合は、Netplan の設定を見直し、sudo netplan apply を再実行します。
参考: Proxmox でクローンした場合の対処法
注意: 本記事では VM のクローンを使用しないことを推奨していますが、既にクローンを使用してしまった場合や、テスト目的でクローンを使いたい場合の対処法を記載します。
問題: クローンによる識別子の重複
Proxmox で VM をクローンすると、以下が重複します:
- machine-id: systemd が使用する一意の識別子
- SSH ホストキー: SSH サーバーの識別情報
- DHCP クライアント識別子: ネットワーク識別情報
これらが重複すると、以下の問題が発生します:
-
ブリッジの MAC アドレスが重複:
MACAddressPolicy=persistentが machine-id とインターフェース名から MAC を生成するため、同じ machine-id を持つホストで同じブリッジ名を使うと、同じ MAC アドレスが生成される - DHCP で同じ IP アドレスが割り当てられる
- SSH 接続時にセキュリティ警告が出る
-
OpenNebula の VM が起動しない: ネットワークの MAC アドレス競合により
BOOT_FAILUREが発生
対処法: クローン後の識別子再生成
各クローンした VM で、以下のコマンドを実行します:
1. machine-id の確認と再生成
# 現在の machine-id を確認(各ホストで実行して比較)
cat /etc/machine-id
# もし同じ machine-id が表示された場合、以下を実行:
# machine-id を削除
sudo rm -f /etc/machine-id
# 新しい machine-id を生成
sudo systemd-machine-id-setup
# 確認(各ホストで異なる値になっているはず)
cat /etc/machine-id
2. SSH ホストキーの再生成
# 既存の SSH ホストキーを削除
sudo rm -f /etc/ssh/ssh_host_*
# SSH ホストキーを再生成
sudo dpkg-reconfigure openssh-server
# 確認
ls -la /etc/ssh/ssh_host_*
3. ネットワークブリッジの再作成
machine-id を変更した後、ブリッジの MAC アドレスも再生成されます:
# ブリッジを削除
sudo ip link set br0 down
sudo ip link delete br0
# systemd-networkd を再起動
sudo systemctl restart systemd-networkd
# Netplan を適用
sudo netplan apply
# 確認
ip link show br0 | grep link/ether
各ホストで異なる MAC アドレスが割り当てられていることを確認します。
4. 再起動
sudo reboot
テンプレート作成時のベストプラクティス
将来的にクローンを使用する予定がある場合、テンプレート化する前に以下を実行しておくと、クローン後の手動作業が不要になります:
# machine-id を削除(次回起動時に自動生成)
sudo rm -f /etc/machine-id
sudo touch /etc/machine-id
# SSH ホストキーを削除(次回起動時に自動生成)
sudo rm -f /etc/ssh/ssh_host_*
# ログをクリア
sudo journalctl --vacuum-time=1s
history -c && cat /dev/null > ~/.bash_history
# シャットダウン
sudo shutdown -h now
この状態で Proxmox のテンプレート化機能を使用すれば、クローン後に各 VM が自動的に一意の識別子を生成します。
まとめ
ProxmoxVE上のNested環境でOpenNebulaを構築してみました。公式ドキュメントに従いつつ、以下の点に注意することでスムーズに構築できました。
主な修正点と注意事項:
- VM は個別にインストール: クローンは使用せず、各 VM を個別にインストール
- 固定 IP アドレスの設定: 各ホストに固定IPアドレスを設定
-
example.ymlの設定:-
ansible_user: flathill(一般ユーザーを使用) -
ensure_keys: true(SSH 鍵の自動配布) -
features:セクションの追加 -
ds.mode: sshの明示的な指定 -
PHYDEV: enp6s18(正しいインターフェース名)
-
-
ansible.cfgの設定:-
collections_pathの正しいパス指定 -
stdout_callback=yamlの削除 -
become_user = rootの設定
-
- ネットワークブリッジの手動設定: OneDeploy が自動作成に失敗する場合があるため、Netplan で手動設定
-
データストアの
TM_MAD検証: Frontend/Node 分離構成ではTM_MAD=sshが必須
今後、仮想マシンのデプロイやネットワーク設定などを試していきたいと思います。



