Configuration de l'interface de ligne de commande (CLI)

Utilisez le plug-in de ligne de commande IBM Cloud Schematics pour automatiser le processus d'approvisionnement de l'infrastructure, la configuration de vos ressources et le déploiement des charges de travail des applications. La ligne de commande IBM Cloud® Schematics prend en charge les architectures de plateforme suivantes:

  • Mac OS X 64 bits
  • Mac OS arm64
  • Windows™ 64 bits
  • Windows™ 32 bits
  • Linux™ 64 bits
  • Linux™ arm64
  • Linux™ 32 bits
  • PowerLinux™ 64 bits
  • System/390 Linux™ 64 bits

Installation de la ligne de commande IBM Cloud

Installez la ligne de commande requise pour commencer à utiliser IBM Cloud Schematics.

  1. Installez l'interface de ligne de commande IBM Cloud.

    Vous prévoyez une utilisation intensive de la ligne de commande ? Essayez d'activer l'exécution automatique du shell pour la ligne de commande IBM Cloud (Linux/MacOS uniquement).

  2. Connectez-vous à l'interface de ligne de commande IBM Cloud. A l'invite, entrez vos données d'identification IBM Cloud.

    ibmcloud login
    

    Si vous disposez d'un ID fédéré, utilisez ibmcloud login --sso pour vous connecter à l'interface de ligne de commande IBM Cloud. Entrez votre nom d'utilisateur et utilisez l'URL mentionnée dans la sortie de la ligne de commande pour extraire votre code d'accès à usage unique. Si la connexion échoue lorsque vous omettez l'option --sso et aboutit en incluant l'option --sso, ceci indique que votre ID est fédéré.

Installation du plug-in de ligne de commande IBM Cloud Schematics

Installez le plug-in IBM Cloud Schematics pour automatiser les opérations dans le nuage, la gestion de la configuration et les déploiements d'infrastructure. Vous pouvez également installer le plug-in Schematics dans Cloud Shell.

  1. Installez le plug-in de ligne de commande IBM Cloud pour Schematics.

    ibmcloud plugin install schematics
    
  2. Vérifiez que le plug-in de ligne de commande IBM Cloud Schematics est correctement installé. Le plug-in est répertorié sous le nom schematics.

    ibmcloud plugin list
    

    Exemple de sortie

    Listing installed plug-ins...
    
    Plugin Name                             Version      Status             Private endpoints supported
    schematics[sch]                           1.12.28   Update Available                     true
    
  3. Vérifiez que vous pouvez utiliser le plug-in de ligne de commande Schematics en répertoriant toutes les commandes prises en charge. Le préfixe de commande permettant d'utiliser le plug-in de ligne de commande Schematics est ibmcloud schematics.

    ibmcloud schematics help
    

    Exemple de sortie

    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.
    

Mise à jour de l'interface de ligne de commande

Mettez régulièrement à jour la ligne de commande IBM Cloud et le plug-in de ligne de commande Schematics afin de pouvoir accéder à de nouvelles fonctions.

  1. Mettez à jour l'interface de ligne de commandeIBM Cloud.

  2. Connectez-vous à l'interface de ligne de commande IBM Cloud. A l'invite, entrez vos données d'identification IBM Cloud.

    ibmcloud login
    

    Si vous disposez d'un ID fédéré, utilisez ibmcloud login --sso pour vous connecter à l'interface de ligne de commande IBM Cloud. Entrez votre nom d'utilisateur et utilisez l'URL mentionnée dans la sortie de la ligne de commande pour extraire votre code d'accès à usage unique. Si la connexion échoue alors que vous omettez l'option --sso et aboutit en incluant l'option --sso, ceci indique que votre ID est fédéré.

  3. Vérifiez si une mise à jour est disponible pour le plug-in de ligne de commande Schematics. Si une mise à jour est disponible, la sortie de ligne de commande comporte une notification Mise à jour disponible.

    ibmcloud plugin list | grep schematics
    

    Exemple de sortie

    schematics                      1.12.28        Update Available           false
    
  4. Mettez à jour le plug-in de ligne de commande Schematics.

    Pour l'agent Schematics, la version du plug-in Schematics doit être supérieure à la version 1.12.12.

    ibmcloud plugin update schematics
    
    ibmcloud plugin list | grep schematics
    

    Exemple de sortie

    schematics[sch]                      1.12.29        true
    
  5. Affichage du plug-in Schematics.

    ibmcloud plugin show schematics
    

    Exemple de sortie

    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
    

Désinstallation du plug-in de ligne de commande IBM Cloud Schematics

Désinstallez le plug-in IBM Cloud Schematics pour supprimer le plug-in Schematics de votre système local.

  1. Désinstallez le plug-in de ligne de commande IBM Cloud pour Schematics.

    ibmcloud plugin uninstall schematics
    

    Exemple de sortie

    Uninstalling plug-in 'schematics'...
    OK
    Plug-in 'schematics' was successfully uninstalled.
    
  2. Vérifiez que le plug-in de ligne de commande IBM Cloud Schematics a été désinstallé avec succès.

    ibmcloud plugin list | grep schematics