Terraform에서 생성한 클라이언트의 자동 등록

Terraform에서 생성한 새 클라이언트는 SUSE Multi-Linux Manager에 자동으로 등록될 수 있습니다. 등록은 다음의 두 가지 방법으로 수행할 수 있습니다.

  • cloud-init based registration

  • 원격 실행 제공자 기반 등록

1. cloud-init Based Client Registration

Registering by leveraging cloud-init is the preferred way of automatic registering of the newly created virtual machines. This solution avoids configuring an SSH connection to the host. It can also be used regardless of the tool used for client creation.

User can pass the set of user data when deploying the image with Terraform, to automatically register the machine to SUSE Multi-Linux Manager. user_data is run only once at bootstrap, and only the first time the machine is started.

Before using cloud-init to register clients, the user must configure:

The following command will download the bootstrap script and register the new machine when it is created. It should be added to the cloud-init configuration:

curl -s http://hub-server.tf.local/pub/bootstrap/bootstrap-default.sh | bash -s

Any time user_data is updated to change the provisioning, Terraform will destroy and then recreate the machines with a new IP, etc.

2. remote-exec Provisioner Based Registration

The second solution for automatic registering of the newly created virtual machines uses Terraform’s remote-exec provisioner.

remote-exec provisioner interacts with the newly created machines. It opens an SSH connection and can run commands on that machine.

When using remote-exec provisioner to register clients, the user must ensure that the machine running Terraform will have access to the new virtual machine after its creation.

나머지 요구 사항은 cloud-init Based Client Registration을 사용할 때와 동일합니다.

다음 명령은 부트스트랩 스크립트를 다운로드하고 새 머신이 생성될 때 등록하며, 실행할 원격 명령으로 정의해야 합니다.

curl -s http://hub-server.tf.local/pub/bootstrap/bootstrap-default.sh | bash -s

For more information about remote-exec provisioner, see https://www.terraform.io/docs/provisioners/remote-exec.html.