Convert DevStack Build Profile to Ansible

This change removes Chef from the DevStack build profile and replaces
it with an Ansible role.

Change-Id: I2976a27aabad7b623bf8d55bc146deff5f14e35e
This commit is contained in:
David Schroeder 2015-03-03 12:29:13 -07:00
parent b1ef59fd53
commit 7a908d8a02
11 changed files with 37 additions and 108 deletions

View File

@ -18,8 +18,8 @@ The following services are enabled:
# Upstart instead of screen
The cookbook includes a script which creates Upstart init scripts for each of
the services. It also sets up log files in the `/var/log/` directory. When
The Ansible role includes a script which creates Upstart init scripts for each
of the services. It also sets up log files in the `/var/log/` directory. When
the VM is booted, all DevStack processes will start automatically.
# Usage

15
ds-build/Vagrantfile vendored
View File

@ -6,15 +6,8 @@ Dir.chdir ".."
VAGRANTFILE_API_VERSION = "2" # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
unless Vagrant.has_plugin?("vagrant-berkshelf")
raise "The needed plugin vagrant-berkshelf is not available.
Install it by calling 'vagrant plugin install vagrant-berkshelf'."
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Settings for all vms
config.berkshelf.enabled = true
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
@ -41,11 +34,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vb.memory = 7180
vb.cpus = 4
end
ds.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.roles_path = "roles"
chef.add_role "Devstack-Build"
chef.arguments = '--force-formatter'
ds.vm.provision "ansible" do |ansible|
ansible.playbook = "ds-build.yml"
ansible.raw_arguments = ['-T 30', '-e pipelining=True']
end
end

View File

@ -1,29 +0,0 @@
ds-build cookbook
=========================
Builds a Devstack VM around Ubuntu Trusty
This box is used by the Monasca OpenStack monitoring platform.
Based on Ubuntu 14.04 LTS (Trusty Tahr), the box includes
DevStack with the following services enabled:
- Ceilometer
- Cinder
- Glance
- Heat
- Horizon
- Keystone
- Neutron
- Nova
- Swift
Additionally, rather than running in screen sessions, all services are started
on boot using Upstart scripts, with logging in appropriate directories under
`/var/log/`.
Requirements
------------
Recipes
---------
- default - Installs devstack from source, creates upstart scripts

View File

@ -1,8 +0,0 @@
name "ds-build"
maintainer "Mon Team"
maintainer_email "hpcs-mon@hp.com"
license "All rights reserved"
description "Build customized devstack server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.3"
depends "apt"

View File

@ -1,39 +0,0 @@
# Create a devstack image (https://vagrantcloud.com/monasca/devstack)
# from the latest devstack source
# Install git
package 'git' do
action :install
end
# Remove apt proxy (populated by default in ubuntu/trusty64)
file "/etc/apt/apt.conf.d/01proxy" do
action :delete
end
# Load up devstack configuration and installer script
cookbook_file "local.conf" do
mode 0755
owner "vagrant"
path "/home/vagrant/local.conf"
action :create_if_missing
end
cookbook_file "autostack.sh" do
mode 0755
owner "vagrant"
path "/home/vagrant/autostack.sh"
action :create_if_missing
end
# Install devstack if it hasn't been installed yet
if !::File.exists?("/home/vagrant/devstack/stack-screenrc")
log "Please wait while devstack is installed. This WILL take a while." do
level :info
end
execute "/home/vagrant/autostack.sh vagrant"
end
# Make sure a 'localhost' entry exists in /etc/hosts
# It sometimes gets overridden by vagrant
execute "sed -i 's/^127.0.0.1.*/127.0.0.1 devstack localhost/' /etc/hosts"

8
ds-build/ds-build.yml Normal file
View File

@ -0,0 +1,8 @@
- hosts: devstack
sudo: yes
vars:
unpriv_user: vagrant
unpriv_home: /home/{{unpriv_user}}
roles:
- {role: devstack-build, tags: [devstack]}

View File

@ -1,18 +0,0 @@
{
"name": "Devstack-Build",
"description": "Builds up a devstack server with all available services running",
"json_class": "Chef::Role",
"default_attributes": {
"apt": {
"periodic_update_min_delay": 60
}
},
"override_attributes": {
},
"chef_type": "role",
"run_list": [
"recipe[ds-build]"
],
"env_run_lists": {
}
}

View File

@ -0,0 +1,3 @@
---
unpriv_user: vagrant
unpriv_home: /home/{{unpriv_user}}

View File

@ -0,0 +1,21 @@
---
- name: Install git
apt: name=git state=present
- name: Remove apt proxy (populated by default in ubuntu/trusty64)
file: path=/etc/apt/apt.conf.d/01proxy state=absent
- name: Install local.conf to the unprivileged user's home directory
copy: src=local.conf dest={{unpriv_home}}/local.conf mode=0755 owner={{unpriv_user}}
- name: Install autostack.sh script
copy: src=autostack.sh dest={{unpriv_home}}/autostack.sh mode=0755 owner={{unpriv_user}}
- name: Run DevStack installer (may take 30-90 minutes, depending on bandwidth)
command: "{{unpriv_home}}/autostack.sh {{unpriv_user}}"
args:
chdir: "{{unpriv_home}}"
creates: "{{unpriv_home}}/devstack/stack-screenrc"
- name: Make sure 'localhost' entry exists in /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 devstack localhost' owner=root group=root mode=0644