Creating OpenStack Virtual Machines with Salt Cloud

Salt Cloud is a powerful component of SaltStack that enables cloud infrastructure management across multiple providers, including OpenStack. This guide walks through configuring Salt Cloud to deploy virtual machines on an OpenStack environment, covering installation, provider setup, testing, and VM deployment.

1. Install Salt Cloud and Dependencies

First, instal the required SaltStack components and Python libraries for cloud integration:

[root@salt-master ~]# yum -y install salt-master salt-minion salt-cloud python-libcloud

2. Configure OpenStack Provider

Create a provider configuration file to define how Salt Cloud connects to your OpenStack envirnoment. Place this file in /etc/salt/cloud.providers.d/:

[root@salt-master ~]# mkdir -p /etc/salt/cloud.providers.d/
[root@salt-master ~]# cat /etc/salt/cloud.providers.d/openstack.conf
openstack_provider:
  # Salt master location
  minion:
    master: 192.168.100.10
  # OpenStack driver configuration
  identity_url: http://192.168.100.10:5000/v2.0/tokens
  compute_name: nova
  protocol: ipv4
  compute_region: RegionOne
  # Authentication credentials
  user: demo
  password: demo
  tenant: demo
  provider: openstack
  insecure: false

3. Test OpenStack Connection

Verify connectivity by listing available images and instence sizes:

[root@salt-master ~]# salt-cloud --list-images openstack_provider -l debug
openstack_provider:
  openstack:
    cirros:
      id: 90f1b52f-25dd-43f1-9f78-4d4de67aabfe
      name: cirros
      status: ACTIVE
      min_disk: 0
      min_ram: 0
      created: 2015-12-23T16:47:33Z
    ubuntu:
      id: fdd664b3-ebf2-4904-815f-0d1cdf9955d4
      name: ubuntu
      status: ACTIVE
      min_disk: 10
      min_ram: 512
      created: 2015-12-25T09:17:50Z

[root@salt-master ~]# salt-cloud --list-sizes openstack_provider -l debug

4. Create VM Profile

Define a profile for your VM configuration, including image, size, network, and Salt minion settings. Place this in /etc/salt/cloud.profiles.d/:

[root@salt-master ~]# mkdir -p /etc/salt/cloud.profiles.d/
[root@salt-master ~]# cat /etc/salt/cloud.profiles.d/web_server.conf
web_server_profile:
  provider: openstack_provider
  size: m1.tiny
  image: cirros
  ssh_key_file: /root/.ssh/id_rsa
  ssh_key_name: mykey
  ssh_interface: private_ips
  networks:
    - fixed:
      - 8fb1d37e-414f-4f5d-89f7-8d20fa8fabed
  minion:
    master: 192.168.100.10
    grains:
      role: webserver

5. Deploy Virtual Machine

Use the profile to create a new VM. The -p flag specifies the profile, and the argument is the VM name:

[root@salt-master ~]# salt-cloud -p web_server_profile web-vm-01 -l debug

6. Verify Deployment

Check the VM status in OpenStack:

[root@salt-master ~]# nova list
+--------------------------------------+-----------+--------+------------+-------------+---------------------+
| ID                                   | Name      | Status | Task State | Power State | Networks           |
+--------------------------------------+-----------+--------+------------+-------------+---------------------+
| b4035529-6cd7-4b9b-a6e9-c63d5bfb2d4b | web-vm-01 | ACTIVE | -          | Running     | flat=192.168.56.118 |
+--------------------------------------+-----------+--------+------------+-------------+---------------------+

The VM is now running with Salt minion pre-configured and added to the Salt master.

Tags: openstack salt-cloud python-libcloud cloud-automation infrastructure-as-code

Posted on Mon, 07 Sep 2026 16:23:16 +0000 by brmcdani