此内容没有您所选择的语言版本。
Chapter 16. Provisioning Cloud Instances on Microsoft Azure Resource Manager
Red Hat Satellite can interact with Microsoft Azure Resource Manager, including creating new virtual machines and controlling their power management states. Only image-based provisioning is supported for creating Azure hosts.
For more information about Azure Resource Manager concepts, see Azure Resource Manager documentation.
Note that Satellite does not support Azure Government.
Prerequisites
- Synchronized content repositories for Red Hat Enterprise Linux. For more information, see Synchronizing Red Hat Repositories in the Content Management Guide.
- An activation key for host registration. For more information, see Creating An Activation Key in the Content Management guide.
- Ensure that you have the correct permissions to create an Azure Active Directory application. For more information, see Check Azure AD permissions in the Microsoft identity platform (Azure Active Directory for developers) documentation.
- You must create and configure an Azure Active Directory application and service principle to obtain Application or client ID, Directory or tenant ID, and Client Secret. For more information, see Use the portal to create an Azure AD application and service principal that can access resources in the Microsoft identity platform (Azure Active Directory for developers) documentation.
-
Optional: If you want to use Puppet with Azure hosts, navigate to Administer > Settings > Puppet and enable the
Use UUID for certificates
setting to configure Puppet to use consistent Puppet certificate IDs. -
Based on your needs, associate a
finish
oruser_data
provisioning template with the operating system you want to use. For more information about provisioning templates, see Section 2.11, “Provisioning Templates”. - Optional: If you want the virtual machine to use a static private IP address, create a subnet in Satellite with the Network Address field matching the Azure subnet address.
Procedure Overview
- Section 16.1, “Adding a Microsoft Azure Resource Manager Connection to Satellite Server”.
- Section 16.2, “Adding Microsoft Azure Resource Manager Images to Satellite Server”.
- Section 16.3, “Adding Microsoft Azure Resource Manager Details to a Compute Profile”.
- Section 16.4, “Creating Image-based Hosts on Microsoft Azure Resource Manager”.
16.1. Adding a Microsoft Azure Resource Manager Connection to Satellite Server
Use this procedure to add Microsoft Azure Resource Manager as a compute resource in Satellite. Note that you must add a separate compute resource for each Azure Resource Manager region that you want to use.
Procedure
- In the Satellite web UI, navigate to Infrastructure > Compute Resources and click Create Compute Resource.
- In the Name field, enter a name for the compute resource.
- From the Provider list, select Azure Resource Manager.
- Optional: In the Description field, enter a description for the resource.
- In the Client ID field, enter the Application or client ID.
- In the Client Secret field, enter the client secret.
- In the Subscription ID field, enter the subscription ID.
- In the Tenant ID field, enter the Directory or tenant ID.
- From the Azure Region list, select the Azure region to use.
- Click Submit.
For CLI Users
Use the
hammer compute-resource create
command to add an Azure compute resource to Satellite. Note that the value for the--region
option must be in lowercase and must not contain special characters.# hammer compute-resource create --name azure_cr_name \ --provider azurerm \ --tenant tenant-id \ --app-ident client-id \ --secret-key client-secret \ --sub-id subscription-id \ --region 'region'
16.2. Adding Microsoft Azure Resource Manager Images to Satellite Server
To create hosts using image-based provisioning, you must add information about the image, such as access details and the image location, to your Satellite Server.
Procedure
- In the Satellite web UI, navigate to Infrastructure > Compute Resources and click the name of the Microsoft Azure Resource Manager connection.
- Click Create Image.
- In the Name field, enter a name for the image.
- From the Operating System list, select the image’s base operating system.
- From the Architecture list, select the operating system architecture.
-
In the Username field, enter the SSH user name for image access. You cannot use the
root
user. - Optional: In the Password field, enter a password to authenticate with.
- In the Marketplace Image URN field, enter a Marketplace URN. For example, RedHat:RHEL:7-RAW:latest. For more information, see Find Linux VM images in the Azure Marketplace with the Azure CLI.
-
Optional: Select the User Data check box if the image supports user data input, such as
cloud-init
data. - Click Submit to save the image details.
For CLI Users
Create the image with the
hammer compute-resource image create
command. Note that the username that you enter for the image must be the same that you use when you create a host with this image. The--password
option is optional when creating an image. You cannot use theroot
user.# hammer compute-resource image create \ --name Azure_image_name \ --compute-resource azure_cr_name \ --uuid 'RedHat:RHEL:7-RAW:latest' \ --username 'azure_username' \ --user-data no
16.3. Adding Microsoft Azure Resource Manager Details to a Compute Profile
Use this procedure to add Azure hardware settings to a compute profile. When you create a host on Azure using this compute profile, these settings are automatically populated.
Procedure
- In the Satellite web UI, navigate to Infrastructure > Compute Profiles.
- In the Compute Profiles window, click the name of an existing compute profile, or click Create Compute Profile, enter a Name, and click Submit.
- Click the name of the Azure compute resource.
- From the Resource group list, select the resource group to provision to.
- From the VM Size list, select a size of a virtual machine to provision.
- From the Platform list, select Linux. Satellite does not support provisioning virtual machines running Microsoft operating systems.
- In the Username field, enter a user name to authenticate with. Note that the username that you enter for compute profile must be the same that you use when creating an image.
To authenticate the user, use one of the following options:
- To authenticate using a password, enter a password in the Password field.
- To authenticate using an SSH key, enter an SSH key in the SSH Key field.
- Optional: If you want the virtual machine to use a premium virtual machine disk, select the Premium OS Disk check box.
- From the OS Disk Caching list, select the disc caching setting.
- Optional: In the Custom Script Command field, enter commands to perform on the virtual machine when the virtual machine is provisioned.
-
Optional: If you want to run custom scripts when provisioning finishes, in the Comma separated file URIs field, enter comma-separated file URIs of scripts to use. The scripts must contain
sudo
at the beginning because Red Hat Satellite downloads files to the/var/lib/waagent/custom-script/download/0/
directory on the host and scripts require sudo privileges to be executed. - Click Add Interface.
- From the Azure Subnet list, select the Azure subnet to provision to.
- From the Public IP list, select the public IP setting.
- Optional: If you want the virtual machine to use a static private IP, select the Static Private IP check box.
- Click Submit.
For CLI Users
Create a compute profile to use with the Azure Resource Manager compute resource:
# hammer compute-profile create --name compute_profile_name
Add Azure details to the compute profile. With the
username
setting, enter the SSH user name for image access. Note that the username that you enter for compute profile must be the same that you use when creating an image.# hammer compute-profile values create \ --compute-profile "compute_profile_name" \ --compute-resource azure_cr_name \ --compute-attributes="resource_group=resource_group,vm_size=Standard_B1s,username=azure_user,password=azure_password,platform=Linux,script_command=touch /var/tmp/text.txt" \ --interface="compute_public_ip=Dynamic,compute_network=mysubnetID,compute_private_ip=false"
Optional: If you want to run scripts on the virtual machine after provisioning, specify the following settings:
-
To enter the script directly, with the
script_command
setting, enter a command to be executed on the provisioned virtual machine. -
To run a script from a URI, with the
script_uris
setting, enter comma-separated file URIs of scripts to use. The scripts must containsudo
at the beginning because Red Hat Satellite downloads files to the/var/lib/waagent/custom-script/download/0/
directory on the host and therefore scripts require sudo privileges to be executed.
-
To enter the script directly, with the
16.4. Creating Image-based Hosts on Microsoft Azure Resource Manager
In Satellite, you can use Microsoft Azure Resource Manager provisioning to create hosts from an existing image. The new host entry triggers the Microsoft Azure Resource Manager server to create the instance using the pre-existing image as a basis for the new volume.
Procedure
- In the Satellite web UI, navigate to Hosts > Create Host.
- In the Name field, enter a name for the host.
- Click the Organization and Location tabs to ensure that the provisioning context is automatically set to the current context.
- From the Host Group list, select the host group that you want to use to populate the form.
- From the Deploy on list, select the Microsoft Azure Resource Manager connection.
- From the Compute Profile list, select a profile to use to automatically populate virtual machine settings.
- Click the Interface tab and click Edit on the host’s interface.
Verify that the fields are automatically populated, particularly the following items:
- The Name from the Host tab becomes the DNS name.
- The MAC address field is blank. Microsoft Azure Resource Manager assigns a MAC address to the host during provisioning.
- The Azure Subnet field is populated with the required Azure subnet.
- The Managed, Primary, and Provision options are automatically selected for the first interface on the host. If not, select them.
- Optional: If you want to use a static private IP address, from the IPv4 Subnet list select the Satellite subnet with the Network Address field matching the Azure subnet address. In the IPv4 Address field, enter an IPv4 address within the range of your Azure subnet.
- Click the Operating System tab, and confirm that all fields automatically contain values.
- In the Root Password field, enter the root password to authenticate with.
- Click Resolve in Provisioning templates to check the new host can identify the right provisioning templates to use.
- Click the Virtual Machine tab and confirm that these settings are populated with details from the host group and compute profile. Modify these settings to suit your needs.
- Click the Parameters tab, and ensure that a parameter exists that provides an activation key. If not, add an activation key.
- Click Submit to save the host entry.
For CLI Users
Create the host with the
hammer host create
command and include--provision-method image
. Replace the values in the following example with the appropriate values for your environment.# hammer host create \ --name="Azure_VM" \ --organization "Your_Organization" \ --location "Your_Location" \ --compute-resource azure_cr_name \ --compute-profile "compute_profile_name" \ --provision-method 'image' \ --image Azure_image_name \ --domain domain_name \ --architecture x86_64 \ --operatingsystem "operating_system_name"
For more information about additional host creation parameters for this compute resource, enter the hammer host create --help
command.