<a id="cloud-openstack"></a>

# The OpenStack cloud and Juju

This document describes details specific to using your existing OpenStack cloud with Juju.

> See more: [OpenStack](https://www.openstack.org/)

When using this cloud with Juju, it is important to keep in mind that it is a (1) machine cloud and (2) not some other cloud.

> See more: [Cloud differences](https://documentation.ubuntu.com/juju/2.9/reference/cloud.md#cloud-differences)

As the differences related to (1) are already documented generically in the rest of the docs, here we record just those that follow from (2).

## Supported cloud versions

Any version that supports: <br> - compute v2 (Nova) <br> - network v2 (Neutron) (optional) <br> - volume2 (Cinder) (optional) <br> - identity v2 or v3 (Keystone)

## Notes on `juju add-cloud`

Type in Juju: `openstack`.

Name in Juju: User-defined.

**If you want to use the novarc file (recommended):** <br> Source the OpenStack RC file (`source <path to file>`). This will allow Juju to detect values from preset OpenStack environment variables. Run `add-cloud` in interactive mode and accept the suggested defaults.

## Notes on `juju add-credential`

#### IMPORTANT
**If you want to use environment variables (recommended):** <br> Source the OpenStack RC file (see above). Run `add-credential` and accept the suggested defaults.

### Authentication types

#### `userpass`

Attributes:

- username: The username to authenticate with. (required)
- password: The password for the specified username. (required)
- tenant-name: The OpenStack tenant name. (optional)
- tenant-id: The Openstack tenant ID (optional)
- version: The Openstack identity version (optional)
- domain-name: The OpenStack domain name. (optional)
- project-domain-name: The OpenStack project domain name. (optional)
- user-domain-name: The OpenStack user domain name. (optional)

## Notes on `juju bootstrap`

You will need to create an OpenStack machine metadata. If the metadata is available locally, you can pass it to Juju via `juju bootstrap ... --metadata-source <path to metadata simplestreams`. <br> > See more: [How to manage metadata](https://documentation.ubuntu.com/juju/2.9/howto/manage-metadata.md#manage-metadata). <p> **If your cloud has multiple private networks:** You will need to specify the one that you want the instances to boot from via `juju bootstrap ... --model-default network=<network uuid or name>`. <p> **If your cloud’s topology requires that its instances are accessed via floating IP addresses:** Pass the `allocate-public-ip=true` (see constraints below) as a bootstrap constraint.

## Cloud-specific model configuration keys

### external-network

The network label or UUID to create floating IP addresses on when multiple external networks exist.

|               |        |
|---------------|--------|
| type          | string |
| default value | “”     |
| immutable     | false  |
| mandatory     | false  |

### use-openstack-gbp

Whether to use Neutrons Group-Based Policy

|               |       |
|---------------|-------|
| type          | bool  |
| default value | false |
| immutable     | false |
| mandatory     | false |

### policy-target-group

The UUID of Policy Target Group to use for Policy Targets created.

|               |        |
|---------------|--------|
| type          | string |
| default value | “”     |
| immutable     | false  |
| mandatory     | false  |

### use-default-secgroup

Whether new machine instances should have the “default” Openstack security group assigned in addition to juju defined security groups.

|               |       |
|---------------|-------|
| type          | bool  |
| default value | false |
| immutable     | false |
| mandatory     | false |

### network

The network label or UUID to bring machines up on when multiple networks exist.

|               |        |
|---------------|--------|
| type          | string |
| default value | “”     |
| immutable     | false  |
| mandatory     | false  |

## Supported constraints

| [CONSTRAINT](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint)                              |                                                                                         |
|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| conflicting:                                                                                      | `{ref}`instance-type]`vs.`[mem, root-disk, cores]\`                                     |
| supported?                                                                                        |                                                                                         |
| - [allocate-public-ip](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-allocate-public-ip) | ✓                                                                                       |
| - [arch](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-arch)                             | ✓                                                                                       |
| - [container](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-container)                   | ✓                                                                                       |
| - [cores](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-cores)                           | ✓                                                                                       |
| - [cpu-power](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-cpu-power)                   | ✕                                                                                       |
| - [image-id](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-image-id)                     | ✓ (Starting with Juju 3.3) <br> Type: String. <br> Valid values: An OpenStack image ID. |
| - [instance-role](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-instance-role)           | ✕                                                                                       |
| - [instance-type](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-instance-type)           | ✓ <br> Valid values: Any (cloud admin) user defined OpenStack flavor.                   |
| - [mem](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-mem)                               | ✓                                                                                       |
| - [root-disk](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-root-disk)                   | ✓                                                                                       |
| - [root-disk-source](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-root-disk-source)     | ✓ <br> `root-disk-source` is either `local` or `volume`.                                |
| - [spaces](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-spaces)                         | ✕                                                                                       |
| - [tags](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-tags)                             | ✕                                                                                       |
| - [virt-type](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-virt-type)                   | ✓ <br> Valid values: `[kvm, lxd]`.                                                      |
| - [zones](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-zones)                           | ✓                                                                                       |

## Supported placement directives

| [PLACEMENT DIRECTIVE](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive)               |     |
|------------------------------------------------------------------------------------------------------|-----|
| - [<machine>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-machine)               | TBA |
| - [subnet=<subnet>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-subnet)          | ✕   |
| - [system-id=<system ID>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-system-id) | ✕   |
| - [zone=<zone>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-zone)                | ✓   |
