mirror of https://github.com/ceph/ceph-ansible.git
testing: vagranfile should use random hostnames to prevent collisions
Signed-off-by: Alfredo Deza <adeza@redhat.com>pull/1101/head
parent
68668333eb
commit
f531e4d0f8
|
@ -2,6 +2,7 @@
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
require 'securerandom'
|
||||||
VAGRANTFILE_API_VERSION = '2'
|
VAGRANTFILE_API_VERSION = '2'
|
||||||
|
|
||||||
DEBUG = false
|
DEBUG = false
|
||||||
|
@ -32,6 +33,7 @@ USER = settings['ssh_username']
|
||||||
ASSIGN_STATIC_IP = !(BOX == 'openstack' or BOX == 'linode')
|
ASSIGN_STATIC_IP = !(BOX == 'openstack' or BOX == 'linode')
|
||||||
DISABLE_SYNCED_FOLDER = settings.fetch('vagrant_disable_synced_folder', false)
|
DISABLE_SYNCED_FOLDER = settings.fetch('vagrant_disable_synced_folder', false)
|
||||||
|
|
||||||
|
|
||||||
ansible_provision = proc do |ansible|
|
ansible_provision = proc do |ansible|
|
||||||
if DOCKER then
|
if DOCKER then
|
||||||
ansible.playbook = 'site-docker.yml'
|
ansible.playbook = 'site-docker.yml'
|
||||||
|
@ -180,7 +182,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}client#{i}" do |client|
|
config.vm.define "#{LABEL_PREFIX}client#{i}" do |client|
|
||||||
client.vm.hostname = "#{LABEL_PREFIX}ceph-client#{i}"
|
client.vm.hostname = "#{LABEL_PREFIX}ceph-client#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
client.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.4#{i}"
|
client.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.4#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
client.vm.provider :virtualbox do |vb|
|
client.vm.provider :virtualbox do |vb|
|
||||||
|
@ -214,7 +217,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}rgw#{i}" do |rgw|
|
config.vm.define "#{LABEL_PREFIX}rgw#{i}" do |rgw|
|
||||||
rgw.vm.hostname = "#{LABEL_PREFIX}ceph-rgw#{i}"
|
rgw.vm.hostname = "#{LABEL_PREFIX}ceph-rgw#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
rgw.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.5#{i}"
|
rgw.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.5#{i}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
|
@ -249,7 +253,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "nfs#{i}" do |nfs|
|
config.vm.define "nfs#{i}" do |nfs|
|
||||||
nfs.vm.hostname = "ceph-nfs#{i}"
|
nfs.vm.hostname = "ceph-nfs#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
nfs.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.6#{i}"
|
nfs.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.6#{i}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
|
@ -284,7 +289,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}mds#{i}" do |mds|
|
config.vm.define "#{LABEL_PREFIX}mds#{i}" do |mds|
|
||||||
mds.vm.hostname = "#{LABEL_PREFIX}ceph-mds#{i}"
|
mds.vm.hostname = "#{LABEL_PREFIX}ceph-mds#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
mds.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.7#{i}"
|
mds.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.7#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
mds.vm.provider :virtualbox do |vb|
|
mds.vm.provider :virtualbox do |vb|
|
||||||
|
@ -317,7 +323,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}rbd_mirror#{i}" do |rbd_mirror|
|
config.vm.define "#{LABEL_PREFIX}rbd_mirror#{i}" do |rbd_mirror|
|
||||||
rbd_mirror.vm.hostname = "#{LABEL_PREFIX}ceph-rbd-mirror#{i}"
|
rbd_mirror.vm.hostname = "#{LABEL_PREFIX}ceph-rbd-mirror#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
rbd_mirror.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.8#{i}"
|
rbd_mirror.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.8#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
rbd_mirror.vm.provider :virtualbox do |vb|
|
rbd_mirror.vm.provider :virtualbox do |vb|
|
||||||
|
@ -350,7 +357,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}iscsi_gw#{i}" do |iscsi_gw|
|
config.vm.define "#{LABEL_PREFIX}iscsi_gw#{i}" do |iscsi_gw|
|
||||||
iscsi_gw.vm.hostname = "#{LABEL_PREFIX}ceph-iscsi-gw#{i}"
|
iscsi_gw.vm.hostname = "#{LABEL_PREFIX}ceph-iscsi-gw#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
iscsi_gw.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.9#{i}"
|
iscsi_gw.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.9#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
iscsi_gw.vm.provider :virtualbox do |vb|
|
iscsi_gw.vm.provider :virtualbox do |vb|
|
||||||
|
@ -383,7 +391,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}mon#{i}" do |mon|
|
config.vm.define "#{LABEL_PREFIX}mon#{i}" do |mon|
|
||||||
mon.vm.hostname = "#{LABEL_PREFIX}ceph-mon#{i}"
|
mon.vm.hostname = "#{LABEL_PREFIX}ceph-mon#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
mon.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.1#{i}"
|
mon.vm.network :private_network,
|
||||||
|
ip: "#{PUBLIC_SUBNET}.1#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
mon.vm.provider :virtualbox do |vb|
|
mon.vm.provider :virtualbox do |vb|
|
||||||
|
@ -417,8 +426,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.define "#{LABEL_PREFIX}osd#{i}" do |osd|
|
config.vm.define "#{LABEL_PREFIX}osd#{i}" do |osd|
|
||||||
osd.vm.hostname = "#{LABEL_PREFIX}ceph-osd#{i}"
|
osd.vm.hostname = "#{LABEL_PREFIX}ceph-osd#{i}"
|
||||||
if ASSIGN_STATIC_IP
|
if ASSIGN_STATIC_IP
|
||||||
osd.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.10#{i}"
|
osd.vm.network :private_network,
|
||||||
osd.vm.network :private_network, ip: "#{CLUSTER_SUBNET}.20#{i}"
|
ip: "#{PUBLIC_SUBNET}.10#{i}"
|
||||||
|
osd.vm.network :private_network,
|
||||||
|
ip: "#{CLUSTER_SUBNET}.20#{i}"
|
||||||
end
|
end
|
||||||
# Virtualbox
|
# Virtualbox
|
||||||
osd.vm.provider :virtualbox do |vb|
|
osd.vm.provider :virtualbox do |vb|
|
||||||
|
|
Loading…
Reference in New Issue