Customize service dialog for AWS instance


#1

I need to customize the AWS instance provisioning using a service dialog. I have ip_addr, vm_name, guest_access_key_pair and security_groups in the service dialog and I can see that they are processed by amazon_CustomizeRequest. However, the values are not applied to the AWS instance during provisioning.

Any idea what else need to be done?

Thanks


#2

Looks like it takes the ID instead of the name as argument. The [@ramrexx] (https://github.com/ramrexx/CloudForms_Essentials/tree/master/automate/CloudForms_Essentials/Integration/Amazon/EC2/DynamicDialogs.class) dynamic dialogs make it easier.

I also found I can also use the following cloud-init script to fix the hostname. However, the ip address still not changing. Any suggestion?

\#cloud-config

hostname: <%= evm[:vm_name] %>
fqdn: <%= evm[:vm_name] %>.example.com

network-interfaces: |
  iface eth0 inet static
    address <%= evm[:ip_addr] %>
    netmask <%= evm[:subnet_mask] %>

#3

@eechong What are the values you are providing?

You should be able to see what we send over in the evm.log.
Look for messages that include “Prov Options:” or “Clone Options:”, there you should find the security group, key pair, and vm name.
For the IP address, I believe you need to set :floating_ip_address, then you will see a log message like Associating floating IP address [#{floating_ip.address}] to #{for_destination}.


#4

I have “ip_addr”, “service_name”, “vm_name”, etc, basic info in the service dialog. The vm_name, service_name are configured properly, but the ip_addr is not.

I am interested in the primary private IP address, not floating IP. I can create an instances directly using Ruby and specify the private IP address following this AWS doc. The “run_instances” call takes many attributes for the instance and private_ip_address is one of them.

However, if I look at the debug output in aws.log I don’t see that in the run_instances call

[----] D, [2016-08-02T17:30:03.009165 #14955:87d994] DEBUG – : Q-task_id([miq_provision_1000000000377]) [Aws::EC2::Client 200 0.911755 0 retries] run_instances(key_name:“MYKEY”,user_data:“I2Nsb3VkLWNvbmZpZwoKaG9zd…SIgPj4gfi9ydW4udHh0\n”,min_count:1,max_count:1,disable_api_termination:false,image_id:“ami-221cc58a4”,instance_type:“t2.micro”,subnet_id:“subnet-ba1f0391”,security_group_ids:[“sg-4ec4c221”],monitoring:{enabled:false},placement:{availability_zone:“us-east-1b”})

Is it supported in ManageIQ/CloudForms?


#5

@ecchong We build a clone_options hash before we make the call to the provider. For AWS, it starts here and super takes it here.

You can set a :clone_options hash in the request and anything specified in there will be merged into our clone_options here. See this bug for more details on usage


#6

@ecchong Has this resolved your issue?


#7

Not yet. I have a case opened with Red Hat to add this extra attribute to clone_options hash. Will post update once I hear back from RH support. Not sure if MqnageIQ already has it.

Thanks


#8

I’m not authorized to see this bug in bugzilla, can you provide some other info source on usage?