15.2. Satellite Server への Google GCE 接続の追加
この手順を使用して、Google Compute Engine (GCE) を Satellite のコンピュートリソースとして追加します。Satellite Web UI の代わりに CLI を使用する場合は、CLI 手順 を参照してください。
手順
- Google GCE で、サービスアカウントキーを JSON 形式で生成します。
ファイルをローカルマシンから Satellite Server にコピーします。
scp gce_key.json root@satellite.example.com:/usr/share/foreman/gce_key.json
# scp gce_key.json root@satellite.example.com:/usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーの所有者を
foreman
ユーザーに変更します。chown foreman /usr/share/foreman/gce_key.json
# chown foreman /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーのアクセス許可を設定して、ファイルが読み取り可能であることを確認します。
chmod 0600 /usr/share/foreman/gce_key.json
# chmod 0600 /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーの SELinux コンテキストを復元します。
restorecon -vv /usr/share/foreman/gce_key.json
# restorecon -vv /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! - Satellite Web UI で Infrastructure > Compute Resources に移動して、Create Compute Resource をクリックします。
- 名前 フィールドには、コンピュートリソースの名前を入力します。
- プロバイダー のリストから Google を選択します。
- オプション: 説明 フィールドに、リソースの説明を入力します。
- Google プロジェクト ID フィールドに、プロジェクト ID を入力します。
- クライアント E-メール フィールドに、クライアントのメールアドレスを入力します。
-
証明書パス フィールドに、サービスアカウントキーへのパスを入力します。(例:
/usr/share/foreman/gce_key.json
など) - ゾーンのロード をクリックして GCE 環境からゾーンリストを生成します。
- ゾーン リストから使用する GCE ゾーンを選択します。
- Submit をクリックします。
CLI 手順
- Google GCE で、サービスアカウントキーを JSON 形式で生成します。
ファイルをローカルマシンから Satellite Server にコピーします。
scp gce_key.json root@satellite.example.com:/usr/share/foreman/gce_key.json
# scp gce_key.json root@satellite.example.com:/usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーの所有者を
foreman
ユーザーに変更します。chown foreman /usr/share/foreman/gce_key.json
# chown foreman /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーのアクセス許可を設定して、ファイルが読み取り可能であることを確認します。
chmod 0600 /usr/share/foreman/gce_key.json
# chmod 0600 /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! Satellite Server で、サービスアカウントキーの SELinux コンテキストを復元します。
restorecon -vv /usr/share/foreman/gce_key.json
# restorecon -vv /usr/share/foreman/gce_key.json
Copy to Clipboard Copied! hammer compute-resource create
コマンドを使用して GCE コンピュートリソースを Satellite に追加します。hammer compute-resource create \ --email "My_GCE_Email" \ --key-path "Path_To_My_GCE_Key.json" \ --name "My_GCE_Compute_Resource" \ --project "My_GCE_Project_ID" \ --provider "gce" \ --zone "My_Zone"
# hammer compute-resource create \ --email "My_GCE_Email" \ --key-path "Path_To_My_GCE_Key.json" \ --name "My_GCE_Compute_Resource" \ --project "My_GCE_Project_ID" \ --provider "gce" \ --zone "My_Zone"
Copy to Clipboard Copied!