CLI のセットアップ
IBM Cloud Schematics コマンドラインプラグインを使用して、インフラストラクチャのプロビジョニングプロセス、リソースの構成、アプリケーションワークロードのデプロイメントを自動化します。 IBM Cloud® Schematics コマンド・ラインは、以下のプラットフォーム・アーキテクチャーをサポートします。
- Mac OS X 64 ビット
- Mac OS arm64
- Windows™ 64 ビット
- Windows™ 32 ビット
- Linux™ 64 ビット
- Linux™ arm64
- Linux™ 32 ビット
- PowerLinux™ 64 ビット
- System/390 Linux™ 64 ビット
IBM Cloud コマンド・ラインのインストール
IBM Cloud Schematics の使用を開始するために必要なコマンド・ラインをインストールします。
-
IBM Cloud CLI をインストールします。
コマンド・ラインを頻繁に使用する予定である場合は、 IBM Cloud コマンド・ラインのシェル・オートコンプリート機能の有効化 (Linux/MacOS のみ) を試してください。
-
IBM Cloud CLI にログインします。 プロンプトが出されたら、IBM Cloud 資格情報を入力します。
ibmcloud loginフェデレーテッド ID がある場合は、
ibmcloud login --ssoを使用して、IBM Cloud CLI にログインします。 ユーザー名を入力し、コマンド・ライン出力に示された URL を使用して、ワンタイム・パスコードを取得してください。--ssoなしではログインに失敗し、--ssoオプションを指定すると成功する場合、フェデレーテッド ID があることがわかります。
IBM Cloud Schematics コマンド・ライン・プラグインのインストール
IBM Cloud Schematics プラグインをインストールして、クラウド運用、構成管理、インフラ配備を自動化します。 Schematics プラグインを Cloud Shellにインストールすることもできます。
-
IBM Cloud 用の Schematics コマンド・ライン・プラグインをインストールします。
ibmcloud plugin install schematics -
IBM Cloud Schematics コマンド・ライン・プラグインが正常にインストールされたことを確認します。 このプラグインは
schematicsと表示されます。ibmcloud plugin list出力例
Listing installed plug-ins... Plugin Name Version Status Private endpoints supported schematics[sch] 1.12.28 Update Available true -
サポートされるすべてのコマンドをリストして、Schematics コマンド・ライン・プラグインを使用できることを確認します。 Schematics コマンド・ライン・プラグインを操作するためのコマンド接頭部は
ibmcloud schematicsです。ibmcloud schematics help出力例
NAME: ibmcloud schematics - Automate the deployment and management of IBM Cloud resources using Infrastructure as Code USAGE: ibmcloud schematics command [arguments...] [command options] COMMANDS: action, ac Create and manage Schematics actions. Action let you define the source control repository that contains your playbook yamls etc. and pass environment-specific variables. agent, ag Create and manage agents. Visit 'https://cloud.ibm.com/docs/schematics?topic=schematics-agents-intro' to know more about agents. apply Apply a plan to an workspace to deploy the latest version of your configuration. destroy Destroy resources in an existing workspace. This action cannot be reversed. inventory, iv Create and manage Schematics Inventories. Inventory let you define host group that can contain INI or Resource Query id's job, j Create and manage Schematics jobs. Job let you manage all the jobs like creating/deleting/updating/retrieving. kms listing and enabling IBM Cloud Schematics kms instances and root keys. logs Show details about actions that ran against an workspace. output Get all the output values from your workspace; (ex. result of terraform output command plan Create a plan for an workspace. Plans show how resources would change if you applied the latest version of your workspace configuration. policy, plcy Create and manage policies. Policies tell Schematics which agent it should use to execute Terraform and Ansible jobs in a specific network zone. refresh Refresh the workspace with latest version of your workspace configuration. resource-query, rq Create and manage Schematics Resource Query. Resource query let you define conditions to fetch host group that can be used to perform actions state Advanced state management version Report version information about the IBM Cloud Schematics CLI. workspace, ws Create and manage workspaces. Workspaces let you define the source control repository that contains your Terraform configuration and pass workspace-specific variables. help, h Show help Enter 'ibmcloud schematics help [command]' for more information about a command.
CLI の更新
新機能を利用できるように、IBM Cloud コマンド・ラインと Schematics コマンド・ライン・プラグインは定期的に更新してください。
-
IBM Cloud CLI にログインします。 プロンプトが出されたら、IBM Cloud 資格情報を入力します。
ibmcloud loginフェデレーテッド ID がある場合は、
ibmcloud login --ssoを使用して、IBM Cloud CLI にログインします。 ユーザー名を入力し、コマンド・ライン出力に示された URL を使用して、ワンタイム・パスコードを取得してください。--ssoなしではログインに失敗し、--ssoオプションを指定すると成功する場合、フェデレーテッド ID があることがわかります。 -
Schematics コマンド・ライン・プラグインの更新があるかどうかを確認します。 更新がある場合は、コマンド・ライン出力に**「Update available」**通知が表示されます。
ibmcloud plugin list | grep schematics出力例
schematics 1.12.28 Update Available false -
Schematics コマンド・ライン・プラグインを更新します。
Schematics エージェントの場合、 Schematics プラグインのバージョンは、
1.12.12のバージョンよりも大きくなければなりません。ibmcloud plugin update schematicsibmcloud plugin list | grep schematics出力例
schematics[sch] 1.12.29 true -
Schematics プラグインを表示します。
ibmcloud plugin show schematics出力例
Plugin Name Version Status Private endpoints supported schematics[sch] 1.12.29 true Commands: schematics,sch Automate the deployment and management of IBM Cloud resources using Infrastructure as Code schematics,sch plan Create a plan for an workspace. Plans show how resources would change if you applied the latest version of your workspace configuration. schematics,sch version Report version information about the IBM Cloud Schematics CLI. schematics,sch logs Show details about actions that ran against an workspace. schematics,sch output Get all the output values from your workspace; (ex. result of terraform output command schematics,sch destroy Destroy resources in an existing workspace. This action cannot be reversed. schematics,sch refresh Refresh the workspace with latest version of your workspace configuration. schematics,sch apply Apply a plan to an workspace to deploy the latest version of your configuration. schematics,sch job,j Create and manage Schematics jobs. Job let you manage all the jobs like creating/deleting/updating/retrieving. schematics,sch job,j run Run a job in IBM Cloud Schematics to work with your Schematics entities like workspaces/actions. schematics,sch job,j get Get information about a job. .... schematics,sch workspace,ws upload Upload a tar file to a workspace from the IBM Cloud Schematics service. schematics,sch workspace,ws commands Run one or more terraform commands schematics,sch workspace,ws taint Marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply schematics,sch workspace,ws untaint Unmarks a Terraform-managed resource as tainted, restoring it as the primary instance in the state schematics,sch workspace,ws state Advanced state management schematics,sch workspace,ws import Run a job to import existing resources into workspace schematics,sch inventory,iv Create and manage Schematics Inventories. Inventory let you define host group that can contain INI or Resource Query id's schematics,sch inventory,iv create Create an Inventory in IBM Cloud Schematics to pass to Schematics action for target host groups schematics,sch inventory,iv update Update an Inventory in IBM Cloud Schematics with all new detail schematics,sch inventory,iv get Get information about an inventory schematics,sch inventory,iv list List all existing inventories in targeted account schematics,sch inventory,iv delete Delete an inventory from the IBM Cloud Schematics service schematics,sch agent,ag Create and manage agents. Visit 'https://cloud.ibm.com/docs/schematics?topic=schematics-agents-intro' to know more about agents. schematics,sch agent,ag create Create an agent in IBM Cloud Schematics. schematics,sch agent,ag validate,plan Run validate to create a prerequisite scan that analyses agent and cluster configuration before deploying your agent. schematics,sch agent,ag deploy,apply Run deploy to deploy your agent on the configured cluster. schematics,sch agent,ag get View the details of an agent. schematics,sch agent,ag list List all agents in your IBM Cloud account. schematics,sch agent,ag update Update your agent details. Updating agent does not re-validate or re-deploy your agent. schematics,sch agent,ag health Run health to perform a health check on your deployed agent. schematics,sch agent,ag delete Delete an agent. schematics,sch agent,ag destroy Destroy the resources associated with agent deployment schematics,sch action,ac Create and manage Schematics actions. Action let you define the source control repository that contains your playbook yamls etc. and pass environment-specific variables. schematics,sch action,ac create Create an action in IBM Cloud Schematics to work with your Ansible configuration in source control. schematics,sch action,ac get Get information about an action. schematics,sch action,ac list List all existing actions in this account. schematics,sch action,ac delete Delete an action from the IBM Cloud Schematics service. schematics,sch action,ac update Update the details of an existing action. schematics,sch action,ac upload Upload TAR file to an action from the IBM Cloud Schematics service
IBM Cloud Schematics コマンド行プラグインのアンインストール
IBM Cloud Schematics プラグインをアンインストールして、 Schematics プラグインをローカル・システムから削除します。
-
Schematicsの IBM Cloud コマンド・ライン・プラグインをアンインストールします。
ibmcloud plugin uninstall schematics出力例
Uninstalling plug-in 'schematics'... OK Plug-in 'schematics' was successfully uninstalled. -
IBM Cloud Schematics コマンドライン・プラグインが正常にアンインストールされたことを確認する。
ibmcloud plugin list | grep schematics