Salt cloud is a provisioning tool that can be integrated with a Cloud Provider. The purpose of this tool is to deploy a minion on a new instance created in the cloud. So the creation of new nodes in your infrastructure is simple and fast.
OpenStack is one of the providers already capable to work with such tools. You need to create two basic configurations for the purpose: one concerning the provider, in our case it is OpenStack, and another containing the definition of the instances to be created.
The configuration related to OpenStack provider must be saved in the proper folder: by default, in Ubuntu/Debian systems such folder is the one located at the path “/etc/salt/cloud.providers.d”.
# cloud.providers.d/my-openstack-provider.conf my-openstack-config: minion: master: 184.108.40.206 identity_url: https://api.my-openstack-provider.com:5000/v2.0/tokens compute_name: nova protocol: ipv4 compute_region: Ireland user: email@example.com password: my-super-secret-password tenant: firstname.lastname@example.org provider: openstack
The file is YML type and can be used for connection to the provider. It contains the configurations of users enabled to create computing resources on OpenStack system, and the 'master' address, needed to configure the 'minion', during its installation on the new resource.
Now we describe the instance types that can be configured afterward via SaltStack. In Ubuntu/Debian systems such configurations can be saved at the following path: “/etc/salt/cloud.profiles.d”
web: provider: my-openstack-config size: 1 GB image: GNU/Linux Ubuntu Server 12.04 LTS Precise Pangolin x64 ssh_username: ubuntu ssh_key_file: /root/key-pair-name.pem ssh_key_name: 'key-pair-name' ssh_interface: public_ips security_groups: salt-minion,web networks: - fixed: - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
The configuration takes the name of the instance profile and the basic configurations related to each new resource of that type. In details: the SSH keys to access the new instance, the security-groups needed for communications (such as virtual network cards) must be connected at start-up.
Once the configuration is ready, the salt cloud tool must be asked to create a new instance of "web" type, as stated in our profile:
salt-cloud -p web web.1.prod
The command execution will create a new instance, using the “web” profile: the instance shall take the name “web.1.prod”. After minion publication, it can be handled as a new node via the "salt" tool.