stackhpc.cluster-infra
OpenStack Cluster-as-a-Service Infrastructure
This role sets up a software-defined OpenStack infrastructure that can create complex application layouts whenever needed. It uses a recent version of OpenStack Heat for this purpose.
Requirements
- The OpenStack APIs must be accessible from the host where you want to deploy.
- You need OpenStack Newton or a later version.
- Client credentials should be set in the environment or using a
clouds.yaml
file.
Python Packages Needed
ansible
jmespath
(needed for thejson_query
filter)
Role Variables
cluster_venv
: (Optional) Path to a Python virtual environment where theshade
package is installed.cluster_auth_type
: (Optional) The name of the OpenStack authentication plugin to use.cluster_auth
: (Optional) A dictionary containing authentication information.cluster_cloud
: (Optional) The name of the OpenStack client configuration cloud name.cluster_state
: The desired state of the cluster:present
,absent
, orquery
. The default ispresent
. If set toquery
, the cluster's configuration will be checked without updating it, and an Ansible inventory will be generated.cluster_name
: The name for the Heat stack, default iscluster
.cluster_environment_nodenet
: Deprecated option for specifying the per-node network resource.cluster_environment_instance
: Deprecated option for specifying resources for instances.cluster_environment
: List of environment files to use when creating the Heat stack.cluster_params
: Parameters passed to the Heat stack.cluster_prefix
: Prefix for instance hostnames.cluster_groups
: List of node groups with attributes like:name
: Group nameflavor
: The instance flavor name or UUID.image
: The image name or UUID.user
: The cloud user name with SSH keys and passwordless sudo configured (e.g.,centos
,debian
, orubuntu
).num_nodes
: Number of nodes to create in this group.volume_size
: (Optional) Size in GB for volumes when using theinstance-w-volume.yaml
environment.volume_type
: (Optional) Type of volumes when usinginstance-w-volume.yaml
.
cluster_keypair
: Name of the SSH key pair to access the instances.cluster_az
: Availability zone for instance creation.cluster_config_drive
: Decide whether to provide metadata via a config drive. Default isfalse
.cluster_net
: List of networks:net
: Name or UUID of a neutron network.subnet
: Name or UUID of a neutron subnet.security_groups
: (Optional) Names or UUIDs of security groups for the instances.floating_net
: (Optional) Neutron network for attaching floating IPs.
node_resource
: Default node resource type (e.g.,Cluster::Instance
orCluster::InstanceWithVolume
).nodenet_resource
: Default network resource type for node networking (e.g.,Cluster::NodeNet1
,Cluster::NodeNet1WithFIP
, etc.).router_networks
: (Optional) List of IP subnet CIDRs for permitting networks. Match the format ofallowed_address_pairs
.
cluster_inventory
: Inventory file generated after deployment for further use with Ansible.cluster_roles
: Group assignments for the Ansible inventory.cluster_group_vars
: Dictionary mapping inventory groups to group variables.cluster_environment_group
: (Optional) Name of an Ansible group for all cluster hosts, useful for representing environments like development or production.
Dependencies
This role requires the shade
package installed on the host. If installed in a virtual environment, specify its path in the cluster_venv
variable. You can use the stackhpc.os-shade role to install it.
Example Playbook
This playbook creates a Heat stack for a cluster with login
and compute
groups.
---
# This playbook creates a cluster using Ansible OpenStack modules.
- hosts: openstack
roles:
- role: stackhpc.cluster-infra
cluster_name: "openhpc"
cluster_params:
cluster_prefix: "ohpc"
cluster_keypair: "admin_rsa"
cluster_net:
- net: "internal"
subnet: "internal"
floating_net: "external"
security_groups:
- "default"
- "slurm"
cluster_groups:
- name: "login"
flavor: "compute-B"
image: "CentOS7-OpenHPC"
num_nodes: 1
node_resource: "Cluster::InstanceWithVolume"
- name: "compute"
flavor: "compute-A"
image: "CentOS7-OpenHPC"
num_nodes: 16
cluster_group_vars:
cluster:
ansible_user: centos
Author Information
- Stig Telfer (stig@stackhpc.com)
- Bharat Kunwar (bharat@stackhpc.com)
This role generates software-defined OpenStack infrastructure that can be used for generating complex application topologies on demand.
ansible-galaxy install stackhpc.cluster-infra