Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

Ubuntu Server 14.04 LTSでMAASおよびJujuでタグを使用する

Summary: MAASは、ノードの物理的特性に基づいてタグのシステムを実装します。タグに関するMAASのドキュメントでは、これについて説明しています

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


Symptoms

この記事は、Canonicalフィールド エンジニア のMark Wenningによって作成されました。

MAASおよびJujuクラスターをより細かく制御するためのタグ

MAASは、ノードの物理的特性に基づいてタグのシステムを実装します。タグに関するMAASのドキュメントでは、主に既存のハードウェアタグを–constraintsのdescriptionオプションで使用するという観点から、これについて説明しています。 

新しいタグを手動で作成して、MAASおよびJujuクラスターの導入と管理を容易にすることもできます。    

たとえば、MAASクラスタでJujuをブートストラップし、ブートストラップノードを特定のマシンに強制的に配置する場合は、最初にノードにタグを付け、次にタグを制約として使用してブートストラップできます。

$ juju bootstrap --constraints "tags=my-juju-bootstrap-node" –debug

このようにタグ制約を設定すると、次のjujuコマンドは、キャンセルするまで制約を使用しようとすることに注意してください。

$ juju set-constraints "tags="

タグのもう1つの用途は、複数のノードを同じタグでマークし、それらのノードのみに導入することです。

$ juju deploy mysql –constraints "tags=my-juju-Dell-nodes" --debug

MAASコマンド・ライン・インターフェースにログインします。

これらのコマンドを使用する前に、MAAS 領域サーバーにログインする必要があります。

$ maas login <profile-name> <host-url> <apikey>
  • <profile-name> は何でもかまいませんが、通常は "MaaS" です。
  • <host-url>は、MAASリージョナルコントローラーのURLに、APIとバージョン(つまり https://192.168.0.2/MAAS/api/1.0)を加えたものです。
  • <apikey> は、MAAS リージョナル・コントローラーの構築時に作成された MAAS api または oauth キーです。

詳細については、 https://maas.io/docs/このハイパーリンクをクリックすると、デル・テクノロジーズ以外のWebサイトにアクセスします。 を参照してください。

完了したら、MAAS cli 環境からログアウトするには、

$ maas logout maas

「説明」オプションを使用したタグの作成

タグに関する MAAS ドキュメントで説明したように、タグは、ノードに関連付けられた "lshw" 情報 (XML としてフォーマットされた) に基づいて、XPath 式を使用して作成および割り当てることができます。   各ノードのWebページの下部にあるこの情報にアクセスするには、[Raw discovery data]の下にある[Show discovered details]リンクをクリックします。   ノードの 1 つの「lshw」情報の一部は次のとおりです。

...

<lshw:node id="t410" claimed="true" class="system" handle="DMI:0100">
<lshw:description>System</lshw:description>
<lshw:product>PowerEdge T410 ()</lshw:product>
<lshw:vendor>Dell Inc.</lshw:vendor>
<lshw:serial>RHXT410</lshw:serial>
<lshw:width units="bits">64</lshw:width>
<lshw:configuration>
<lshw:setting id="boot" value="normal"/>
<lshw:setting id="chassis" value="server"/>
<lshw:setting id="uuid" value="44454C4C-4800-1058-8054-D2C04F343130"/>
</lshw:configuration>
<lshw:capabilities>
...

システム内のノードに説明的なタグを追加するには、次のコマンドを実行します。

$ maas maas tags new name="Dell_Machine" definition='//node[@class="system"]/vendor = "Dell Inc."'
$ maas maas tags new name="Intel_Machine" definition='//node[@class="system"]/vendor = "Intel Corp."'
$ maas maas tags new name="Virtual_Machine" definition='//node[@class="system"]/vendor = "QEMU"'
$ maas maas tags new name="Laptop" definition='//node[@class="system"]/description = "Laptop"'
$ maas maas tags new name="Rack_Mount" definition='//node[@class="system"]/description = "Rack Mount Chassis"'
$ maas maas tags new name="Mini_Tower" definition='//node[@class="system"]/description = "Mini Tower Computer"'
$ maas maas tags new name="System" definition='//node[@class="system"]/description = "System"'
$ maas maas tags new name="Desktop" definition='//node[@class="system"]/description = "Desktop Computer"'
$ maas maas tags new name="Blade" definition='//node[@class="system"]/description = "Multi-system"'
$ maas maas tags new name="Intel_CPU" definition='//node[@class="processor"]/vendor = "Intel Corp."'
$ maas maas tags new name="AMD_CPU" definition='//node[@class="processor"]/vendor = "Advanced Micro Devices [AMD]"'
$ maas maas tags new name="64bit" definition='//node[@class="system"]/width="64"'
$ maas maas tags new name="32bit" definition='//node[@class="system"]/width="32"'

これらは、準拠しているノードにDell_Machine、Intel_Machine、Virtual_Machine、Rack_Mount、システム、デスクトップ、ノートパソコン、Rack_Mount、マルチシステム、64ビット、32ビットなどのタグを付け、後で追加されるすべてのノードにも適用されます。

タグの手動作成

新しい未加工タグは、MAAS cli コマンドで作成されます

$ maas <profile> tag new name="<tag-name>" [comment="<comment>"]
  • <profile> は、login コマンドでセットアップされたプロファイル名 (通常は "maaS") です。
  • <tag-name> はタグの名前です
  • <comment> はオプションですが、良いアイデアです。

ここでは説明オプションを使用していないことに注意してください。   だから:

$ maas maas tag new name="my-juju-node" comment="my new juju node"

このタグは、システム内の1つ以上のノードに手動で割り当てることができます。

タグの割り当て

1つまたは複数のノードにタグを割り当てるには、次のコマンドを実行します。

$ maas <profile> tag update-nodes <raw-tag-name> add="<system-id>"
  • <profile> は、ログイン時に設定されるプロファイル名です
  • <raw-tag-name> は、以前に作成したタグの名前です
  • <system-id> は、ノードのシステムIDです。

<システムID>?  あれは、何ですか。

ノードのシステムIDをどのように見つけますか?   1 つの方法は、ノード情報を一覧表示し、構造体から取り出すことです。  maas cli コマンド

$ maas <profile> nodes list
  • <profile> は、ログイン時に設定されるプロファイル名です

は、ノードに関するすべての情報を含むJSON形式のオブジェクト(構造体のリスト)をダンプします。  例:

$ maas maas nodes list

[
{
"status": 4,
"macaddress_set": [
{
"resource_uri": "/MAAS/api/1.0/nodes/node-2349c038-d792-11e3-8df4-0c54a5f0ce34/macs/bc%3A30%3A5b%3Ae3%3A21%3A15/",
"mac_address": "bc:30:5b:e3:21:15"
}
],
"hostname": "T110ii.maas",
"zone": {
"resource_uri": "/MAAS/api/1.0/zones/default/",
"name": "default",
"description": ""
},
"routers": [],
"netboot": true,
"cpu_count": 8,
"storage": 239825,
"owner": null,
"system_id": "node-2349c038-d792-11e3-8df4-0c54a5f0ce34",
"architecture": "amd64/generic",
"memory": 8192,
"power_type": "ipmi",
"tag_names": [
"use-fastpath-installer",
"my-juju-boostrap-node"
],
"ip_addresses": [
"192.168.0.53"
],
"resource_uri": "/MAAS/api/1.0/nodes/node-2349c038-d792-11e3-8df4-0c54a5f0ce34/"
},
]

出力のデコード

リストの最初のノードには、「T110ii.maas」の「hostname」属性があります。また、このノードのsystem-id属性も確認します。「system_id」: 「node-2349c038-d792-11e3-8df4-0c54a5f0ce34」

これで、このノードに新しいタグを割り当てることができます。

$ maas maas tag update-nodes my-juju-bootstap-node add=node-2349c038-d792-11e3-8df4-0c54a5f0ce34

図 1 の「tag-names」属性には、このノードに割り当てられているすべてのタグ (新しいタグを含む) が一覧表示されます。

タグの追加に役立つスクリプト

Options:

  • --login : ノードにタグを割り当てる前にログインします。このオプションには、
    • –oauth :上記へのログインに使用されるAPI / OAuthキーで、設定によっては、
    • –host_url:上記のログインに使用されるホストURL
    • –profile :上記のログインに使用されるプロファイル名
  • --remove_tags : このスクリプトで以前に割り当てられたタグを削除します。
  • --add_tags:名前に基づいて各ノードにタグを追加します

リファレンス

コマンド・ライン・インターフェース MAAS 1.6 資料:

https://maas.io/docs/maas-cliこのハイパーリンクをクリックすると、デル・テクノロジーズ以外のWebサイトにアクセスします。

Jujuドキュメント(制約) 

https://juju.ubuntu.com/docs/charms-constraints.htmlこのハイパーリンクをクリックすると、デル・テクノロジーズ以外のWebサイトにアクセスします。

https://juju.ubuntu.com/docs/reference-constraints.htmlこのハイパーリンクをクリックすると、デル・テクノロジーズ以外のWebサイトにアクセスします。

Cause

-

Resolution

-

Article Properties


Affected Product

Ubuntu Server LTS

Last Published Date

23 Jul 2024

Version

4

Article Type

Solution