From f88eff37d7329db0892c0d7d660a8dbd4e237f23 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Mon, 25 Jan 2016 19:28:10 +0000 Subject: [PATCH] initial steps to provision CentOS Atomic host Signed-off-by: Huamin Chen --- Vagrantfile | 66 ++++++++++++++----- .../tasks/installs/install_on_redhat.yml | 16 ++--- vagrant_variables.yml.atomic | 34 ++++++++++ 3 files changed, 89 insertions(+), 27 deletions(-) create mode 100644 vagrant_variables.yml.atomic diff --git a/Vagrantfile b/Vagrantfile index ccd5773f0..dcfe2fc2c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -19,9 +19,20 @@ STORAGECTL = settings['vagrant_storagectl'] ETH = settings['eth'] 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| if DOCKER then ansible.playbook = 'site-docker.yml' + if settings['skip_tags'] + ansible.skip_tags = settings['skip_tags'] + end else ansible.playbook = 'site.yml' end @@ -83,11 +94,32 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.synced_folder '.', '/home/vagrant/sync', disabled: true 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| config.vm.define "client#{i}" do |client| 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 client.vm.provider :virtualbox do |vb| vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] @@ -114,7 +146,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| (0..NRGWS - 1).each do |i| config.vm.define "rgw#{i}" do |rgw| 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 rgw.vm.provider :virtualbox do |vb| @@ -142,8 +176,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| (0..NMDSS - 1).each do |i| config.vm.define "mds#{i}" do |mds| 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 mds.vm.provider :virtualbox do |vb| vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] @@ -158,7 +193,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| mds.vm.provider :libvirt do |lv| lv.memory = MEMORY end - # Parallels mds.vm.provider "parallels" do |prl| prl.name = "ceph-mds#{i}" @@ -170,8 +204,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| (0..NMONS - 1).each do |i| config.vm.define "mon#{i}" do |mon| 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 mon.vm.provider :virtualbox do |vb| vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"] @@ -198,9 +233,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| (0..NOSDS - 1).each do |i| config.vm.define "osd#{i}" do |osd| osd.vm.hostname = "ceph-osd#{i}" - osd.vm.network :private_network, ip: "#{SUBNET}.10#{i}" - osd.vm.network :private_network, ip: "#{SUBNET}.20#{i}" - + if !OSVM + osd.vm.network :private_network, ip: "#{SUBNET}.10#{i}" + osd.vm.network :private_network, ip: "#{SUBNET}.20#{i}" + end # Virtualbox osd.vm.provider :virtualbox do |vb| (0..1).each do |d| @@ -244,10 +280,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| prl.name = "ceph-osd#{i}" prl.memory = "#{MEMORY}" (0..1).each do |d| - prl.customize ["set", :id, - "--device-add", - "hdd", - "--iface", + prl.customize ["set", :id, + "--device-add", + "hdd", + "--iface", "sata"] end end diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index da0ce967e..670e529ef 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -46,9 +46,7 @@ when: (ceph_origin == "distro" or ceph_stable_rh_storage) and mon_group_name in group_names and - ansible_pkg_mgr == "yum" and - ceph_stable and - ceph_stable_release not in ceph_stable_releases + ansible_pkg_mgr == "yum" - name: install distro or red hat storage ceph mon dnf: @@ -60,9 +58,7 @@ when: (ceph_origin == "distro" or ceph_stable_rh_storage) and mon_group_name in group_names and - ansible_pkg_mgr == "dnf" and - ceph_stable and - ceph_stable_release not in ceph_stable_releases + ansible_pkg_mgr == "dnf" - name: install distro or red hat storage ceph osd yum: @@ -74,9 +70,7 @@ when: (ceph_origin == "distro" or ceph_stable_rh_storage) and osd_group_name in group_names and - ansible_pkg_mgr == "yum" and - ceph_stable and - ceph_stable_release not in ceph_stable_releases + ansible_pkg_mgr == "yum" - name: install distro or red hat storage ceph osd dnf: @@ -88,9 +82,7 @@ when: (ceph_origin == "distro" or ceph_stable_rh_storage) and osd_group_name in group_names and - ansible_pkg_mgr == "dnf" and - ceph_stable and - ceph_stable_release not in ceph_stable_releases + ansible_pkg_mgr == "dnf" - name: install ceph-test yum: diff --git a/vagrant_variables.yml.atomic b/vagrant_variables.yml.atomic new file mode 100644 index 000000000..a4932df97 --- /dev/null +++ b/vagrant_variables.yml.atomic @@ -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' \ No newline at end of file