cloud-init user-data flag

asked 2018-12-11 03:41:49 -0500

mike11 gravatar image

updated 2018-12-11 06:06:35 -0500

Hi All,

has anyone used the nova-boot command with the --user-data flag? When i try to boot an image with the user-data it boots up properly, but all of the input from the user-data does not transmit to the actual instance. when i boot the VM i do see the a user-data hash as in the image below: image description

When i select config drive the instance does get the user-data info and modifies the VM. i installed the neutron-dhcp-agent, neutron-metadata-agent, however, the only thing that i see in the instance cloud-init.. logs is that it is not able to find a datasource. i added the following to the nova.conf

metadata_listen = controller
metadata_host = controller
verbose = True
ec2_private_dns_show_ip = True
enabled_apis = ec2,osapi_compute,metadata

and in /etc/neutron/dhcp_agent.ini

interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_metadata_network = True
dhcp_broadcast_reply = True

and in the metadata_agent.ini we have:

auth_region = RegionOne
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_region = RegionOne
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = password
nova_metadata_ip = controller
nova_metadata_ip = controller
nova_metadata_port = 8775

I tried multiple examples of user data for example now i tried the user-data:

#cloud-config
users:
  - name: fred #UNIX username
    sudo: ['ALL=(ALL) NOPASSWD:ALL'] #setup sudo privileges if required
  - name: wilma
    ssh-authorized-keys: #insert SSH keys to enable passwordless access
      - [insert key]
    plain_text_password: 'bedrock' #provide a password, very insecure, use SSH keys where possible
write_files:
  - path: /home/README2018.md
    content: |
      ==== Fred instructions ====
      1. Write some instructions!
      ===========================

The log:

can be viewd in the pastebin: https://pastebin.com/jyq0gRE1

edit retag flag offensive close merge delete

Comments

I use it and it works. On your instance, can you curl http://169.254.169.254? What is the precise error message from cloud-init? What user data do you send to the instance?

Bernd Bausch gravatar imageBernd Bausch ( 2018-12-11 04:12:24 -0500 )edit

Hi Bernd, thank you for answering :) I updated the post above. the error i get is Failed to connect to 169.254.169.254 port 80: No route to host. the full log is in the pastebin https://pastebin.com/jyq0gRE1

Thank you

mike11 gravatar imagemike11 ( 2018-12-11 05:30:59 -0500 )edit

There is an issue with your network config or metadata server. Does the instance have any network connectivity? Is the metadata service running? Check with openstack network agent list.

Not sure what the ubuntu module is about. I will have a look at your parameters; don’t hold your breath.

Bernd Bausch gravatar imageBernd Bausch ( 2018-12-11 06:08:26 -0500 )edit

the instance is in a all in one, so the network is local. my metadata-agent is active and running

mike11 gravatar imagemike11 ( 2018-12-11 06:59:47 -0500 )edit