initial steps to provision CentOS Atomic host

Signed-off-by: Huamin Chen <hchen@redhat.com>
pull/648/head
Huamin Chen 2016-01-25 19:28:10 +00:00 committed by Sébastien Han
parent fd03074cd5
commit f88eff37d7
3 changed files with 89 additions and 27 deletions

66
Vagrantfile vendored
View File

@ -19,9 +19,20 @@ STORAGECTL = settings['vagrant_storagectl']
ETH = settings['eth'] ETH = settings['eth']
DOCKER = settings['docker'] DOCKER = settings['docker']
if BOX == 'openstack'
require 'vagrant-openstack-provider'
OSVM = true
USER = settings['os_ssh_username']
else
OSVM = false
end
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'
if settings['skip_tags']
ansible.skip_tags = settings['skip_tags']
end
else else
ansible.playbook = 'site.yml' ansible.playbook = 'site.yml'
end end
@ -83,11 +94,32 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
override.vm.synced_folder '.', '/home/vagrant/sync', disabled: true override.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
end end
if BOX == 'openstack'
# OpenStack VMs
config.vm.provider :openstack do |os|
config.vm.synced_folder ".", "/home/#{USER}/vagrant", disabled: true
config.ssh.username = USER
config.ssh.private_key_path = settings['os_ssh_private_key_path']
config.ssh.pty = true
os.openstack_auth_url = settings['os_openstack_auth_url']
os.username = settings['os_username']
os.password = settings['os_password']
os.tenant_name = settings['os_tenant_name']
os.region = settings['os_region']
os.flavor = settings['os_flavor']
os.image = settings['os_image']
os.keypair_name = settings['os_keypair_name']
os.security_groups = ['default']
config.vm.provision "shell", inline: "true", upload_path: "/home/#{USER}/vagrant-shell"
end
end
(0..CLIENTS - 1).each do |i| (0..CLIENTS - 1).each do |i|
config.vm.define "client#{i}" do |client| config.vm.define "client#{i}" do |client|
client.vm.hostname = "ceph-client#{i}" client.vm.hostname = "ceph-client#{i}"
client.vm.network :private_network, ip: "#{SUBNET}.4#{i}" if !OSVM
client.vm.network :private_network, ip: "#{SUBNET}.4#{i}"
end
# Virtualbox # Virtualbox
client.vm.provider :virtualbox do |vb| client.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
@ -114,7 +146,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(0..NRGWS - 1).each do |i| (0..NRGWS - 1).each do |i|
config.vm.define "rgw#{i}" do |rgw| config.vm.define "rgw#{i}" do |rgw|
rgw.vm.hostname = "ceph-rgw#{i}" rgw.vm.hostname = "ceph-rgw#{i}"
rgw.vm.network :private_network, ip: "#{SUBNET}.5#{i}" if !OSVM
rgw.vm.network :private_network, ip: "#{SUBNET}.5#{i}"
end
# Virtualbox # Virtualbox
rgw.vm.provider :virtualbox do |vb| rgw.vm.provider :virtualbox do |vb|
@ -142,8 +176,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(0..NMDSS - 1).each do |i| (0..NMDSS - 1).each do |i|
config.vm.define "mds#{i}" do |mds| config.vm.define "mds#{i}" do |mds|
mds.vm.hostname = "ceph-mds#{i}" mds.vm.hostname = "ceph-mds#{i}"
mds.vm.network :private_network, ip: "#{SUBNET}.7#{i}" if !OSVM
mds.vm.network :private_network, ip: "#{SUBNET}.7#{i}"
end
# Virtualbox # Virtualbox
mds.vm.provider :virtualbox do |vb| mds.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
@ -158,7 +193,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
mds.vm.provider :libvirt do |lv| mds.vm.provider :libvirt do |lv|
lv.memory = MEMORY lv.memory = MEMORY
end end
# Parallels # Parallels
mds.vm.provider "parallels" do |prl| mds.vm.provider "parallels" do |prl|
prl.name = "ceph-mds#{i}" prl.name = "ceph-mds#{i}"
@ -170,8 +204,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(0..NMONS - 1).each do |i| (0..NMONS - 1).each do |i|
config.vm.define "mon#{i}" do |mon| config.vm.define "mon#{i}" do |mon|
mon.vm.hostname = "ceph-mon#{i}" mon.vm.hostname = "ceph-mon#{i}"
mon.vm.network :private_network, ip: "#{SUBNET}.1#{i}" if !OSVM
mon.vm.network :private_network, ip: "#{SUBNET}.1#{i}"
end
# Virtualbox # Virtualbox
mon.vm.provider :virtualbox do |vb| mon.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
@ -198,9 +233,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(0..NOSDS - 1).each do |i| (0..NOSDS - 1).each do |i|
config.vm.define "osd#{i}" do |osd| config.vm.define "osd#{i}" do |osd|
osd.vm.hostname = "ceph-osd#{i}" osd.vm.hostname = "ceph-osd#{i}"
osd.vm.network :private_network, ip: "#{SUBNET}.10#{i}" if !OSVM
osd.vm.network :private_network, ip: "#{SUBNET}.20#{i}" osd.vm.network :private_network, ip: "#{SUBNET}.10#{i}"
osd.vm.network :private_network, ip: "#{SUBNET}.20#{i}"
end
# Virtualbox # Virtualbox
osd.vm.provider :virtualbox do |vb| osd.vm.provider :virtualbox do |vb|
(0..1).each do |d| (0..1).each do |d|
@ -244,10 +280,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
prl.name = "ceph-osd#{i}" prl.name = "ceph-osd#{i}"
prl.memory = "#{MEMORY}" prl.memory = "#{MEMORY}"
(0..1).each do |d| (0..1).each do |d|
prl.customize ["set", :id, prl.customize ["set", :id,
"--device-add", "--device-add",
"hdd", "hdd",
"--iface", "--iface",
"sata"] "sata"]
end end
end end

View File

@ -46,9 +46,7 @@
when: when:
(ceph_origin == "distro" or ceph_stable_rh_storage) and (ceph_origin == "distro" or ceph_stable_rh_storage) and
mon_group_name in group_names and mon_group_name in group_names and
ansible_pkg_mgr == "yum" and ansible_pkg_mgr == "yum"
ceph_stable and
ceph_stable_release not in ceph_stable_releases
- name: install distro or red hat storage ceph mon - name: install distro or red hat storage ceph mon
dnf: dnf:
@ -60,9 +58,7 @@
when: when:
(ceph_origin == "distro" or ceph_stable_rh_storage) and (ceph_origin == "distro" or ceph_stable_rh_storage) and
mon_group_name in group_names and mon_group_name in group_names and
ansible_pkg_mgr == "dnf" and ansible_pkg_mgr == "dnf"
ceph_stable and
ceph_stable_release not in ceph_stable_releases
- name: install distro or red hat storage ceph osd - name: install distro or red hat storage ceph osd
yum: yum:
@ -74,9 +70,7 @@
when: when:
(ceph_origin == "distro" or ceph_stable_rh_storage) and (ceph_origin == "distro" or ceph_stable_rh_storage) and
osd_group_name in group_names and osd_group_name in group_names and
ansible_pkg_mgr == "yum" and ansible_pkg_mgr == "yum"
ceph_stable and
ceph_stable_release not in ceph_stable_releases
- name: install distro or red hat storage ceph osd - name: install distro or red hat storage ceph osd
dnf: dnf:
@ -88,9 +82,7 @@
when: when:
(ceph_origin == "distro" or ceph_stable_rh_storage) and (ceph_origin == "distro" or ceph_stable_rh_storage) and
osd_group_name in group_names and osd_group_name in group_names and
ansible_pkg_mgr == "dnf" and ansible_pkg_mgr == "dnf"
ceph_stable and
ceph_stable_release not in ceph_stable_releases
- name: install ceph-test - name: install ceph-test
yum: yum:

View File

@ -0,0 +1,34 @@
---
# DEFINE THE NUMBER OF VMS TO RUN
mon_vms: 1
osd_vms: 1
mds_vms: 0
rgw_vms: 0
client_vms: 0
# SUBNET TO USE FOR THE VMS
subnet: 192.168.0
# MEMORY
memory: 1024
disks: "[ '/dev/sdb', '/dev/sdc' ]"
eth: 'enp0s3'
# VAGRANT BOX
# Fedora: https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-22-20150521.x86_64.vagrant-virtualbox.box
# Ubuntu: ubuntu/trusty64
# CentOS: chef/centos-7.0
# Debian: deb/jessie-amd64 - be careful the storage controller is named 'SATA Controller'
# For more boxes have a look at:
# - https://atlas.hashicorp.com/boxes/search?utf8=✓&sort=&provider=virtualbox&q=
# - https://download.gluster.org/pub/gluster/purpleidea/vagrant/
vagrant_box: centos/atomic-host
# if vagrant fails to attach storage controller, add the storage controller name by:
# VBoxManage storagectl `VBoxManage list vms |grep ceph-ansible-osd|awk '{print $1}'|tr \" ' '` --name "LsiLogic" --add scsi
# and "vagrant up" again
vagrant_storagectl: 'LsiLogic'
skip_tags: 'with_pkg'