cloud-init

cloud-init (the Ubuntu package for handling early initialization of cloud instances) can be used to provide additional flexibility when configuring Helion Stackato cluster nodes, and can simplify joining a cluster and assigning roles.

cloud-init can be configured at instance launch time via the --user-data or --user-data-file arguments to ec2-run-instances, or by pasting YAML directly into the EC2 or OpenStack Horizon interfaces.

For example, given a core node at IP 10.2.3.4, the following cloud-config would add a new DEA node to the cluster:

#cloud-config

stackato:
  nats:
    ip: 10.2.3.4
  roles: ['dea']
  extname: "dea.example.com"
  • nats:ip will run kato attach <nats ip> the first time the VM is booted.
  • extname when supplied with a fully qualified domain name will run kato rename <extname> on the instance first boot.
  • Roles takes a list of roles to configure the node with. For guidance on how to work with roles see Roles.

Securing the new node

To lock down and secure this new node, you can use standard cloud-config directives for:

  • adding SSH keys

  • setting a password for the stackato user:

    #cloud-config
    
    chpasswd:
     list: |
       stackato:Amhyljoc6
     expire: false
    
  • setting a random password for the stackato user:

    #cloud-config
    
    chpasswd:
     list: |
       stackato:RANDOM
     expire: false
    
  • configuring trusted CA certificates

Elastic DNS (EC2)

On EC2, it is also possible to use a well-known trick to resolve the public DNS name for an elastic IP to a local IP (within EC2). To use the DNS name rather than a specific local IP, your configuration changes slightly:

#cloud-config

stackato:
  nats:
    elastic_dns: ec2-75-101-137-243.compute-1.amazonaws.com

This configuration will automatically obtain the local IP of whichever node is configured with the public IP 75.101.137.243 and use that when communicating over the message bus.

Custom System Configuration

In addition to the Helion Stackato node configuration tasks described above, cloud-init can be used for a variety of system setup tasks:

  • adding custom apt sources
  • setting apt mirrors
  • running arbitrary commands at boot
  • setting up chef, puppet, salt-stack, or MCollective
  • setting the locale and time zone
  • resizing the root filesystem to take up all available space, making it easy to grow a snapshot
  • set passwords
  • configure ssh keys

For more information on cloud-init, refer to the official CloudInit documentation and the Cloud config examples.