Use OpenStack as cloud provider with Juju

We will use the latest Juju version at the moment (2.6.8-bionic-amd64 from apt packages).

root@juju-host:~ juju add-cloud cloud_name cloud.yaml

“cloud.yaml” should be like this:

clouds:
  $cloud_name:
    type: openstack
    auth-types: [access-key, userpass]
    regions:
      $region_name:
        endpoint: https://$keystone_url:5000/v3

Add credentials:

root@juju-host:~ juju add-credential cloud_name -f cred.yaml

“cred.yaml” should be like this:

credentials:
  $cloud_name:
    $username:
      auth-type: userpass
      password: $userpassword
      tenant-id: $project_id
      username: $username
      project-domain-name: $project_domain
      user-domain-name: $user_domain

Generate metadata:

root@juju-host:~ juju metadata generate-image -d ~/simplestreams -i $openstack_image_id -s bionic -r $openstack_region_name -u $keystone_url:5000/v3
  • $openstack_image_id: You can find the OpenStack Image ID in the OpenStack GUI Project > Compute > Images and then by selecting the image you want it is the first field “ID”.
  • $openstack_region_name: OpenStack Region name can be found by clicking on the top right corner and then on “OpenStack RC file V3”. Opening this file the region name is in the line export OS_REGION_NAME=“Louros”. So “Louros” in this case.
  • $keystone_url: Keyston URL can be found in Project > API Access tab, it’s the URL that corresponds to the Identity service.
  • "-s option" refers to the Juju charm series. Most Juju charms currently support the “bionic” charms series.

Bootstrap the cloud provider :

either by using local metadata

root@juju-host:~ juju bootstrap cloud_name cloud-controller_name --metadata-source ~/simplestreams/images --config network="$private_network_name" --config external-network="$external_network_name" --debug
  • $private_network_name: You can select any of the private networks available in your project (Project > Network > Networks)
  • $external_network_name: You can select any of the external networks available in your project (Project > Network > Networks where Extrenal column has “Yes” value). This network must be used by the same “OpenStack Router” as your chosen “$private_network_name”. (e.g. “External_Network_518”)

(Additionally, the option " --config use-floating-ip=true" can be added, but then all VMs created by Juju willl automatically get assigned a floating IP. Use it with caution as you may not have enough floating IPs for all your Juju VMs.)

Alternatively, image metadata can be exposed via a file server.

root@juju-host:~ juju bootstrap cloud_name cloud-controller_name --model-default image-metadata-url=http://$file_server_url/simplestreams/images/