rhel7
installation environment:
172.25.39.1 salt-master server
172.25.29.11 OpenStack control node
The functions implemented by the operation on the Internet. . . .
ps: The following are operated on the salt-master
1. Install the plugin:
yum install salt-cloud python-libcloud
2. Create the salt-cloud configuration file:
mkdir /etc/salt/cloud.providers.d/vim
/etc/salt/cloud.providers.d/openstack.conf
my-openstack-config:
# Set the location of the salt-master
minion:
master: 172.25.39.1
# Configure the OpenStack driver
identity_url: http://172.25.39.11:5000/v2.0/tokens
compute_name: nova
protocol: ipv4
compute_region: RegionOne
# Configure Openstack authentication credentials
user: demo
password: demo
# tenant is the project name
tenant: demo
driver: openstack
provider: openstack
# skip SSL certificate validation (default false)
insecure: false
3. Check the mirror list:
salt-cloud –list-images openstack #View image list
salt-cloud –list-size openstack #View cloud host type
4. Create the saltstack virtual machine template file:
vim /etc/salt/cloud.profiles.d/web.conf
web-node: #虚拟机模板名称
provider: my-openstack-config #前面配置文件定义的
size: m1.tiny #云主机类型
image: cirros #镜像名称
ssh_key_file: /root/.ssh/id_rsa #公钥文件
ssh_key_name: mykey #密钥对名称
ssh_interface: private_ips
networks:
- fixed:
- 69200e49-0f8b-47b6-9bb5-2db9bca9a393 #网络的ID
minion: #下面是自动给虚拟机安装salt-minion并配置
master: 172.25.39.1
grains:
role: webserver-01
4. Create an Openstack virtual machine through saltstack:
salt-cloud -p web-node web-test1 -l debug
-p: 虚拟机模板名称
web-test1: 创建虚拟机的名称
-l debug: 打印debug